Ignore discarded section when converting mov to lea
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 18 Sep 2012 00:41:59 +0000 (00:41 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 18 Sep 2012 00:41:59 +0000 (00:41 +0000)
* elf32-i386.c (elf_i386_convert_mov_to_lea): Ignore discarded
section.
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c

index cc4239c33db292edf21cee52544dbbb211ce5c67..7a4334f51ed52249c09e5333059928eed7c1e76c 100644 (file)
@@ -1,3 +1,9 @@
+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
index 59feea287135fd92f881e5a748383e8d866f635d..eb90a91c2d9f380af4a35a01413e093474d1b8ce 100644 (file)
@@ -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;
index cccc5cad25a4f104392a787869b7782d7d824573..a440647a5e1f1c562e2b86e484112040436332ec 100644 (file)
@@ -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;
This page took 0.031902 seconds and 4 git commands to generate.