aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2020-05-28 14:44:19 -0700
committerGeorge Burgess <gbiv@chromium.org>2020-06-02 16:57:02 +0000
commitecc87506c6ee96549b6fac099884ab08c7371c03 (patch)
tree524d1200514d549880d4ff9bcde24e8829b56ff0 /compiler_wrapper
parent5e6744551b328f1dd8fec78491df13e30193fddd (diff)
downloadtoolchain-utils-ecc87506c6ee96549b6fac099884ab08c7371c03.tar.gz
compiler_wrapper: add a `static` option
If this option is specified, we'll build a fully static binary, rather than having it link with libc. If unspecified, our behavior shouldn't differ from what we have today. BUG=chromium:1087435 TEST=CQ Change-Id: If3939336e4e10d0279501f56ffbed8272a5f546c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2219362 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper')
-rwxr-xr-xcompiler_wrapper/build.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler_wrapper/build.py b/compiler_wrapper/build.py
index 037b940f..8ae23409 100755
--- a/compiler_wrapper/build.py
+++ b/compiler_wrapper/build.py
@@ -25,7 +25,19 @@ def parse_args():
parser.add_argument(
'--use_llvm_next', required=True, choices=['true', 'false'])
parser.add_argument('--output_file', required=True, type=str)
- return parser.parse_args()
+ parser.add_argument(
+ '--static',
+ choices=['true', 'false'],
+ help='If true, produce a static wrapper. Autodetects a good value if '
+ 'unspecified.')
+ args = parser.parse_args()
+
+ if args.static is None:
+ args.static = 'cros' not in args.config
+ else:
+ args.static = args.static == 'true'
+
+ return args
def calc_go_args(args, version):
@@ -42,7 +54,7 @@ def calc_go_args(args, version):
# If the wrapper is intended for Chrome OS, we need to use libc's exec.
extra_args = []
- if 'cros' in args.config:
+ if not args.static:
extra_args = ['-tags', 'libc_exec']
return [