Backout 3c0bda5f0564:58e5f6f08c54 (bug 1451104) for inadvertently stressing tooltool and busting this CLOSED TREE
authorNathan Froyd <froydnj@mozilla.com>
Thu, 28 Jun 2018 10:28:29 -0400
changeset 812137 b59bec39784a7bc0808836029a555c0286e74043
parent 812136 3003f32da21966f9f20511ab7495ccd77b6f964a
child 812138 afbadca69031d7d465e53bf4e9d8fd95ea33bc10
push id114453
push userrwood@mozilla.com
push dateThu, 28 Jun 2018 15:10:03 +0000
bugs1451104
milestone63.0a1
backs out3c0bda5f056488e0bbd89b753abe9041563e24a6
Backout 3c0bda5f0564:58e5f6f08c54 (bug 1451104) for inadvertently stressing tooltool and busting this CLOSED TREE
build/autoconf/clang-plugin.m4
build/build-clang/build-clang.py
build/unix/build-gcc/build-gcc.sh
taskcluster/ci/toolchain/linux.yml
taskcluster/ci/toolchain/macosx.yml
taskcluster/scripts/misc/build-llvm-dsymutil.sh
--- a/build/autoconf/clang-plugin.m4
+++ b/build/autoconf/clang-plugin.m4
@@ -31,21 +31,17 @@ if test -n "$ENABLE_CLANG_PLUGIN"; then
     AC_MSG_RESULT([$LLVMCONFIG])
 
     if test -z "$LLVMCONFIG"; then
         AC_MSG_ERROR([Cannot find an llvm-config binary for building a clang plugin])
     fi
     dnl For some reason the llvm-config downloaded from clang.llvm.org for clang3_8
     dnl produces a -isysroot flag for a sysroot which might not ship when passed
     dnl --cxxflags. We use sed to remove this argument so that builds work on OSX
-    dnl
-    dnl For a similar reason, we remove any -gcc-toolchain arguments, since the
-    dnl directories specified by such arguments might not exist on the current
-    dnl machine.
-    LLVM_CXXFLAGS=`$LLVMCONFIG --cxxflags | sed -e 's/-isysroot [[^ ]]*//' -e 's/-gcc-toolchain [[^ ]]*//'`
+    LLVM_CXXFLAGS=`$LLVMCONFIG --cxxflags | sed -e 's/-isysroot [[^ ]]*//'`
 
     LLVM_LDFLAGS=`$LLVMCONFIG --ldflags | tr '\n' ' '`
 
     if test "${HOST_OS_ARCH}" = "Darwin"; then
         dnl We need to make sure that we use the symbols coming from the clang
         dnl binary. In order to do this, we need to pass -flat_namespace and
         dnl -undefined suppress to the linker. This makes sure that we link the
         dnl symbols into the flat namespace provided by clang, and thus get
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -107,25 +107,17 @@ def delete(path):
     else:
         try:
             os.unlink(path)
         except Exception:
             pass
 
 
 def install_libgcc(gcc_dir, clang_dir):
