summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-09-18 00:41:56 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-09-18 00:41:56 +0000
commit18dac99048d7a9d91de447c3b7c42663fe0b1991 (patch)
tree7bc7b82954223ecefddd50c6f8e80c6e9e433ba0
parent50f73b975cc1231a44fb8a6460e5ab6dda9edf7e (diff)
downloadgdb-18dac99048d7a9d91de447c3b7c42663fe0b1991.tar.gz
Ignore discarded section when converting mov to lea
* elf32-i386.c (elf_i386_convert_mov_to_lea): Ignore discarded section. * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-i386.c5
-rw-r--r--bfd/elf64-x86-64.c5
3 files changed, 12 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cc4239c33db..7a4334f51ed 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2012-09-17 H.J. Lu <hongjiu.lu@intel.com>
+ * elf32-i386.c (elf_i386_convert_mov_to_lea): Ignore discarded
+ section.
+ * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
+
+2012-09-17 H.J. Lu <hongjiu.lu@intel.com>
+
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Replace return
FALSE with abort.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 59feea28713..eb90a91c2d9 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2559,9 +2559,10 @@ elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec,
if (!is_elf_hash_table (link_info->hash))
return FALSE;
- /* Nothing to do if there are no codes or no relocations. */
+ /* Nothing to do if there are no codes, no relocations or no output. */
if ((sec->flags & (SEC_CODE | SEC_RELOC)) != (SEC_CODE | SEC_RELOC)
- || sec->reloc_count == 0)
+ || sec->reloc_count == 0
+ || discarded_section (sec))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index cccc5cad25a..a440647a5e1 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2595,9 +2595,10 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
if (!is_elf_hash_table (link_info->hash))
return FALSE;
- /* Nothing to do if there are no codes or no relocations. */
+ /* Nothing to do if there are no codes, no relocations or no output. */
if ((sec->flags & (SEC_CODE | SEC_RELOC)) != (SEC_CODE | SEC_RELOC)
- || sec->reloc_count == 0)
+ || sec->reloc_count == 0
+ || discarded_section (sec))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;