Bug 1471698 - Remove our binutils-corruption-avoiding workaround for mingw-clang r=froydnj a=jcristau
authorTom Ritter <tom@mozilla.com>
Wed, 22 May 2019 13:40:36 +0000
changeset 536483 aaeda42f9fbf3c791ef428fd53afbd122ce92bd8
parent 536482 2b5515b4274ba0ff95a539cbc7f9d0b72dd9e6ca
child 536484 fbf66e32c2c215cdcc9fecaafbdda27fb0dd7132
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, jcristau
bugs1471698
milestone68.0
Bug 1471698 - Remove our binutils-corruption-avoiding workaround for mingw-clang r=froydnj a=jcristau Depends on D31347 Differential Revision: https://phabricator.services.mozilla.com/D31349
browser/config/mozconfigs/win32/mingwclang
browser/config/mozconfigs/win64/mingwclang
taskcluster/scripts/misc/build-clang-8-mingw.sh
--- a/browser/config/mozconfigs/win32/mingwclang
+++ b/browser/config/mozconfigs/win32/mingwclang
@@ -51,21 +51,16 @@ ac_add_options --with-clang-path="$CC"
 ac_add_options --with-libclang-path="$TOOLTOOL_DIR/clang/lib"
 CXXFLAGS="-fms-extensions"
 AR=llvm-ar
 RANLIB=llvm-ranlib
 
 # For Stylo
 BINDGEN_CFLAGS="-I$TOOLTOOL_DIR/clang/i686-w64-mingw32/include/c++/v1 -I$TOOLTOOL_DIR/clang/i686-w64-mingw32/include"
 
-# Bug 1471698 - Work around binutils corrupting mingw clang binaries.
-LDFLAGS="-Wl,-S"
-STRIP=/bin/true
-OBJCOPY=/bin/true
-
 # We want to make sure we use binutils and other binaries in the tooltool
 # package.
 mk_add_options "export PATH=$TOOLTOOL_DIR/clang/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
 
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/mingw32/lib64:$TOOLTOOL_DIR/clang/lib
 mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 
 # Do not include the visual studio related mozconfigs of course
--- a/browser/config/mozconfigs/win64/mingwclang
+++ b/browser/config/mozconfigs/win64/mingwclang
@@ -51,21 +51,16 @@ ac_add_options --with-clang-path="$CC"
 ac_add_options --with-libclang-path="$TOOLTOOL_DIR/clang/lib"
 CXXFLAGS="-fms-extensions"
 AR=llvm-ar
 RANLIB=llvm-ranlib
 
 # For Stylo
 BINDGEN_CFLAGS="-I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include/c++/v1 -I$TOOLTOOL_DIR/clang/x86_64-w64-mingw32/include"
 
-# Bug 1471698 - Work around binutils corrupting mingw clang binaries.
-LDFLAGS="-Wl,-S"
-STRIP=/bin/true
-OBJCOPY=/bin/true
-
 # We want to make sure we use binutils and other binaries in the tooltool
 # package.
 mk_add_options "export PATH=$TOOLTOOL_DIR/clang/bin:$TOOLTOOL_DIR/mingw32/bin:$TOOLTOOL_DIR/wine/bin:$TOOLTOOL_DIR/upx/bin:$TOOLTOOL_DIR/fxc2/bin:$PATH"
 
 LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/mingw32/lib64:$TOOLTOOL_DIR/clang/lib
 mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 
 # Do not include the visual studio related mozconfigs of course
--- a/taskcluster/scripts/misc/build-clang-8-mingw.sh
+++ b/taskcluster/scripts/misc/build-clang-8-mingw.sh
@@ -31,20 +31,16 @@ CROSS_PREFIX_DIR=$INSTALL_DIR/$machine-w
 SRC_DIR=$TOOLCHAIN_DIR/src
 
 make_flags="-j$(nproc)"
 
 mingw_version=164990461720e0ed6ea5ea9f359d78595b1a459a
 libunwind_version=6ee92fcc97350ae32db3172a269e9afcc2bab686
 llvm_mingw_version=c3a16814bd26aa6702e1e5b482a3d9044bb0f725
 
-binutils_version=2.27
-binutils_ext=bz2
-binutils_sha=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
-
 # This is default value of _WIN32_WINNT. Gecko configure script explicitly sets this,
 # so this is not used to build Gecko itself. We default to 0x601, which is Windows 7.
 default_win32_winnt=0x601
 
 cd $HOME_DIR/src
 
 . taskcluster/scripts/misc/tooltool-download.sh
 patch_file="$(pwd)/taskcluster/scripts/misc/mingw-winrt.patch"
@@ -67,24 +63,16 @@ prepare() {
   git checkout $libunwind_version
   popd
 
   git clone https://github.com/mstorsjo/llvm-mingw.git
   pushd llvm-mingw
   git checkout $llvm_mingw_version
   popd
 
-  wget -c --progress=dot:mega ftp://ftp.gnu.org/gnu/binutils/binutils-$binutils_version.tar.$binutils_ext
-  if [ "$(sha256sum binutils-$binutils_version.tar.$binutils_ext)" != "$binutils_sha  binutils-$binutils_version.tar.$binutils_ext" ];
-  then
-    echo Corrupted binutils archive
-    exit 1
-  fi
-  tar -jxf binutils-$binutils_version.tar.$binutils_ext
-
   popd
 }
 
 install_wrappers() {
   pushd $INSTALL_DIR/bin
 
   compiler_flags="--sysroot \$DIR/../$machine-w64-mingw32 -rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld $WRAPPER_FLAGS -fuse-cxa-atexit -Qunused-arguments"
 
@@ -277,33 +265,23 @@ build_libcxx() {
   # to libc++.a in C++ mode, it won't pick libunwind.a, requiring caller
   # to explicitly pass -lunwind. Wo work around that, we merge libunwind.a
   # into libc++.a.
   merge_libs $CROSS_PREFIX_DIR/lib/libc++.a $CROSS_PREFIX_DIR/lib/libunwind.a
   popd
 }
 
 build_utils() {
-  mkdir binutils
-  pushd binutils
-  $SRC_DIR/binutils-$binutils_version/configure --prefix=$INSTALL_DIR \
-                                                --disable-multilib \
-                                                --disable-nls \
-                                                --target=$machine-w64-mingw32
-  make $make_flags
-
-  # Manually install only nm
-  cp binutils/nm-new $INSTALL_DIR/bin/$machine-w64-mingw32-nm
-
   pushd $INSTALL_DIR/bin/
+  ln -s llvm-nm $machine-w64-mingw32-nm
+  ln -s llvm-strip $machine-w64-mingw32-strip
   ln -s llvm-readobj $machine-w64-mingw32-readobj
+  ln -s llvm-objcopy $machine-w64-mingw32-objcopy
   ./clang $SRC_DIR/llvm-mingw/wrappers/windres-wrapper.c -O2 -Wl,-s -o $machine-w64-mingw32-windres
   popd
-
-  popd
 }
 
 export PATH=$INSTALL_DIR/bin:$PATH
 
 prepare
 
 # gets a bit too verbose here
 set +x