summaryrefslogtreecommitdiffstats
path: root/build/unix/build-binutils
diff options
context:
space:
mode:
Diffstat (limited to 'build/unix/build-binutils')
-rw-r--r--build/unix/build-binutils/3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F.key51
-rwxr-xr-xbuild/unix/build-binutils/build-binutils.sh106
2 files changed, 157 insertions, 0 deletions
diff --git a/build/unix/build-binutils/3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F.key b/build/unix/build-binutils/3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F.key
new file mode 100644
index 0000000000..a76485a9fc
--- /dev/null
+++ b/build/unix/build-binutils/3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F.key
@@ -0,0 +1,51 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQINBFm/2cUBEADkvRqMWfAryJ52T4J/640Av5cam9ojdFih9MjcX7QWFxIzJfTF
+Yq2z+nb4omdfZosdCJL2zGcn6C0AxpHNvxR9HMDkEyFHKrjDh4xWU+pH4z9azQEq
+Jh331X7UzbZldqQo16VkuVavgsTJaHcXm+nGIBTcUbl2oiTtHhmuaYxx6JTMcFjC
+7vyO5mLBw78wt52HBYweJ0NjHBvvH/JxbAAULSPRUC61K0exlO49VFbFETQNG1hZ
+TKEji95fPbre7PpXQ0ewQShUgttEE/J3UA4jYaF9lOcZgUzbA27xTV//KomP0D30
+yr4e4EJEJYYNKa3hofTEHDXeeNgM25tprhBUMdbVRZpf2Keuk2uDVwc+EiOVri48
+rb1NU+60sOXvoGO6Ks81+mhAGmrBrlgLhAp8K1HPHI4MG4gHnrMqX2rEGUGRPFjC
+3qqVVlPm8H05PnosNqDLQ1Pf7C0pVgsCx6hKQB7Y1qBui7aoj9zeFaQgpYef+CEE
+RIKEcWwrjaOJwK3pi9HFdxS0NNWYZj8HPzz/AsgTTQdsbulPlVq2SsctmOnL42CZ
+OCTppGYwl53CG/EqVY+UQBzFzJBaY8TJRFFYVEy5/HH4H11rMoZwqIkk71EOGU3X
+6m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85cOBCR4s8tZsvG
+YOjR3CvqKrX4bb8GElrhOvAJa6DdmZXc7AyoVMaTvhpq3gJYKmC64oqt7zwIHwaC
+xTbP6C6oUp9ENRV7nHnXN3BlvIgCo4QEs6HkDzkmgYlCEOKBiDyVMSkPDZdsspa+
+K4GlU2Swi/BDJMjtDxyo+K0M81LXXxOeRfEIfPtZ3ddxBKPva1uSsuz+pbN9d1JY
+8Ko5T/h16susi2ReUyNJEJaSnjO5z13TQ1U=
+=93P0
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/build/unix/build-binutils/build-binutils.sh b/build/unix/build-binutils/build-binutils.sh
new file mode 100755
index 0000000000..338a9dd29a
--- /dev/null
+++ b/build/unix/build-binutils/build-binutils.sh
@@ -0,0 +1,106 @@
+#!/bin/bash
+
+set -x
+
+make_flags="-j$(nproc) MAKEINFO=true"
+
+root_dir="$1"
+
+cd $root_dir/binutils-source
+
+patch -p1 <<'EOF'
+From 4476cc67e657d6b26cd453c555a611f1ab956660 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Thu, 30 Aug 2018 09:21:57 -0700
+Subject: [PATCH] ld: Lookup section in output with the same name
+
+When there are more than one input sections with the same section name,
+SECNAME, linker picks the first one to define __start_SECNAME and
+__stop_SECNAME symbols. When the first input section is removed by
+comdat group, we need to check if there is still an output section
+with section name SECNAME.
+
+ PR ld/23591
+ * ldlang.c (undef_start_stop): Lookup section in output with
+ the same name.
+---
+ ld/ldlang.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/ld/ldlang.c b/ld/ldlang.c
+index 8878ccd..d644b56 100644
+--- a/ld/ldlang.c
++++ b/ld/ldlang.c
+@@ -6097,6 +6097,24 @@ undef_start_stop (struct bfd_link_hash_entry *h)
+ || strcmp (h->u.def.section->name,
+ h->u.def.section->output_section->name) != 0)
+ {
++ asection *sec = bfd_get_section_by_name (link_info.output_bfd,
++ h->u.def.section->name);
++ if (sec != NULL)
++ {
++ /* When there are more than one input sections with the same
++ section name, SECNAME, linker picks the first one to define
++ __start_SECNAME and __stop_SECNAME symbols. When the first
++ input section is removed by comdat group, we need to check
++ if there is still an output section with section name
++ SECNAME. */
++ asection *i;
++ for (i = sec->map_head.s; i != NULL; i = i->map_head.s)
++ if (strcmp (h->u.def.section->name, i->name) == 0)
++ {
++ h->u.def.section = i;
++ return;
++ }
++ }
+ h->type = bfd_link_hash_undefined;
+ h->u.undef.abfd = NULL;
+ }
+--
+2.17.1
+EOF
+
+cd ..
+
+TARGETS="aarch64-linux-gnu arm-linux-gnueabi i686-w64-mingw32"
+
+gcc_major=8
+if [ -d $MOZ_FETCHES_DIR/sysroot ]; then
+ # Don't silently use a non-existing directory for C++ headers.
+ [ -d $MOZ_FETCHES_DIR/sysroot/usr/include/c++/$gcc_major ] || exit 1
+ export CFLAGS="-g -O2 --sysroot=$MOZ_FETCHES_DIR/sysroot"
+ export CXXFLAGS="$CFLAGS -isystem $MOZ_FETCHES_DIR/sysroot/usr/include/c++/$gcc_major -isystem $MOZ_FETCHES_DIR/sysroot/usr/include/x86_64-linux-gnu/c++/$gcc_major"
+ export LDFLAGS="-L$MOZ_FETCHES_DIR/sysroot/lib/x86_64-linux-gnu -L$MOZ_FETCHES_DIR/sysroot/usr/lib/x86_64-linux-gnu -L$MOZ_FETCHES_DIR/sysroot/usr/lib/gcc/x86_64-linux-gnu/8"
+fi
+
+
+# Build target-specific GNU as ; build them first so that the few documentation
+# files they install are overwritten by the full binutils build.
+
+for target in $TARGETS; do
+
+ mkdir binutils-$target
+ cd binutils-$target
+
+ ../binutils-source/configure --prefix /tools/binutils/ --disable-gold --disable-ld --disable-binutils --disable-gprof --disable-nls --target=$target $EXTRA_CONFIGURE_FLAGS || exit 1
+ make $make_flags || exit 1
+ make install $make_flags DESTDIR=$root_dir || exit 1
+
+ cd ..
+done
+
+# Build binutils
+mkdir binutils-objdir
+cd binutils-objdir
+
+# --enable-targets builds extra target support in ld.
+# Enabling aarch64 support brings in arm support, so we don't need to specify that too.
+../binutils-source/configure --prefix /tools/binutils/ --enable-gold --enable-plugins --disable-nls --enable-targets="$TARGETS" $EXTRA_CONFIGURE_FLAGS || exit 1
+make $make_flags || exit 1
+make install $make_flags DESTDIR=$root_dir || exit 1
+
+cd ..
+
+# Make a package of the built binutils
+cd $root_dir/tools
+tar caf $root_dir/binutils.tar.zst binutils/