GNU Binutils with patches for OS216
修訂 | d830549dba59f4e11412fd6dc18b7b1d4c6cf557 (tree) |
---|---|
時間 | 2018-02-02 21:16:40 |
作者 | Alan Modra <amodra@gmai...> |
Commiter | Alan Modra |
PowerPC64, don't relocate nops
This fixes a "bug" in that nops emitted as part of code optimization
were being relocated. As it happens the relocation value was always
zero so the nop wasn't changed. Whew! I've also moved the use of
"howto" later since I was caught out in some recent code changes with
the howto not matching r_type.
* elf64-ppc.c (ppc64_elf_relocate_section): Don't relocate nops
emitted for toc sequence optimization. Set and use "howto" later.
@@ -1,3 +1,8 @@ | ||
1 | +2018-02-02 Alan Modra <amodra@gmail.com> | |
2 | + | |
3 | + * elf64-ppc.c (ppc64_elf_relocate_section): Don't relocate nops | |
4 | + emitted for toc sequence optimization. Set and use "howto" later. | |
5 | + | |
1 | 6 | 2018-02-01 Simon Marchi <simon.marchi@ericsson.com> |
2 | 7 | |
3 | 8 | * elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Avoid pointer |
@@ -15067,7 +15067,6 @@ ppc64_elf_relocate_section (bfd *output_bfd, | ||
15067 | 15067 | /* Multi-instruction sequences that access the TOC can be |
15068 | 15068 | optimized, eg. addis ra,r2,0; addi rb,ra,x; |
15069 | 15069 | to nop; addi rb,r2,x; */ |
15070 | - howto = ppc64_elf_howto_table[(int) r_type]; | |
15071 | 15070 | switch (r_type) |
15072 | 15071 | { |
15073 | 15072 | default: |
@@ -15099,6 +15098,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, | ||
15099 | 15098 | { |
15100 | 15099 | bfd_byte *p = contents + (rel->r_offset & ~3); |
15101 | 15100 | bfd_put_32 (input_bfd, NOP, p); |
15101 | + goto copy_reloc; | |
15102 | 15102 | } |
15103 | 15103 | break; |
15104 | 15104 |
@@ -15140,9 +15140,13 @@ ppc64_elf_relocate_section (bfd *output_bfd, | ||
15140 | 15140 | /* xgettext:c-format */ |
15141 | 15141 | info->callbacks->minfo |
15142 | 15142 | (_("%H: warning: %s unexpected insn %#x.\n"), |
15143 | - input_bfd, input_section, rel->r_offset, howto->name, insn); | |
15143 | + input_bfd, input_section, rel->r_offset, | |
15144 | + ppc64_elf_howto_table[r_type]->name, insn); | |
15144 | 15145 | else |
15145 | - bfd_put_32 (input_bfd, NOP, p); | |
15146 | + { | |
15147 | + bfd_put_32 (input_bfd, NOP, p); | |
15148 | + goto copy_reloc; | |
15149 | + } | |
15146 | 15150 | } |
15147 | 15151 | break; |
15148 | 15152 |
@@ -15240,7 +15244,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, | ||
15240 | 15244 | /* xgettext:c-format */ |
15241 | 15245 | (_("%H: error: %s not a multiple of %u\n"), |
15242 | 15246 | input_bfd, input_section, rel->r_offset, |
15243 | - howto->name, | |
15247 | + ppc64_elf_howto_table[r_type]->name, | |
15244 | 15248 | mask + 1); |
15245 | 15249 | bfd_set_error (bfd_error_bad_value); |
15246 | 15250 | ret = FALSE; |
@@ -15252,6 +15256,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, | ||
15252 | 15256 | /* Dynamic relocs are not propagated for SEC_DEBUGGING sections |
15253 | 15257 | because such sections are not SEC_ALLOC and thus ld.so will |
15254 | 15258 | not process them. */ |
15259 | + howto = ppc64_elf_howto_table[(int) r_type]; | |
15255 | 15260 | if (unresolved_reloc |
15256 | 15261 | && !((input_section->flags & SEC_DEBUGGING) != 0 |
15257 | 15262 | && h->elf.def_dynamic) |