From 94e3079457946aabe0b9d7e3475b96ffe7e0fcc0 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 14 Feb 2018 20:10:12 +0000
Subject: binutils: update to 2.29.1

---
 ...t_pass_output_bfd_to_info-callbacks-minfo.patch | 29 ++++++++
 abs/core/binutils/PKGBUILD                         | 72 ++++++++++++--------
 abs/core/binutils/binutils-e9c1bdad.patch          | 78 ----------------------
 abs/core/binutils/binutils.install                 | 17 -----
 4 files changed, 72 insertions(+), 124 deletions(-)
 create mode 100644 abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch
 delete mode 100644 abs/core/binutils/binutils-e9c1bdad.patch
 delete mode 100644 abs/core/binutils/binutils.install

diff --git a/abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch b/abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch
new file mode 100644
index 0000000..ce719e7
--- /dev/null
+++ b/abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch
@@ -0,0 +1,29 @@
+From 7a7431ddc2332ddc3753330a8dd815bb5f7193c0 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Tue, 26 Sep 2017 14:41:22 -0700
+Subject: [PATCH] x86-64: Don't pass output_bfd to info->callbacks->minfo
+
+Don't pass output_bfd to info->callbacks->minfo when dumping local IFUNC
+functions in the map file.
+
+	PR ld/22199
+	* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't pass
+	output_bfd to info->callbacks->minfo.
+
+(cherry picked from commit ac69a0d75bf472a140e5405c8a90420d5f63a998)
+
+diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
+index d9225ad..1f6dfb8 100644
+--- a/bfd/elf64-x86-64.c
++++ b/bfd/elf64-x86-64.c
+@@ -6133,7 +6133,6 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
+ 	      if (SYMBOL_REFERENCES_LOCAL (info, h))
+ 		{
+ 		  info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
+-					  output_bfd,
+ 					  h->root.root.string,
+ 					  h->root.u.def.section->owner);
+ 
+-- 
+2.9.3
+
diff --git a/abs/core/binutils/PKGBUILD b/abs/core/binutils/PKGBUILD
index 7a41923..1efbd7b 100644
--- a/abs/core/binutils/PKGBUILD
+++ b/abs/core/binutils/PKGBUILD
@@ -4,47 +4,61 @@
 # toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
 
 pkgname=binutils
-pkgver=2.26
-pkgrel=3
-_commit=71090e7a
-pkgdesc="A set of programs to assemble and manipulate binary and object files"
-arch=('i686' 'x86_64')
-url="http://www.gnu.org/software/binutils/"
-license=('GPL')
+pkgver=2.29.1
+pkgrel=2
+pkgdesc='A set of programs to assemble and manipulate binary and object files'
+arch=(x86_64)
+url='http://www.gnu.org/software/binutils/'
+license=(GPL)
 groups=('base-devel')
-depends=('glibc>=2.23' 'zlib')
-makedepends=('git')
-checkdepends=('dejagnu' 'bc')
-conflicts=('binutils-multilib')
-replaces=('binutils-multilib')
-options=('staticlibs' '!distcc' '!ccache')
-install=binutils.install
-source=(git://sourceware.org/git/binutils-gdb.git#commit=${_commit})
-md5sums=('SKIP')
+depends=('glibc>=2.26' zlib)
+makedepends=(git)
+checkdepends=(dejagnu bc)
+conflicts=(binutils-multilib)
+replaces=(binutils-multilib)
+options=(staticlibs !distcc !ccache)
+#_commit=d1a6e7195b9bb0255fa77588985b969ad8aaacf5
+#source=(git+https://sourceware.org/git/binutils-gdb.git#commit=${_commit}
+source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
+        0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch)
+validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
+md5sums=('acc9cd826edb9954ac7cecb81c727793'
+         'SKIP'
+         'e4be936139ef46122cb3841881c432b2')
 
 prepare() {
-  cd binutils-gdb
+  mkdir -p binutils-build
+
+  #cd binutils-gdb
+  cd binutils-$pkgver
 
   # hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS"
   sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
 
-  mkdir ${srcdir}/binutils-build
+  # https://bugs.archlinux.org/task/55741
+  git apply ../0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch
 }
 
 build() {
   cd binutils-build
 
-  ../binutils-gdb/configure --prefix=/usr \
+  "$srcdir/binutils-$pkgver/configure" \
+    --prefix=/usr \
     --with-lib-path=/usr/lib:/usr/local/lib \
     --with-bugurl=https://bugs.archlinux.org/ \
-    --enable-threads --enable-shared --with-pic \
-    --enable-ld=default --enable-gold --enable-plugins \
+    --enable-threads \
+    --enable-shared \
+    --enable-ld=default \
+    --enable-gold \
+    --enable-plugins \
+    --enable-relro \
     --enable-deterministic-archives \
-    --disable-werror --disable-gdb
+    --with-pic \
+    --disable-werror \
+    --disable-gdb \
+    --with-system-zlib
 
-  # check the host environment and makes sure all the necessary tools are available
   make configure-host
-
   make tooldir=/usr
 }
 
