public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo commit in src/patchsets/binutils/2.28: 00_all_0001-ld-always-warn-about-textrels-in-files.patch 00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch 00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch 00_all_0004-gold-ld-enable-gnu-hash-by-default.patch 00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch 00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch README.history
@ 2017-03-03 18:31 Mike Frysinger (vapier)
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger (vapier) @ 2017-03-03 18:31 UTC (permalink / raw
  To: gentoo-commits

vapier      17/03/03 18:31:08

  Added:               
                        00_all_0001-ld-always-warn-about-textrels-in-files.patch
                        00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch
                        00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch
                        00_all_0004-gold-ld-enable-gnu-hash-by-default.patch
                        00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch
                        00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch
                        README.history
  Log:
  initial 2.28 patchset based on last 2.27 patchset

Revision  Changes    Path
1.1                  src/patchsets/binutils/2.28/00_all_0001-ld-always-warn-about-textrels-in-files.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0001-ld-always-warn-about-textrels-in-files.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0001-ld-always-warn-about-textrels-in-files.patch?rev=1.1&content-type=text/plain

Index: 00_all_0001-ld-always-warn-about-textrels-in-files.patch
===================================================================
From bb101959912073f460669d75097215cde7b20019 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 16 May 2005 22:10:19 -0400
Subject: [PATCH] ld: always warn about textrels in files

textrels are bad for forcing copy-on-write (this affects everyone), and for
security/runtime code generation, this affects security ppl.  But in either
case, it doesn't matter who needs textrels, it's the very fact that they're
needed at all.
---
 ld/ldmain.c                 | 1 +
 ld/testsuite/lib/ld-lib.exp | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/ld/ldmain.c b/ld/ldmain.c
index 1e48b1a2dbbc..f634eaa908a5 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -294,6 +294,7 @@ main (int argc, char **argv)
   link_info.dynamic_undefined_weak = -1;
   link_info.pei386_auto_import = -1;
   link_info.spare_dynamic_tags = 5;
+  link_info.warn_shared_textrel = TRUE;
   link_info.path_separator = ':';
 #ifdef DEFAULT_FLAG_COMPRESS_DEBUG
   link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index cf7886b4866f..6c6a0b7a001e 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -250,6 +250,10 @@ proc default_ld_simple_link { ld target objects } {
     # symbol, since the default linker script might use ENTRY.
     regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
 
+    # Gentoo tweak:
+    # We want to ignore TEXTREL warnings since we force enable them by default
+    regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
+
     return [string match "" $exec_output]
 }
 
-- 
2.11.1




1.1                  src/patchsets/binutils/2.28/00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch?rev=1.1&content-type=text/plain

Index: 00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch
===================================================================
From 9c3fda8166172bb9fa818bf2b7fec003847393d8 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 25 May 2015 04:42:58 -0400
Subject: [PATCH] gold/ld: add support for poisoned system directories

This is based on the old CodeSourcery patch written by Joseph Myers to add
support to the link for detecting & rejecting bad -L paths when using a
cross-compiler.  The differences here:
* The command line flags are always available.
* We can turn on & off the warning via the command line.
* The configure option controls the default warning behavior.
* Add support for gold.

It is not currently upstream, nor has it been submitted at all.  There are
no plans to do so currently either.

BUG=chromium:488360
TEST=`cbuildbot chromiumos-sdk` passes  # tests arm/amd64/mipsel/x86
TEST=`cbuildbot panther_moblab-full whirlwind-release` pass
TEST=`cbuildbot {x32,arm64}-generic-full` has no new failures
TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd)

Reviewed-on: https://chromium-review.googlesource.com/272083
---
 gold/options.cc | 33 +++++++++++++++++++++++++++++++++
 gold/options.h  |  7 +++++++
 ld/config.in    |  3 +++
 ld/configure    | 14 ++++++++++++++
 ld/configure.ac | 10 ++++++++++
 ld/ld.h         |  7 +++++++
 ld/ld.texinfo   | 18 ++++++++++++++++++
 ld/ldfile.c     | 20 ++++++++++++++++++++
 ld/ldlex.h      |  3 +++
 ld/ldmain.c     |  7 +++++++
 ld/lexsup.c     | 24 ++++++++++++++++++++++++
 11 files changed, 146 insertions(+)

