aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcompiler_wrapper/build.py17
-rw-r--r--compiler_wrapper/config.go5
-rw-r--r--compiler_wrapper/cros_llvm_next_flags.go18
3 files changed, 32 insertions, 8 deletions
diff --git a/compiler_wrapper/build.py b/compiler_wrapper/build.py
index 8ae23409..f98b2549 100755
--- a/compiler_wrapper/build.py
+++ b/compiler_wrapper/build.py
@@ -40,7 +40,7 @@ def parse_args():
return args
-def calc_go_args(args, version):
+def calc_go_args(args, version, build_dir):
ldFlags = [
'-X',
'main.ConfigName=' + args.config,
@@ -55,7 +55,17 @@ def calc_go_args(args, version):
# If the wrapper is intended for Chrome OS, we need to use libc's exec.
extra_args = []
if not args.static:
- extra_args = ['-tags', 'libc_exec']
+ extra_args += ['-tags', 'libc_exec']
+
+ if args.config == 'android':
+ # If android_llvm_next_flags.go DNE, we'll get an obscure "no
+ # llvmNextFlags" build error; complaining here is clearer.
+ if not os.path.exists(
+ os.path.join(build_dir, 'android_llvm_next_flags.go')):
+ sys.exit('In order to build the Android wrapper, you must have a local '
+ 'android_llvm_next_flags.go file; please see '
+ 'cros_llvm_next_flags.go.')
+ extra_args += ['-tags', 'android_llvm_next_flags']
return [
'go', 'build', '-o',
@@ -84,7 +94,8 @@ def main():
version = read_version(build_dir)
# Note: Go does not support using absolute package names.
# So we run go inside the directory of the the build file.
- sys.exit(subprocess.call(calc_go_args(args, version), cwd=build_dir))
+ sys.exit(
+ subprocess.call(calc_go_args(args, version, build_dir), cwd=build_dir))
if __name__ == '__main__':
diff --git a/compiler_wrapper/config.go b/compiler_wrapper/config.go
index fc43a29b..e82e6b3d 100644
--- a/compiler_wrapper/config.go
+++ b/compiler_wrapper/config.go
@@ -93,11 +93,6 @@ func getConfig(configName string, useCCache bool, useLlvmNext bool, version stri
return &cfg, nil
}
-// TODO: Enable test in config_test.go, once we have new llvm-next flags.
-var llvmNextFlags = []string{}
-
-var llvmNextPostFlags = []string{}
-
// Full hardening.
// Temporarily disable function splitting because of chromium:434751.
var crosHardenedConfig = &config{
diff --git a/compiler_wrapper/cros_llvm_next_flags.go b/compiler_wrapper/cros_llvm_next_flags.go
new file mode 100644
index 00000000..6cd7cd2a
--- /dev/null
+++ b/compiler_wrapper/cros_llvm_next_flags.go
@@ -0,0 +1,18 @@
+// Copyright 2020 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.
+
+// +build !android_llvm_next_flags
+
+package main
+
+// This file defines extra flags for llvm-next testing for Chrome OS. Importantly, these flags don't
+// apply to Android's llvm-next wrapper. Android's toolchain-utils copy has a
+// `android_llvm_next_flags.go` file downstream that defines its llvm-next arguments. As you can
+// probably infer, `android_llvm_next_flags.go` is only compiled if the `android_llvm_next_flags`
+// tag is set.
+
+// TODO: Enable test in config_test.go, once we have new llvm-next flags.
+var llvmNextFlags = []string{}
+
+var llvmNextPostFlags = []string{}