patches/binutils/2.20/180-only-use-new-ld-dtags.patch.disabled
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Sep 12 23:51:25 2010 +0200 (2010-09-12)
changeset 2123 ff2181adbd28
permissions -rw-r--r--
cc/gcc: disable complibs if not selected

Force gcc to not link with some companion libraries when
there are not needed (because selected-out).

There is no option to tell gcc *not* to build the Graphite and/or
LTO stuff. They *will* be built if gcc finds the suitable companion
libraries. If we do not provide them, but the host has them, then
gcc *will* find them, and link with them.

Consider the following:
- host has suitable PPL and CLooG (eg. Debian Squeeze)
- user wants to build gcc>=4.4
- user de-selects GRAPHITE
- gcc will find the hosts PPL and CLooG, and will use them
- the user moves the toolchain to an older host that does
not have them (eg. Debian Lenny)
- the toolchain fails, when it was properly setup not to

So, explicitly tell gcc *not* to use unneeded companion libs.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@1614
     1
Don't generate RPATH if we're going to be generating RUNPATH.
yann@1614
     2
yann@1614
     3
need to ponder what ramifications this has before enabling it
yann@1614
     4
yann@1614
     5
--- binutils/bfd/elflink.c
yann@1614
     6
+++ binutils/bfd/elflink.c
yann@1614
     7
@@ -5382,11 +5382,15 @@
yann@1614
     8
 
yann@1614
     9
 	  indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
yann@1614
    10
 				      TRUE);
yann@1614
    11
-	  if (indx == (bfd_size_type) -1
yann@1614
    12
-	      || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
yann@1614
    13
+	  if (indx == (bfd_size_type) -1)
yann@1614
    14
 	    return FALSE;
yann@1614
    15
 
yann@1614
    16
-	  if  (info->new_dtags)
yann@1614
    17
+	  if (!info->new_dtags)
yann@1614
    18
+	    {
yann@1614
    19
+	      if (!_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
yann@1614
    20
+		return FALSE;
yann@1614
    21
+	    }
yann@1614
    22
+	  else
yann@1614
    23
 	    {
yann@1614
    24
 	      _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
yann@1614
    25
 	      if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))