diff --git a/gold/options.cc b/gold/options.cc
index ed63b6f04feb..5de289b5dd2e 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -1285,6 +1285,39 @@ General_options::finalize()
   // in the path, as appropriate.
   this->add_sysroot();
 
+  // Now check if library_path is poisoned.
+  if (this->warn_poison_system_directories())
+    {
+      std::vector<std::string> bad_paths;
+
+      bad_paths.push_back("/lib");
+      // TODO: This check is disabled for now due to a bunch of packages that
+      // use libtool and relink with -L/usr/lib paths (albeit after the right
+      // sysroot path).  Once those are fixed we can enable.
+      // We also need to adjust it so it only rejects one or two levels deep.
+      // Gcc's internal paths also live below /usr/lib.
+      // http://crbug.com/488360
+      // bad_paths.push_back("/usr/lib");
+      bad_paths.push_back("/usr/local/lib");
+      bad_paths.push_back("/usr/X11R6/lib");
+
+      for (std::vector<std::string>::const_iterator b = bad_paths.begin();
+	   b != bad_paths.end();
+	   ++b)
+	for (Dir_list::iterator p = this->library_path_.value.begin();
+	     p != this->library_path_.value.end();
+	     ++p)
+	  if (!p->name().compare(0, b->size(), *b))
+	    {
+	      if (this->error_poison_system_directories())
+		gold_fatal(_("library search path \"%s\" is unsafe for "
+			     "cross-compilation"), p->name().c_str());
+	      else
+		gold_warning(_("library search path \"%s\" is unsafe for "
+			       "cross-compilation"), p->name().c_str());
+	    }
+    }
+
   // 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/options.h b/gold/options.h
index a8b1d46aa109..b7c725a82539 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -1344,6 +1344,13 @@ class General_options
   DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false,
 	      N_("Ignored"), NULL);
 
+  DEFINE_bool(warn_poison_system_directories, options::TWO_DASHES, '\0', false,
+	      N_("Warn for -L options using system directories"),
+	      N_("Do not warn for -L options using system directories"));
+  DEFINE_bool(error_poison_system_directories, options::TWO_DASHES, '\0', false,
+	      N_("Give an error for -L options using system directories"),
+	      NULL);
+
   DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true,
 	      N_("Warn when skipping an incompatible library"),
 	      N_("Don't warn when skipping an incompatible library"));
diff --git a/ld/config.in b/ld/config.in
index 2c6d698b6ce1..d3cb7e882de9 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -17,6 +17,9 @@
    language is requested. */
 #undef ENABLE_NLS
 
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
 /* Additional extension a shared object might have. */
 #undef EXTRA_SHLIB_EXTENSION
 
diff --git a/ld/configure b/ld/configure
index 36af9695b1c8..bd1d677e0920 100755
--- a/ld/configure
+++ b/ld/configure
@@ -789,6 +789,7 @@ with_lib_path
 enable_targets
 enable_64_bit_bfd
 with_sysroot
+enable_poison_system_directories
 enable_gold
 enable_got
 enable_compressed_debug_sections
@@ -1446,6 +1447,8 @@ Optional Features:
   --disable-largefile     omit support for large files
   --enable-targets        alternative target configurations
   --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
+  --enable-poison-system-directories
+                          warn for use of native system library directories
   --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
   --enable-got=<type>     GOT handling scheme (target, single, negative,
                           multigot)
@@ -15499,7 +15502,18 @@ else
 fi
 
 
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+  enableval=$enable_poison_system_directories;
+else
+  enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
 
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
 
 # Check whether --enable-got was given.
 if test "${enable_got+set}" = set; then :
diff --git a/ld/configure.ac b/ld/configure.ac
index 36a9f5083aea..47f1d33fa58c 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot)
 AC_SUBST(TARGET_SYSTEM_ROOT)
 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
 