@@ -58,13 +72,13 @@ check() {
 
 package() {
   cd binutils-build
-  make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install
+  make prefix="$pkgdir/usr" tooldir="$pkgdir/usr" install
 
   # Remove unwanted files
-  rm ${pkgdir}/usr/share/man/man1/{dlltool,nlmconv,windres,windmc}*
+  rm -f "$pkgdir"/usr/share/man/man1/{dlltool,nlmconv,windres,windmc}*
 
   # No shared linking to these files outside binutils
-  rm ${pkgdir}/usr/lib/lib{bfd,opcodes}.so
-  echo "INPUT ( /usr/lib/libbfd.a -liberty -lz -ldl )" > "$pkgdir"/usr/lib/libbfd.so
-  echo "INPUT ( /usr/lib/libopcodes.a -lbfd )" > "$pkgdir"/usr/lib/libopcodes.so
+  rm -f "$pkgdir"/usr/lib/lib{bfd,opcodes}.so
+  echo "INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )" > "$pkgdir/usr/lib/libbfd.so"
+  echo "INPUT( /usr/lib/libopcodes.a -lbfd )" > "$pkgdir/usr/lib/libopcodes.so"
 }
diff --git a/abs/core/binutils/binutils-e9c1bdad.patch b/abs/core/binutils/binutils-e9c1bdad.patch
deleted file mode 100644
index 6ef9f52..0000000
--- a/abs/core/binutils/binutils-e9c1bdad.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-diff --git a/gold/layout.cc b/gold/layout.cc
-index bcdaac8..7836640 100644
---- a/gold/layout.cc
-+++ b/gold/layout.cc
-@@ -4873,7 +4873,8 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
-     flags |= elfcpp::DF_STATIC_TLS;
-   if (parameters->options().origin())
-     flags |= elfcpp::DF_ORIGIN;
--  if (parameters->options().Bsymbolic())
-+  if (parameters->options().Bsymbolic()
-+      && !parameters->options().have_dynamic_list())
-     {
-       flags |= elfcpp::DF_SYMBOLIC;
-       // Add DT_SYMBOLIC for compatibility with older loaders.
-diff --git a/gold/options.cc b/gold/options.cc
-index 7eb8f27..7f1f69e 100644
---- a/gold/options.cc
-+++ b/gold/options.cc
-@@ -1200,13 +1200,6 @@ General_options::finalize()
-   // in the path, as appropriate.
-   this->add_sysroot();
- 
--  // --dynamic-list overrides -Bsymbolic and -Bsymbolic-functions.
--  if (this->have_dynamic_list())
--    {
--      this->set_Bsymbolic(false);
--      this->set_Bsymbolic_functions(false);
--    }
--
-   // Now that we've normalized the options, check for contradictory ones.
-   if (this->shared() && this->is_static())
-     gold_fatal(_("-shared and -static are incompatible"));
-diff --git a/gold/symtab.h b/gold/symtab.h
-index aa0cb68..9413360 100644
---- a/gold/symtab.h
-+++ b/gold/symtab.h
-@@ -604,10 +604,8 @@ class Symbol
-     if (parameters->options().in_dynamic_list(this->name()))
-       return true;
- 
--    // If the user used -Bsymbolic or provided a --dynamic-list script,
--    // then nothing (else) is preemptible.
--    if (parameters->options().Bsymbolic()
--        || parameters->options().have_dynamic_list())
-+    // If the user used -Bsymbolic, then nothing (else) is preemptible.
-+    if (parameters->options().Bsymbolic())
-       return false;
- 
-     // If the user used -Bsymbolic-functions, then functions are not
-diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
-index f767c21..7b73f9d 100644
---- a/gold/testsuite/Makefile.am
-+++ b/gold/testsuite/Makefile.am
-@@ -1518,7 +1518,7 @@ dynamic_list_lib1.o: dynamic_list_lib1.cc
- 	$(CXXCOMPILE) -c -fpic -o $@ $<
- 
- dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
--	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
-+	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
- dynamic_list_lib2.o: dynamic_list_lib2.cc
- 	$(CXXCOMPILE) -c -fpic -o $@ $<
- 
-diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
-index 217e472..b4ae3fd 100644
---- a/gold/testsuite/Makefile.in
-+++ b/gold/testsuite/Makefile.in
-@@ -5319,7 +5319,7 @@ uninstall-am:
- @GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXCOMPILE) -c -fpic -o $@ $<
- 
- @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
--@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
-+@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
- @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.o: dynamic_list_lib2.cc
- @GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXCOMPILE) -c -fpic -o $@ $<
- 
--- 
-1.9.4
-
diff --git a/abs/core/binutils/binutils.install b/abs/core/binutils/binutils.install
deleted file mode 100644
index 9de0533..0000000
--- a/abs/core/binutils/binutils.install
+++ /dev/null
@@ -1,17 +0,0 @@
-infodir=usr/share/info
-filelist=(as.info bfd.info binutils.info gprof.info ld.info)
-
-post_upgrade() {
-  [ -x usr/bin/install-info ] || return 0
-  for file in ${filelist[@]}; do
-    install-info $infodir/$file.gz $infodir/dir 2> /dev/null
-  done
-}
-
-pre_remove() {
-  [ -x usr/bin/install-info ] || return 0
-  for file in ${filelist[@]}; do
-    install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
-  done
-}
-
-- 
cgit v0.12

