Bug 1451104 - part 1 - ensure compatible binutils for GCC; r=glandium
authorNathan Froyd <froydnj@mozilla.com>
Thu, 28 Jun 2018 09:04:41 -0400
changeset 479410 58e5f6f08c54a318e59cd5ef1482602e3a68ddf0
parent 479409 343e3f2f6764cc70cdce84e67cc2e383d8600641
child 479411 6f3d601d1ad8431bbdc4b5fe0970db1a352f8fa7
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1451104
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1451104 - part 1 - ensure compatible binutils for GCC; r=glandium GCC will pick up whatever `as` is first in PATH when trying to assemble files. It expects this `as` to have at least as many features as the `as` detected at configure time when GCC was originally built. We should ensure that GCC is always picking up an appropriate `as` by adding its base directory to the search path; otherwise, we get peculiar assembler errors.
build/build-clang/build-clang.py
taskcluster/scripts/misc/build-llvm-dsymutil.sh
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -512,16 +512,28 @@ if __name__ == "__main__":
         extra_cflags = ["-static-libgcc"]
         extra_cxxflags = ["-static-libgcc", "-static-libstdc++"]
         extra_cflags2 = ["-fPIC"]
         # Silence clang's warnings about arguments not being used in compilation.
         extra_cxxflags2 = ["-fPIC", '-Qunused-arguments', "-static-libstdc++"]
         extra_asmflags = []
         extra_ldflags = []
 
+        # We want to ensure that the GCC we use for stage 1 always picks up the
+        # binutils it is packaged with, rather than the system binutils, which
+        # might be a much different version and therefore lacking in support for
+        # features GCC expects.
+        binutils_flags = ['-B', os.path.dirname(cc)]
+        if cc.endswith('gcc'):
+            extra_cflags += binutils_flags
+        if cxx.endswith('g++'):
+            extra_cxxflags += binutils_flags
+        if asm.endswith('gcc'):
+            extra_asmflags += binutils_flags
+
         if 'LD_LIBRARY_PATH' in os.environ:
             os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' %
                                              (gcc_dir, os.environ['LD_LIBRARY_PATH']))
         else:
             os.environ['LD_LIBRARY_PATH'] = '%s/lib64/' % gcc_dir
     elif is_windows():
         extra_cflags = []
         extra_cxxflags = []
--- a/taskcluster/scripts/misc/build-llvm-dsymutil.sh
+++ b/taskcluster/scripts/misc/build-llvm-dsymutil.sh
@@ -51,16 +51,19 @@ EOF
 mkdir build
 cd build
 
 cmake \
   -GNinja \
   -DCMAKE_BUILD_TYPE=Release \
   -DLLVM_TARGETS_TO_BUILD=X86 \
   -DCMAKE_C_COMPILER=$HOME_DIR/src/gcc/bin/gcc \
+  -DCMAKE_CXX_COMPILER=$HOME_DIR/src/gcc/bin/g++ \
+  -DCMAKE_C_FLAGS="-B $HOME_DIR/src/gcc/bin" \
+  -DCMAKE_CXX_FLAGS="-B $HOME_DIR/src/gcc/bin" \
   ..
 
 export LD_LIBRARY_PATH=$HOME_DIR/src/gcc/lib64
 
 ninja llvm-dsymutil llvm-symbolizer
 
 tar --xform='s,^,llvm-dsymutil/,' -Jcf llvm-dsymutil.tar.xz bin/llvm-dsymutil bin/llvm-symbolizer