diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2010-07-14 00:30:57 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2010-07-14 00:30:57 +0000 |
commit | a7b16ceb928e405dc096f2af5ca7c7321e5e2e7a (patch) | |
tree | a15122e38442d047ba5fcd23f8460176c95f9ee4 /bfd | |
parent | 6ae10a308748553b3e864c8a795c536573000de7 (diff) | |
download | gdb-a7b16ceb928e405dc096f2af5ca7c7321e5e2e7a.zip gdb-a7b16ceb928e405dc096f2af5ca7c7321e5e2e7a.tar.gz gdb-a7b16ceb928e405dc096f2af5ca7c7321e5e2e7a.tar.bz2 |
Don't allocate .got.plt section if there are no GOT nor PLT entries.
bfd/
2010-07-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/11812
* elf32-i386.c (elf_i386_size_dynamic_sections): Don't
allocate .got.plt section if there are no GOT nor PLT
entries.
* elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Likewise.
ld/testsuite/
2010-07-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/11812
* ld-elf/exclude3b.d: Don't run on ia64-*-*. Replace .got with
.dynamic.
* ld-elf/exclude3d.d: New.
* ld-i386/nogot1.d: Likewise.
* ld-i386/nogot1.s: Likewise.
* ld-x86-64/nogot1.d: Likewise.
* ld-x86-64/nogot1.s: Likewise.
* ld-i386/i386.exp: Run nogot1.
* ld-x86-64/x86-64.exp: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 17 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 17 |
3 files changed, 42 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e12771a..26b38ae 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,13 @@ 2010-07-13 H.J. Lu <hongjiu.lu@intel.com> + PR ld/11812 + * elf32-i386.c (elf_i386_size_dynamic_sections): Don't + allocate .got.plt section if there are no GOT nor PLT + entries. + * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Likewise. + +2010-07-13 H.J. Lu <hongjiu.lu@intel.com> + PR ld/11791 * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Support garbage collection against STT_GNU_IFUNC symbols. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ac9bdb6..0ff3147 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2555,6 +2555,23 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.srelplt) htab->sgotplt_jump_table_size = htab->next_tls_desc_index * 4; + if (htab->elf.sgotplt) + { + /* Don't allocate .got.plt section if there are no GOT nor PLT + entries. */ + if ((htab->elf.sgotplt->size + == get_elf_backend_data (output_bfd)->got_header_size) + && (htab->elf.splt == NULL + || htab->elf.splt->size == 0) + && (htab->elf.sgot == NULL + || htab->elf.sgot->size == 0) + && (htab->elf.iplt == NULL + || htab->elf.iplt->size == 0) + && (htab->elf.igotplt == NULL + || htab->elf.igotplt->size == 0)) + htab->elf.sgotplt->size = 0; + } + /* We now have determined the sizes of the various dynamic sections. Allocate memory for them. */ relocs = FALSE; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 108f257..b0bc5c0 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2374,6 +2374,23 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, } } + if (htab->elf.sgotplt) + { + /* Don't allocate .got.plt section if there are no GOT nor PLT + entries. */ + if ((htab->elf.sgotplt->size + == get_elf_backend_data (output_bfd)->got_header_size) + && (htab->elf.splt == NULL + || htab->elf.splt->size == 0) + && (htab->elf.sgot == NULL + || htab->elf.sgot->size == 0) + && (htab->elf.iplt == NULL + || htab->elf.iplt->size == 0) + && (htab->elf.igotplt == NULL + || htab->elf.igotplt->size == 0)) + htab->elf.sgotplt->size = 0; + } + /* We now have determined the sizes of the various dynamic sections. Allocate memory for them. */ relocs = FALSE; |