+AC_ARG_ENABLE([poison-system-directories],
+         AS_HELP_STRING([--enable-poison-system-directories],
+                [warn for use of native system library directories]),,
+         [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+  AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+       [1],
+       [Define to warn for use of native system library directories])
+fi
+
 dnl Use --enable-gold to decide if this linker should be the default.
 dnl "install_as_default" is set to false if gold is the default linker.
 dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index 104bb8e2376b..e1c3f744862d 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -172,6 +172,13 @@ typedef struct
   /* If set, display the target memory usage (per memory region).  */
   bfd_boolean print_memory_usage;
 
+  /* If TRUE warn for uses of system directories when cross linking.  */
+  bfd_boolean warn_poison_system_directories;
+
+  /* If TRUE (default FALSE) give an error for uses of system
+     directories when cross linking instead of a warning.  */
+  bfd_boolean error_poison_system_directories;
+
   /* Big or little endian as set on command line.  */
   enum endian_enum endian;
 
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index d393acdd9406..8eb156efb8dd 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -2403,6 +2403,24 @@ string identifying the original linked file does not change.
 
 Passing @code{none} for @var{style} disables the setting from any
 @code{--build-id} options earlier on the command line.
+
+@kindex --warn-poison-system-directories
+@item --warn-poison-system-directories
+Warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking.  This option is intended for use
+in environments that want to detect and reject incorrect link settings.
+
+@kindex --no-warn-poison-system-directories
+@item --no-warn-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking.  This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
 @end table
 
 @c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 0943bb2dfa0f..b3bc22469900 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -114,6 +114,26 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
     new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL);
   else
     new_dirs->name = xstrdup (name);
+
+  if (command_line.warn_poison_system_directories
+      && (!strncmp (name, "/lib", 4)
+      /* TODO: This check is disabled for now due to a bunch of packages that
+       * use libtool and relink with -L/usr/lib paths (albeit after the right
+       * sysroot path).  Once those are fixed we can enable.
+       * We also need to adjust it so it only rejects one or two levels deep.
+       * Gcc's internal paths also live below /usr/lib.
+       * http://crbug.com/488360  */
+	  /* || !strncmp (name, "/usr/lib", 8) */
+	  || !strncmp (name, "/usr/local/lib", 14)
+	  || !strncmp (name, "/usr/X11R6/lib", 14)))
+    {
+      if (command_line.error_poison_system_directories)
+	einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+	         "cross-compilation\n"), name);
+      else
+	einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+	         "cross-compilation\n"), name);
+    }
 }
 
 /* Try to open a BFD for a lang_input_statement.  */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 3ecac2bc865e..7ed67bae3f23 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -141,6 +141,9 @@ enum option_values
   OPTION_PRINT_OUTPUT_FORMAT,
   OPTION_PRINT_SYSROOT,
   OPTION_IGNORE_UNRESOLVED_SYMBOL,
+  OPTION_WARN_POISON_SYSTEM_DIRECTORIES,
+  OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES,
+  OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
   OPTION_PUSH_STATE,
   OPTION_POP_STATE,
   OPTION_PRINT_MEMORY_USAGE,
diff --git a/ld/ldmain.c b/ld/ldmain.c
index f634eaa908a5..bba193355b0d 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -270,6 +270,13 @@ main (int argc, char **argv)
   command_line.warn_mismatch = TRUE;
   command_line.warn_search_mismatch = TRUE;
   command_line.check_section_addresses = -1;
