aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/thumb_flags.go
diff options
context:
space:
mode:
authorTobias Bosch <tbosch@google.com>2019-06-10 15:50:33 -0700
committerTobias Bosch <tbosch@google.com>2019-06-20 15:41:37 +0000
commitef8f969c8ea2498c2a8aa701cb2e83833339f9a8 (patch)
treea3c988999263f4e43ec561908b452093ad169b53 /compiler_wrapper/thumb_flags.go
parent87d457dfc5ae0a7631917523eb3c62751453e4bb (diff)
downloadtoolchain-utils-ef8f969c8ea2498c2a8aa701cb2e83833339f9a8.tar.gz
Initial version of a go version of the compiler wrapper.
Still calls the old wrapper if one of the following flags is given: - Xclang-path - clang-syntax - env WITH_TIDY - env FORCE_DISABLE_WERROR - env GETRUSAGE - env BISECT_STAGE BUG=chromium:773875 TEST=Unit tests that also verify the produced command against the TEST=existing compiler wrapper. Change-Id: I1e0a720ce9f485d8015deefb2682f2cb760d82e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1652057 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Tobias Bosch <tbosch@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Diffstat (limited to 'compiler_wrapper/thumb_flags.go')
-rw-r--r--compiler_wrapper/thumb_flags.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler_wrapper/thumb_flags.go b/compiler_wrapper/thumb_flags.go
new file mode 100644
index 00000000..fa65875e
--- /dev/null
+++ b/compiler_wrapper/thumb_flags.go
@@ -0,0 +1,23 @@
+package main
+
+import (
+ "strings"
+)
+
+func processThumbCodeFlags(builder *commandBuilder) {
+ arch := builder.target.arch
+ if builder.target.abi != "eabi" && (strings.HasPrefix(arch, "armv7") || strings.HasPrefix(arch, "armv8")) {
+ // ARM32 specfic:
+ // 1. Generate thumb codes by default. GCC is configured with
+ // --with-mode=thumb and defaults to thumb mode already. This
+ // changes the default behavior of clang and doesn't affect GCC.
+ // 2. Do not force frame pointers on ARM32 (https://crbug.com/693137).
+ builder.addPreUserArgs("-mthumb")
+ builder.transformArgs(func(arg builderArg) string {
+ if !arg.FromUser && arg.Value == "-fno-omit-frame-pointer" {
+ return ""
+ }
+ return arg.Value
+ })
+ }
+}