From b099ab9fcd00257ccf077d30a327a719edd940e6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 12 Aug 2008 13:12:49 +0000 Subject: [PATCH] * elf32-ppc.c (allocate_dynrelocs): Ignore dyn_relocs when !dynamic_sections_created. Don't make symbols with got references dynamic if !dynamic_sections_created. * elf64-ppc.c (allocate_dynrelocs): Likewise. Alloc dynamic relocs on undefined symbols. (ppc64_elf_relocate_section): Allow dynamic relocs on undefined symbols. --- bfd/ChangeLog | 10 ++++++++++ bfd/elf32-ppc.c | 6 ++++-- bfd/elf64-ppc.c | 8 ++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4d8b0c66682..4e2baac79b0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2008-08-12 Alan Modra + + * elf32-ppc.c (allocate_dynrelocs): Ignore dyn_relocs when + !dynamic_sections_created. Don't make symbols with got + references dynamic if !dynamic_sections_created. + * elf64-ppc.c (allocate_dynrelocs): Likewise. Alloc dynamic + relocs on undefined symbols. + (ppc64_elf_relocate_section): Allow dynamic relocs on + undefined symbols. + 2008-08-11 Alan Modra * elf64-ppc.c (toc_adjusting_stub_needed): Any call via the plt diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index a93a7065e5e..84e72b8a041 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4993,7 +4993,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { /* Make sure this symbol is output as a dynamic symbol. */ if (eh->elf.dynindx == -1 - && !eh->elf.forced_local) + && !eh->elf.forced_local + && htab->elf.dynamic_sections_created) { if (!bfd_elf_link_record_dynamic_symbol (info, &eh->elf)) return FALSE; @@ -5041,7 +5042,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else eh->elf.got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (eh->dyn_relocs == NULL + || !htab->elf.dynamic_sections_created) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 3ee3f69e287..86fe3c3de84 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -7891,7 +7891,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) Undefined weak syms won't yet be marked as dynamic, nor will all TLS symbols. */ if (h->dynindx == -1 - && !h->forced_local) + && !h->forced_local + && htab->elf.dynamic_sections_created) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -7925,7 +7926,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else gent->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (eh->dyn_relocs == NULL + || !htab->elf.dynamic_sections_created) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -7982,7 +7984,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) dynamic. */ if (!h->non_got_ref - && h->def_dynamic && !h->def_regular) { /* Make sure this symbol is output as a dynamic symbol. @@ -11251,7 +11252,6 @@ ppc64_elf_relocate_section (bfd *output_bfd, && h != NULL && h->elf.dynindx != -1 && !h->elf.non_got_ref - && h->elf.def_dynamic && !h->elf.def_regular)) { Elf_Internal_Rela outrel; -- 2.30.2