+  command_line.warn_poison_system_directories =
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+    TRUE;
+#else
+    FALSE;
+#endif
+  command_line.error_poison_system_directories = FALSE;
 
   /* We initialize DEMANGLING based on the environment variable
      COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 0b7d4976ac90..327b203eeb25 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -524,6 +524,18 @@ static const struct ld_option ld_options[] =
     OPTION_IGNORE_UNRESOLVED_SYMBOL},
     '\0', N_("SYMBOL"),
     N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
+  { {"warn-poison-system-directories", no_argument, NULL,
+     OPTION_WARN_POISON_SYSTEM_DIRECTORIES},
+    '\0', NULL, N_("Warn for -L options using system directories"),
+    TWO_DASHES },
+  { {"no-warn-poison-system-directories", no_argument, NULL,
+     OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES},
+    '\0', NULL, N_("Do not warn for -L options using system directories"),
+    TWO_DASHES },
+  { {"error-poison-system-directories", no_argument, NULL,
+     OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+    '\0', NULL, N_("Give an error for -L options using system directories"),
+    TWO_DASHES },
   { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
     '\0', NULL, N_("Push state of flags governing input file handling"),
     TWO_DASHES },
@@ -1528,6 +1540,18 @@ parse_args (unsigned argc, char **argv)
           }
           break;
 
+   case OPTION_WARN_POISON_SYSTEM_DIRECTORIES:
+     command_line.warn_poison_system_directories = TRUE;
+     break;
+
+   case OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES:
+     command_line.warn_poison_system_directories = FALSE;
+     break;
+
+   case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+     command_line.error_poison_system_directories = TRUE;
+     break;
+
 	case OPTION_PUSH_STATE:
 	  input_flags.pushed = xmemdup (&input_flags,
 					sizeof (input_flags),
-- 
2.11.1




1.1                  src/patchsets/binutils/2.28/00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch?rev=1.1&content-type=text/plain

Index: 00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch
===================================================================
From da0140fb5c8a9bccd0c66166c8e21cb3e37e2f1d Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 7 Jan 2005 00:15:53 -0500
Subject: [PATCH] ld: enable new dtags by default for linux/gnu targets

The "new" dtags options have been around for 14+ years now, so for Linux
and GNU targets, enable them by default.

2012-01-21  Mike Frysinger  <vapier@gentoo.org>

	* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
	link_info.new_dtags to TRUE for linux/gnu targets.
	* NEWS: Mention new dtags default.

2013-01-22  Roland McGrath  <mcgrathr@google.com>

	* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
	new_dtags to TRUE for *-*-nacl* targets.
---
 ld/emultempl/elf32.em | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 84adaef6dfe1..92b7e4aabd0b 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -103,6 +103,16 @@ gld${EMULATION_NAME}_before_parse (void)
   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
+EOF
+
+case ${target} in
+  *-*-linux-* | *-*-k*bsd*-* | *-*-gnu* | *-*-nacl*)
+    fragment <<EOF
+  link_info.new_dtags = TRUE;
+EOF
+    ;;
+esac
+fragment <<EOF
   `if test -n "$CALL_NOP_BYTE" ; then echo link_info.call_nop_byte = $CALL_NOP_BYTE; fi`;
   link_info.check_relocs_after_open_input = `if test "x${CHECK_RELOCS_AFTER_OPEN_INPUT}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
   link_info.relro = DEFAULT_LD_Z_RELRO;
-- 
2.11.1




1.1                  src/patchsets/binutils/2.28/00_all_0004-gold-ld-enable-gnu-hash-by-default.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0004-gold-ld-enable-gnu-hash-by-default.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0004-gold-ld-enable-gnu-hash-by-default.patch?rev=1.1&content-type=text/plain

Index: 00_all_0004-gold-ld-enable-gnu-hash-by-default.patch
===================================================================
From a6c35c40daf508b4f236b870c2b60bfa9b68de9e Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 27 Jan 2007 15:01:08 -0500
Subject: [PATCH] gold/ld: enable gnu hash by default

Glibc first added .gnu.hash support to glibc-2.5 (released 29 Sep 2006),
and gold was first released after that.  Let's default the gnu hash style
to the new "gnu" rather than the classic sysv.

gold/:
2012-02-03  Mike Frysinger  <vapier@gentoo.org>

	* options.h (General_options): Change default to gnu for hash_style.
---
 gold/options.h              |  2 +-
 ld/emultempl/elf32.em       | 13 +++++++++++++
 ld/testsuite/lib/ld-lib.exp |  4 ++--
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/gold/options.h b/gold/options.h
index b7c725a82539..ef1756671242 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -921,7 +921,7 @@ class General_options
 		N_("Min fraction of empty buckets in dynamic hash"),
 		N_("FRACTION"));
 
-  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "sysv",
+  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "gnu",
 	      N_("Dynamic hash style"), N_("[sysv,gnu,both]"),
 	      {"sysv", "gnu", "both"});
 
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 92b7e4aabd0b..ac2090a54eb1 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -100,6 +100,19 @@ static void
 gld${EMULATION_NAME}_before_parse (void)
 {
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
+EOF
+# Enable gnu hash by default for Linux (non-mips) targets.
+# This has been supported since glibc-2.5.
+case ${target} in
+  mips*) ;;
+  *-*-linux-* | *-*-gnu*)
+    fragment <<EOF
+  link_info.emit_hash = FALSE;
+  link_info.emit_gnu_hash = TRUE;
+EOF
+    ;;
+esac
+fragment <<EOF
   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 6c6a0b7a001e..53ad4a15e983 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -147,7 +147,7 @@ proc default_ld_relocate { ld target objects } {
     global HOSTING_EMU
 
     remote_file host delete $target
-    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -o $target -r $objects"]
 }
 
 # Check to see if ld is being invoked with a non-endian output format
@@ -228,7 +228,7 @@ proc default_ld_link { ld target objects } {
 
     remote_file host delete $target
 
-    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"]
+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv $flags -o $target $objs $libs"]
 }
 
 # Link a program using ld, without including any libraries.
-- 
2.11.1




1.1                  src/patchsets/binutils/2.28/00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch?rev=1.1&content-type=text/plain

Index: 00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch
===================================================================
From bb4bd6b89365800a7b403ce505401d0c02ad02f8 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 7 Jan 2005 00:15:53 -0500
Subject: [PATCH] libiberty: install PIC version of libiberty.a

This will install a PIC version of libiberty.a by overwriting the non-PIC
version of libiberty.a while compiling.  We do this because there is no
shared version of libiberty for random apps to link against which means if
someone wants to use this in a shared library or PIE, they're out of luck.
It's arguable whether people should be able to use this in a shared lib,
but usage in PIE should be fine.  You could argue that this penalizes the
non-PIE users, but the counter point is that people using this library in
general are fairly low, and we'd rather have things work for all of them.
---
 libiberty/Makefile.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 0ff9e45e45ef..55a70330ffb8 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -256,6 +256,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
 	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
 	    $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
 	  $(RANLIB) $(TARGETLIB); \
+	  cp $(TARGETLIB) ../ ; \
 	  cd ..; \
 	else true; fi; \
 	if [ x"$(NOASANFLAG)" != x ]; then \
-- 
2.11.1




1.1                  src/patchsets/binutils/2.28/00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch?rev=1.1&content-type=text/plain

Index: 00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch
===================================================================
From 561d984aa3a3b99bbd9c6ddf6ba08dadd107d62c Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 5 Jul 2016 20:24:00 +0545
Subject: [PATCH] opcodes: link against libbfd.la for rpath deps

The reason opcodes doesn't link against libbfd.la is to workaround a
libtool bug where it uses installed -L paths ahead of DESTDIR paths.
The downside is that the library itself lacks rpath tags to find the
right version of libbfd.so.

Since Gentoo has patched the libtool bug for a while, we don't need
the workaround.  Use the .la file so we get the rpath tags.

URL: https://bugs.gentoo.org/563934
---
 opcodes/configure    | 2 +-
 opcodes/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opcodes/configure b/opcodes/configure
index be87eb22a5f0..19528bef6906 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -12561,7 +12561,7 @@ if test "$enable_shared" = "yes"; then
           SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
 	  ;;
 	*)
-          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
+          SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
 	  ;;
       esac
       SHARED_DEPENDENCIES="../bfd/libbfd.la"
diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index b9f5eb8a4fdf..b5ff57a341ea 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -185,7 +185,7 @@ changequote([,])dnl
           SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
 	  ;;
 	*)
-          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
+          SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
 	  ;;
       esac
       SHARED_DEPENDENCIES="../bfd/libbfd.la"
-- 
2.11.1




1.1                  src/patchsets/binutils/2.28/README.history

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/README.history?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.28/README.history?rev=1.1&content-type=text/plain

Index: README.history
===================================================================
1.0		03 Mar 2017
	+ 00_all_0001-ld-always-warn-about-textrels-in-files.patch
	+ 00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch
	+ 00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch
	+ 00_all_0004-gold-ld-enable-gnu-hash-by-default.patch
	+ 00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch
	+ 00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-03 18:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-03 18:31 [gentoo-commits] gentoo commit in src/patchsets/binutils/2.28: 00_all_0001-ld-always-warn-about-textrels-in-files.patch 00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch 00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch 00_all_0004-gold-ld-enable-gnu-hash-by-default.patch 00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch 00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch README.history Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox