From 7dda2462a7035e0c9cc9706abfda31861c551b14 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 11 Jan 2008 09:07:04 +0000 Subject: 2008-01-11 Tristan Gingold Eric Botcazou * 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. --- bfd/ChangeLog | 23 +++++++++++++++++++++++ bfd/elf32-arm.c | 3 +++ bfd/elf32-cris.c | 3 +++ bfd/elf32-hppa.c | 3 +++ bfd/elf32-i386.c | 3 +++ bfd/elf32-m32r.c | 3 +++ bfd/elf32-m68k.c | 3 +++ bfd/elf32-ppc.c | 3 +++ bfd/elf32-s390.c | 3 +++ bfd/elf32-sh.c | 3 +++ bfd/elf32-vax.c | 3 +++ bfd/elf32-xtensa.c | 3 +++ bfd/elf64-ppc.c | 3 +++ bfd/elf64-s390.c | 3 +++ bfd/elf64-x86-64.c | 3 +++ bfd/elflink.c | 2 -- bfd/elfxx-mips.c | 3 +++ bfd/elfxx-sparc.c | 3 +++ 18 files changed, 71 insertions(+), 2 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e0815b9..702728f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,26 @@ +2008-01-11 Tristan Gingold + Eric Botcazou + + * 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 PR gas/5552 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 811d651..3146499 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -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; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index efcefba..75d0695 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -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; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index b707345..636afbe 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -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; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 802c2b1..3d67693 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -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; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 171884f..032a17d 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -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; diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 57431c9..94a61e9 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -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; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 69cc740..0c15f3b 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -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; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 33aad35..92bf8ee 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -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; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 24ac5bb..827ba64 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -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; diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 69dbdcd..77f8b41 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -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; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index d9f2aa2..43ef7d8 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -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; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index bbb75e8..e8d4cf9 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -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; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 6af39db..cfbc135 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -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; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 62860b8..84d5ee5 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -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; diff --git a/bfd/elflink.c b/bfd/elflink.c index 1d9d574..f9f7e13 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -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")); diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 20d4271..ef2f6a7 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -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); diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 79f8f86..9796849 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -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); -- cgit v1.1