• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package main
6
7func processGccFlags(builder *commandBuilder) {
8	if !builder.cfg.isHostWrapper {
9		// Flags not supported by GCC.
10		unsupported := map[string]bool{"-Xcompiler": true}
11
12		// Conversion for flags supported by clang but not gcc.
13		clangToGcc := map[string]string{
14			"-march=goldmont":      "-march=silvermont",
15			"-march=goldmont-plus": "-march=silvermont",
16			"-march=skylake":       "-march=corei7",
17			"-march=tigerlake":     "-march=corei7",
18			"-march=tremont":       "-march=silvermont",
19		}
20
21		builder.transformArgs(func(arg builderArg) string {
22			if unsupported[arg.value] {
23				return ""
24			}
25			if mapped, ok := clangToGcc[arg.value]; ok {
26				return mapped
27			}
28			return arg.value
29		})
30	}
31
32	builder.path += ".real"
33}
34