2008-01-11 Tristan Gingold <gingold@adacore.com>
authorTristan Gingold <gingold@adacore.com>
Fri, 11 Jan 2008 09:07:04 +0000 (09:07 +0000)
committerTristan Gingold <gingold@adacore.com>
Fri, 11 Jan 2008 09:07:04 +0000 (09:07 +0000)
    Eric Botcazou  <ebotcazou@adacore.com>

* elf32-ppc.c (ppc_elf_gc_sweep_hook): Exit early if generating a
relocatable.
* elf32-arm.c (elf32_arm_gc_sweep_hook): Likewise.
* elf32-cris.c (cris_elf_gc_sweep_hook): Likewise.
* elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise.
* elf32-i386.c (elf_i386_gc_sweep_hook): Likewise.
* elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise.
* elf32-m68k.c (elf_m68k_gc_sweep_hook): Likewise.
* elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
* elf32-sh.c (sh_elf_gc_sweep_hook): Likewise.
* elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.
* elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise.
* elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
* elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
* elf64-ppc.c (ppc64_elf_gc_sweep_hook): Likewise.
* elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise.
* elflink.c (bfd_elf_gc_sections): Do not punt on relocatable output
or executable output with relocations.

18 files changed:
bfd/ChangeLog
bfd/elf32-arm.c
bfd/elf32-cris.c
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-vax.c
bfd/elf32-xtensa.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elf64-x86-64.c
bfd/elflink.c
bfd/elfxx-mips.c
bfd/elfxx-sparc.c

index e0815b9e3799cd68b4285a34c0417fb5fb509265..702728f322f69940a4858702a56641354ebafe1b 100644 (file)
@@ -1,3 +1,26 @@
+2008-01-11  Tristan Gingold  <gingold@adacore.com>
+           Eric Botcazou  <ebotcazou@adacore.com>
+
+       * elf32-ppc.c (ppc_elf_gc_sweep_hook): Exit early if generating a
+       relocatable.
+       * elf32-arm.c (elf32_arm_gc_sweep_hook): Likewise.
+       * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise.
+       * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise.
+       * elf32-i386.c (elf_i386_gc_sweep_hook): Likewise.
+       * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise.
+       * elf32-m68k.c (elf_m68k_gc_sweep_hook): Likewise.
+       * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
+       * elf32-sh.c (sh_elf_gc_sweep_hook): Likewise.
+       * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.
+       * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
+       * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
+       * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise.
+       * elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise.
+       * elflink.c (bfd_elf_gc_sections): Do not punt on relocatable output
+       or executable output with relocations.
+
 2008-01-09  Nick Clifton  <nickc@redhat.com>
 
        PR gas/5552
