summary refs log tree commit diff
path: root/pkgs/development/tools/misc/binutils/fix-bsymbolic.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/misc/binutils/fix-bsymbolic.patch')
-rw-r--r--pkgs/development/tools/misc/binutils/fix-bsymbolic.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/binutils/fix-bsymbolic.patch b/pkgs/development/tools/misc/binutils/fix-bsymbolic.patch
new file mode 100644
index 00000000000..afaafc997ef
--- /dev/null
+++ b/pkgs/development/tools/misc/binutils/fix-bsymbolic.patch
@@ -0,0 +1,47 @@
+http://lists.gnu.org/archive/html/bug-binutils/2016-01/msg00193.html
+https://sourceware.org/bugzilla/show_bug.cgi?id=19615
+
+From 1dab972d797c060e17229c2e10da01852ba82629 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Thu, 11 Feb 2016 15:31:15 -0800
+Subject: [PATCH] Enable -Bsymbolic and -Bsymbolic-functions to PIE
+
+Before binutils 2.26, -Bsymbolic and -Bsymbolic-functions were also
+applied to PIE so that "ld -pie -Bsymbolic -E" can be used to export
+symbols in PIE with local binding.  This patch re-enables -Bsymbolic
+and -Bsymbolic-functions for PIE.
+
+diff --git a/ld/lexsup.c b/ld/lexsup.c
+index 4cad209..e2fb212 100644
+--- a/ld/lexsup.c
++++ b/ld/lexsup.c
+@@ -1586,15 +1586,14 @@ parse_args (unsigned argc, char **argv)
+   /* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
+      --dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
+      --dynamic-list FILE.  -Bsymbolic and -Bsymbolic-functions are
+-     for shared libraries.  -Bsymbolic overrides all others and vice
+-     versa.  */
++     for PIC outputs.  -Bsymbolic overrides all others and vice versa.  */
+   switch (command_line.symbolic)
+     {
+     case symbolic_unset:
+       break;
+     case symbolic:
+-      /* -Bsymbolic is for shared library only.  */
+-      if (bfd_link_dll (&link_info))
++      /* -Bsymbolic is for PIC output only.  */
++      if (bfd_link_pic (&link_info))
+ 	{
+ 	  link_info.symbolic = TRUE;
+ 	  /* Should we free the unused memory?  */
+@@ -1603,8 +1602,8 @@ parse_args (unsigned argc, char **argv)
+ 	}
+       break;
+     case symbolic_functions:
+-      /* -Bsymbolic-functions is for shared library only.  */
+-      if (bfd_link_dll (&link_info))
++      /* -Bsymbolic-functions is for PIC output only.  */
++      if (bfd_link_pic (&link_info))
+ 	command_line.dynamic_list = dynamic_list_data;
+       break;
+     }