From: H.J. Lu Date: Tue, 18 Sep 2012 00:41:59 +0000 (+0000) Subject: Ignore discarded section when converting mov to lea X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fbdc86d9c9e5fe451861a34381bf5483aec43bf1;p=binutils-gdb.git 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cc4239c33db..7a4334f51ed 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2012-09-17 H.J. Lu + + * 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 * elf32-i386.c (elf_i386_finish_dynamic_symbol): Replace return 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;