patches/binutils/2.20.1/130-ld-sysroot.patch
author "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Thu Jul 28 22:09:31 2011 +0200 (2011-07-28)
changeset 2573 424fa2092ace
parent 1621 60446d2e5660
permissions -rw-r--r--
scripts/libc: do not build add-ons by default

Currently, no --enable-add-ons option is passed to libc configure when
"$(do_libc_add_ons_list ,)" is empty, which makes configure automatically search
for present add-ons. In that case, all present add-ons are built, although
no add-on was selected by the user in the config. Moreover, this can make the
configure fail if some non-standard add-ons like eglibc-localedef are present.

This behavior also leads to an inconsistency from a user point of view between
the following cases:
- LIBC_ADDONS_LIST="", LIBC_GLIBC_USE_PORTS=n and THREADS="none" in the config,
which makes "$(do_libc_add_ons_list ,)" return "", so all present add-ons
are built.
- LIBC_ADDONS_LIST="", LIBC_GLIBC_USE_PORTS=n and THREADS!="none" in the
config, which makes "$(do_libc_add_ons_list ,)" return the add-on supporting
the chosen threading implementation, e.g. "nptl", so only this add-on is
built.

This patch disables the building of all add-ons in that case.

It is still possible to build all present add-ons by adding --enable-add-ons to
LIBC_GLIBC_EXTRA_CONFIG_ARRAY.

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
yann@1614
     1
Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
yann@1614
     2
yann@1614
     3
Always try to prepend the sysroot prefix to absolute filenames first.
yann@1614
     4
yann@1614
     5
http://bugs.gentoo.org/275666
yann@1614
     6
http://sourceware.org/bugzilla/show_bug.cgi?id=10340
yann@1614
     7
yann@2088
     8
diff -durN binutils-2.20.1.orig/ld/ldfile.c binutils-2.20.1/ld/ldfile.c
yann@2088
     9
--- binutils-2.20.1.orig/ld/ldfile.c	2009-08-30 00:11:01.000000000 +0200
yann@2088
    10
+++ binutils-2.20.1/ld/ldfile.c	2010-08-17 19:32:08.000000000 +0200
yann@1614
    11
@@ -308,18 +308,24 @@
yann@1614
    12
      directory first.  */
yann@1614
    13
   if (! entry->is_archive)
yann@1614
    14
     {
yann@1614
    15
-      if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
yann@1614
    16
+      /* For absolute pathnames, try to always open the file in the
yann@1614
    17
+	 sysroot first. If this fails, try to open the file at the
yann@1614
    18
+	 given location. */
yann@1614
    19
+      entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
yann@1614
    20
+      if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
yann@1614
    21
 	{
yann@1614
    22
 	  char *name = concat (ld_sysroot, entry->filename,
yann@1614
    23
 			       (const char *) NULL);
yann@1614
    24
 	  if (ldfile_try_open_bfd (name, entry))
yann@1614
    25
 	    {
yann@1614
    26
 	      entry->filename = name;
yann@1614
    27
+	      entry->sysrooted = TRUE;
yann@1614
    28
 	      return TRUE;
yann@1614
    29
 	    }
yann@1614
    30
 	  free (name);
yann@1614
    31
 	}
yann@1614
    32
-      else if (ldfile_try_open_bfd (entry->filename, entry))
yann@1614
    33
+
yann@1614
    34
+      if (ldfile_try_open_bfd (entry->filename, entry))
yann@1614
    35
 	{
yann@1614
    36
 	  entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
yann@1614
    37
 	    && is_sysrooted_pathname (entry->filename, TRUE);