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.
This commit is contained in:
H.J. Lu 2012-09-18 00:41:59 +00:00
parent 6bf93ee509
commit fbdc86d9c9
3 changed files with 12 additions and 4 deletions

View 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

View 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;

View 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;