-    gcc_bin_dir = os.path.join(gcc_dir, 'bin')
-    clang_bin_dir = os.path.join(clang_dir, 'bin')
-
-    # Copy over gcc toolchain bits that clang looks for, to ensure that
-    # clang is using a consistent version of ld, since the system ld may
-    # be incompatible with the output clang produces.
-    shutil.copy2(os.path.join(gcc_bin_dir, 'ld'), clang_bin_dir)
-
-    out = subprocess.check_output([os.path.join(gcc_bin_dir, "gcc"),
+    out = subprocess.check_output([os.path.join(gcc_dir, "bin", "gcc"),
                                    '-print-libgcc-file-name'])
 
     libgcc_dir = os.path.dirname(out.rstrip())
     clang_lib_dir = os.path.join(clang_dir, "lib", "gcc",
                                  "x86_64-unknown-linux-gnu",
                                  os.path.basename(libgcc_dir))
     mkdir_p(clang_lib_dir)
     copy_tree(libgcc_dir, clang_lib_dir)
@@ -514,40 +506,22 @@ if __name__ == "__main__":
         extra_cxxflags = ["-stdlib=libc++"]
         extra_cflags2 = []
         extra_cxxflags2 = ["-stdlib=libc++"]
         extra_asmflags = []
         extra_ldflags = []
     elif is_linux():
         extra_cflags = ["-static-libgcc"]
         extra_cxxflags = ["-static-libgcc", "-static-libstdc++"]
-        # When building stage2 and stage3, we want the newly-built clang to pick
-        # up whatever headers were installed from the gcc we used to build stage1,
-        # always, rather than the system headers.  Providing -gcc-toolchain
-        # encourages clang to do that.
-        extra_cflags2 = ["-fPIC",
-                         '-gcc-toolchain', stage1_inst_dir]
+        extra_cflags2 = ["-fPIC"]
         # Silence clang's warnings about arguments not being used in compilation.
-        extra_cxxflags2 = ["-fPIC", '-Qunused-arguments', "-static-libstdc++",
-                           '-gcc-toolchain', stage1_inst_dir]
+        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/build/unix/build-gcc/build-gcc.sh
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -49,23 +49,19 @@ build_binutils() {
   ../binutils-$binutils_version/configure --prefix=${prefix-/tools/gcc}/ $binutils_configure_flags
   make $make_flags
   make install $make_flags DESTDIR=$root_dir
   export PATH=$root_dir/${prefix-/tools/gcc}/bin:$PATH
   popd
 }
 
 build_gcc() {
-  # Be explicit about --build and --target so header and library install
-  # directories are consistent.
-  local target="${1:-x86_64-unknown-linux-gnu}"
-
   mkdir $root_dir/gcc-objdir
   pushd $root_dir/gcc-objdir
-  ../gcc-$gcc_version/configure --prefix=${prefix-/tools/gcc} --build=x86_64-unknown-linux-gnu --target="${target}" --enable-languages=c,c++  --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro --with-sysroot=/
+  ../gcc-$gcc_version/configure --prefix=${prefix-/tools/gcc} --enable-languages=c,c++  --disable-nls --disable-gnu-unique-object --enable-__cxa_atexit --with-arch-32=pentiumpro --with-sysroot=/
   make $make_flags
   make $make_flags install DESTDIR=$root_dir
 
   cd $root_dir/tools
   ln -s gcc gcc/bin/cc
 
   tar caf $root_dir/gcc.tar.xz gcc/
   popd
--- a/taskcluster/ci/toolchain/linux.yml
+++ b/taskcluster/ci/toolchain/linux.yml
@@ -20,17 +20,17 @@ linux64-clang-3.9:
         using: toolchain-script
         script: build-clang-3.9-linux.sh
         resources:
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-3.9-linux64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/clang.tar.xz
     toolchains:
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 linux64-clang-5:
     description: "Clang 5 toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(clang5)
         tier: 1
@@ -41,17 +41,17 @@ linux64-clang-5:
         using: toolchain-script
         script: build-clang-5-linux.sh
         resources:
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-5-linux64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/clang.tar.xz
     toolchains:
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 linux64-clang-6:
     description: "Clang 6 toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(clang6)
         tier: 1
@@ -63,17 +63,17 @@ linux64-clang-6:
         script: build-clang-6-linux.sh
         resources:
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-6-linux64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-alias: linux64-clang
         toolchain-artifact: public/build/clang.tar.xz
     toolchains:
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 linux64-clang-6-macosx-cross:
     description: "Clang 6 toolchain build with MacOS Compiler RT libs"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(clang6-macosx-cross)
         tier: 1
@@ -90,17 +90,17 @@ linux64-clang-6-macosx-cross:
             - 'build/build-clang/clang-6-macosx64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-alias: linux64-clang-macosx-cross
         toolchain-artifact: public/build/clang.tar.xz
         tooltool-downloads: internal
     toolchains:
         - linux64-cctools-port
         - linux64-clang-6
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 linux64-clang-tidy:
     description: "Clang-tidy build"
     index:
         product: static-analysis
         job-name: linux64-clang-tidy
     treeherder:
         kind: build
@@ -118,17 +118,42 @@ linux64-clang-tidy:
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-tidy-linux64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/clang-tidy.tar.xz
     run-on-projects:
         - trunk
         - try
     toolchains:
-        - linux64-gcc-6
+        - linux64-gcc-4.9
+
+linux64-gcc-4.9:
+    description: "GCC 4.9 toolchain build"
+    treeherder:
+        kind: build
+        platform: toolchains/opt
+        symbol: TL(gcc4.9)
+        tier: 1
+    worker-type: aws-provisioner-v1/gecko-{level}-b-linux
+    worker:
+        max-run-time: 3600
+    run:
+        using: toolchain-script
+        script: build-gcc-4.9-linux.sh
+        resources:
+            - 'build/unix/build-gcc/build-gcc.sh'
+        toolchain-artifact: public/build/gcc.tar.xz
+    fetches:
+        - binutils-2.25.1
+        - cloog-0.18.1
+        - gcc-4.9.4
+        - gmp-5.1.3
+        - isl-0.12.2
+        - mpc-0.8.2
+        - mpfr-3.1.5
 
 linux64-gcc-6:
     description: "GCC 6 toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(gcc6)
         tier: 1
@@ -211,17 +236,17 @@ linux64-llvm-dsymutil:
     worker-type: aws-provisioner-v1/gecko-{level}-b-linux
     worker:
         max-run-time: 1800
     run:
         using: toolchain-script
         script: build-llvm-dsymutil.sh
         toolchain-artifact: public/build/llvm-dsymutil.tar.xz
     toolchains:
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 linux64-binutils:
     description: "Binutils toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(binutil)
         tier: 1
@@ -518,17 +543,17 @@ linux64-gn:
         resources:
             - 'taskcluster/scripts/misc/tooltool-download.sh'
             - 'taskcluster/scripts/misc/build-gn-common.sh'
         toolchain-artifact: public/build/gn.tar.xz
     run-on-projects:
         - trunk
         - try
     toolchains:
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 linux64-tup:
     description: "tup toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(tup)
         tier: 2
@@ -540,17 +565,17 @@ linux64-tup:
         script: build-tup-linux.sh
         resources:
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/tup.tar.xz
     run-on-projects:
         - trunk
         - try
     toolchains:
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 linux64-upx:
     description: "UPX build for MinGW32 Cross Compile"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TMW(upx)
         tier: 2
--- a/taskcluster/ci/toolchain/macosx.yml
+++ b/taskcluster/ci/toolchain/macosx.yml
@@ -28,17 +28,17 @@ macosx64-clang:
         resources:
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-6-macosx64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/clang.tar.xz
     toolchains:
         - linux64-cctools-port
         - linux64-clang-6
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 macosx64-clang-tidy:
     description: "Clang-tidy build"
     index:
         product: static-analysis
         job-name: macosx64-clang-tidy
     treeherder:
         kind: build
@@ -58,17 +58,17 @@ macosx64-clang-tidy:
             - 'build/clang-plugin/**'
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-tidy-macosx64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/clang-tidy.tar.xz
     toolchains:
         - linux64-cctools-port
         - linux64-clang-6
-        - linux64-gcc-6
+        - linux64-gcc-4.9
 
 macosx64-cctools-port:
     description: "cctools-port toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TM(cctools)
         tier: 1
--- a/taskcluster/scripts/misc/build-llvm-dsymutil.sh
+++ b/taskcluster/scripts/misc/build-llvm-dsymutil.sh
@@ -51,19 +51,16 @@ 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