aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/gcc_flags.go
blob: 2c553e6bf55fa0db343bc2bec1daf8bfe08e234d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package main

func processGccFlags(builder *commandBuilder) {
	if !builder.cfg.isHostWrapper {
		// Flags not supported by GCC.
		unsupported := map[string]bool{"-Xcompiler": true}

		// Conversion for flags supported by clang but not gcc.
		clangToGcc := map[string]string{
			"-march=alderlake": "-march=skylake",
		}

		builder.transformArgs(func(arg builderArg) string {
			if unsupported[arg.value] {
				return ""
			}
			if mapped, ok := clangToGcc[arg.value]; ok {
				return mapped
			}
			return arg.value
		})
	}

	builder.path += ".real"
}