index 811d65185d8efdeb2f252ad16f21b2e9f6aeac57..3146499843a034db026c67684ce979bf8ed799e5 100644 (file)
@@ -7351,6 +7351,9 @@ elf32_arm_gc_sweep_hook (bfd *                     abfd,
   const Elf_Internal_Rela *rel, *relend;
   struct elf32_arm_link_hash_table * globals;
 
+  if (info->relocatable)
+    return TRUE;
+
   globals = elf32_arm_hash_table (info);
 
   elf_section_data (sec)->local_dynrel = NULL;
index efcefba25389cca65b2c38d3c1ddc47236ebeeec..75d069507013a985830819af2f991ce327437e20 100644 (file)
@@ -1986,6 +1986,9 @@ cris_elf_gc_sweep_hook (bfd *abfd,
   asection *sgot;
   asection *srelgot;
 
+  if (info->relocatable)
+    return TRUE;
+
   dynobj = elf_hash_table (info)->dynobj;
   if (dynobj == NULL)
     return TRUE;
index b707345ba4b473f693c2f85124db5bab2c8a23e3..636afbe56840b3edabd32c03c785038769036fbc 100644 (file)
@@ -1622,6 +1622,9 @@ elf32_hppa_gc_sweep_hook (bfd *abfd,
   bfd_signed_vma *local_plt_refcounts;
   const Elf_Internal_Rela *rela, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
index 802c2b1450536cbe42ad80402a47ca205d4212d2..3d67693f173f0dc122f5f087e9e00e46f1165596 100644 (file)
@@ -1599,6 +1599,9 @@ elf_i386_gc_sweep_hook (bfd *abfd,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
index 171884f88aa044aed5b0b51d1fc9561dcc37bcfd..032a17d2dffe9fe5d3dfe9dd1154815f4e5889cf 100644 (file)
@@ -3654,6 +3654,9 @@ m32r_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
index 57431c991222ee9b5e8eb4a603dbc0c8100721e7..94a61e95e94748be633564c71b1ab54c3c5358de 100644 (file)
@@ -1093,6 +1093,9 @@ elf_m68k_gc_sweep_hook (bfd *abfd,
   asection *sgot;
   asection *srelgot;
 
+  if (info->relocatable)
+    return TRUE;
+
   dynobj = elf_hash_table (info)->dynobj;
   if (dynobj == NULL)
     return TRUE;
index 69cc740e81775533a670aed22a5e6a878d70aaf0..0c15f3b367a880481b50d0bc13e7ced947cd6b31 100644 (file)
@@ -3910,6 +3910,9 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
   const Elf_Internal_Rela *rel, *relend;
   asection *got2;
 
+  if (info->relocatable)
+    return TRUE;
+
   if ((sec->flags & SEC_ALLOC) == 0)
     return TRUE;
 
index 33aad35c1fe9729da104838aaca5c99f4b366061..92bf8eed74b8c1bd181372cd54364d02fd14b05f 100644 (file)
@@ -1424,6 +1424,9 @@ elf_s390_gc_sweep_hook (bfd *abfd,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
index 24ac5bbfdb4e685e5b379fb3c8b64b8ca09a8ae1..827ba64801a065b03da66e64954779ba20af0370 100644 (file)
@@ -4564,6 +4564,9 @@ sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
index 69dbdcda64c05cbc6fa360c3bb098d1947aa4fe1..77f8b419fbd884f4c564efdc479d4402388188aa 100644 (file)
@@ -867,6 +867,9 @@ elf_vax_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, asection *sec,
   const Elf_Internal_Rela *rel, *relend;
   bfd *dynobj;
 
+  if (info->relocatable)
+    return TRUE;
+
   dynobj = elf_hash_table (info)->dynobj;
   if (dynobj == NULL)
     return TRUE;
index d9f2aa25c9ce94384522793603f47a7faa1219bb..43ef7d802d05c13c8c54976e1bc41917fe95f900 100644 (file)
@@ -1012,6 +1012,9 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   if ((sec->flags & SEC_ALLOC) == 0)
     return TRUE;
 
index bbb75e83e24c5725aa4031b3316c58cb7a8d16c5..e8d4cf9e94503b7186caabc71bbc01b41c08177b 100644 (file)
@@ -5265,6 +5265,9 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
   struct got_entry **local_got_ents;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   if ((sec->flags & SEC_ALLOC) == 0)
     return TRUE;
 
index 6af39db96aef9db1df909cb63e77228eb6e2c104..cfbc1351620a194f51fae75fb87176a7144b9148 100644 (file)
@@ -1392,6 +1392,9 @@ elf_s390_gc_sweep_hook (bfd *abfd,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
index 62860b88795305e667b43aa517d4e1a4a1803759..84d5ee58bd72e64b259b3574cefbc8dc3343e882 100644 (file)
@@ -1425,6 +1425,9 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
index 1d9d5745636b0156b9ae81c354fa92cae34fdb0d..f9f7e13f51ff2afcada10272b3cf72210ff70170 100644 (file)
@@ -11474,8 +11474,6 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
 
   if (!bed->can_gc_sections
-      || info->relocatable
-      || info->emitrelocations
       || !is_elf_hash_table (info->hash))
     {
       (*_bfd_error_handler)(_("Warning: gc-sections option ignored"));
index 20d4271886a49fef642ff21c5364c58efaddd8df..ef2f6a70db6608a3d69028aa6799f135d2a8d8b3 100644 (file)
@@ -9917,6 +9917,9 @@ _bfd_mips_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
   unsigned long r_symndx;
   struct elf_link_hash_entry *h;
 
+  if (info->relocatable)
+    return TRUE;
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
   local_got_refcounts = elf_local_got_refcounts (abfd);
index 79f8f86d0d3092115a27d541e8cf60ffd589215f..9796849b17fc28279cb598d05465ab6c66309512 100644 (file)
@@ -1563,6 +1563,9 @@ _bfd_sparc_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocatable)
+    return TRUE;
+
   elf_section_data (sec)->local_dynrel = NULL;
 
   htab = _bfd_sparc_elf_hash_table (info);