diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2010-10-01 04:28:04 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2010-10-01 04:28:04 +0000 |
commit | e28df02b6c50caba3460bc43542b8db4bc0925ce (patch) | |
tree | 8af5689c49279c339c5f07f83ac1a69aef5d731c | |
parent | Set MAX_REGISTER_SIZE to 64. (diff) | |
download | binutils-gdb-e28df02b6c50caba3460bc43542b8db4bc0925ce.tar.gz binutils-gdb-e28df02b6c50caba3460bc43542b8db4bc0925ce.tar.bz2 binutils-gdb-e28df02b6c50caba3460bc43542b8db4bc0925ce.zip |
Clear non_elf on ELF linker defined symbols.
2010-09-30 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 and there is no refeence to _GLOBAL_OFFSET_TABLE_.
* elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Li.kewise.
* elflink.c (_bfd_elf_define_linkage_sym): Clear non_elf.
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 13 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 13 | ||||
-rw-r--r-- | bfd/elflink.c | 1 |
4 files changed, 31 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8068c4c6eec..2b0b5b0ad20 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2010-09-30 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 and there is no refeence to _GLOBAL_OFFSET_TABLE_. + * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Li.kewise. + + * elflink.c (_bfd_elf_define_linkage_sym): Clear non_elf. + 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * configure: Regenerate. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 7a426d51274..8d8bc855c15 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2559,10 +2559,17 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.sgotplt) { + struct elf_link_hash_entry *got; + got = elf_link_hash_lookup (elf_hash_table (info), + "_GLOBAL_OFFSET_TABLE_", + FALSE, FALSE, FALSE); + /* 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) + entries and there is no refeence to _GLOBAL_OFFSET_TABLE_. */ + if ((got == NULL + || !got->ref_regular_nonweak) + && (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 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 9da73a1f500..677d9c457be 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2378,10 +2378,17 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.sgotplt) { + struct elf_link_hash_entry *got; + got = elf_link_hash_lookup (elf_hash_table (info), + "_GLOBAL_OFFSET_TABLE_", + FALSE, FALSE, FALSE); + /* 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) + entries and there is no refeence to _GLOBAL_OFFSET_TABLE_. */ + if ((got == NULL + || !got->ref_regular_nonweak) + && (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 diff --git a/bfd/elflink.c b/bfd/elflink.c index f4d65991fe5..46f1e2556c4 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -86,6 +86,7 @@ _bfd_elf_define_linkage_sym (bfd *abfd, return NULL; h = (struct elf_link_hash_entry *) bh; h->def_regular = 1; + h->non_elf = 0; h->type = STT_OBJECT; h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; |