diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2020-01-06 13:46:28 -0800 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2020-01-06 13:46:28 -0800 |
commit | 8870276337d5e4fd6cd9af12d8249211b62f8c0b (patch) | |
tree | 8d8c3b674683425e30ea95696670cfcc63d19d2f /bin/aarch64-linux-android-gcc-broken | |
parent | 341acfc53e646fcc3720fc9a62eca07e1dc3912d (diff) | |
download | aarch64-linux-android-4.9-8870276337d5e4fd6cd9af12d8249211b62f8c0b.tar.gz |
gcc-4.9: move binaries to find build breakages
As per:
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/GCC_4_9_DEPRECATION.md
We're about to remove gcc-4.9; move the binaries to see if we can spot
any build breakages in pre or post submit testing.
Build cops may revert this change if necessary.
Please report any unexpected build breakages to: android-llvm@googlegroups.com
Bug: 147240075
Change-Id: I9b449adf75586db52281af70cf7826b6e7db4634
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to 'bin/aarch64-linux-android-gcc-broken')
-rwxr-xr-x | bin/aarch64-linux-android-gcc-broken | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/bin/aarch64-linux-android-gcc-broken b/bin/aarch64-linux-android-gcc-broken new file mode 100755 index 0000000..aea6314 --- /dev/null +++ b/bin/aarch64-linux-android-gcc-broken @@ -0,0 +1,77 @@ +#!/usr/bin/python + +from __future__ import print_function +import os +import sys +import time + +class CompilerWrapper(): + def __init__(self, argv): + self.args = argv + self.execargs = [] + self.real_compiler = None + self.argv0 = None + self.append_flags = [] + self.prepend_flags = [] + self.custom_flags = { + '--gomacc-path': None + } + + def set_real_compiler(self): + """Find the real compiler with the absolute path.""" + compiler_path = os.path.dirname(os.path.abspath(__file__)) + if os.path.islink(__file__): + compiler = os.path.basename(os.readlink(__file__)) + else: + compiler = os.path.basename(os.path.abspath(__file__)) + self.real_compiler = os.path.join( + compiler_path, + "84372336-a816-11e9-9669-5b66bd3072d3") + self.argv0 = self.real_compiler + + def process_gomacc_command(self): + """Return the gomacc command if '--gomacc-path' is set.""" + gomacc = self.custom_flags['--gomacc-path'] + if gomacc and os.path.isfile(gomacc): + self.argv0 = gomacc + self.execargs += [gomacc] + + def parse_custom_flags(self): + i = 0 + args = [] + while i < len(self.args): + if self.args[i] in self.custom_flags: + self.custom_flags[self.args[i]] = self.args[i + 1] + i = i + 2 + else: + args.append(self.args[i]) + i = i + 1 + self.args = args + + def add_flags(self): + self.args = self.prepend_flags + self.args + self.append_flags + + def print_deprecation_warning(self): + print("Android GCC has been deprecated in favor of Clang, and will be removed from\n" + "Android in 2020-01 as per the deprecation plan in:\n" + "https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/GCC_4_9_DEPRECATION.md\n\n", + file=sys.stderr) + + + def invoke_compiler(self): + self.print_deprecation_warning() + self.set_real_compiler() + self.parse_custom_flags() + self.process_gomacc_command() + self.add_flags() + self.execargs += [self.real_compiler] + self.args + time.sleep(3) + os.execv(self.argv0, self.execargs) + + +def main(argv): + cw = CompilerWrapper(argv[1:]) + cw.invoke_compiler() + +if __name__ == "__main__": + main(sys.argv) |