aboutsummaryrefslogtreecommitdiff
path: root/bfd/libnlm.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-03-07 10:14:30 +1030
committerAlan Modra <amodra@gmail.com>2014-03-08 12:57:58 +1030
commitb80eed39e2e813c37cffcb873dc4fdd03381383c (patch)
treeedc04cceb7807daabb69a1d68be3d0d96b7c8576 /bfd/libnlm.h
parentc5164cbc322e77c331fee199cc0359269e952b5d (diff)
downloadgdb-b80eed39e2e813c37cffcb873dc4fdd03381383c.zip
gdb-b80eed39e2e813c37cffcb873dc4fdd03381383c.tar.gz
gdb-b80eed39e2e813c37cffcb873dc4fdd03381383c.tar.bz2
Better overflow checking for powerpc64 relocations
R_PPC64_ADDR16 is used in three contexts: - .short data relocation - 16-bit signed insn fields, eg. addi - 16-bit unsigned insn fields, eg. ori In the first case we want to allow both signed and unsigned 16-bit values, the latter two ought to error if the field exceeds the range of values allowed for 16-bit signed and unsigned integers respectively. These conflicting requirements meant that ld had to choose the least restrictive overflow checks, and thus it is possible to construct testcases where an addi field overflows but is not reported by ld. Many relocations dealing with 16-bit insn fields have this problem. What's more, some relocations that are only ever used for signed fields of instructions woodenly copied the lax overflow checking of R_PPC64_ADDR16. bfd/ * elf64-ppc.c (ppc64_elf_howto_raw): Use complain_overflow_signed for R_PPC64_ADDR14, R_PPC64_ADDR14_BRTAKEN, R_PPC64_ADDR14_BRNTAKEN, R_PPC64_SECTOFF, R_PPC64_ADDR16_DS, R_PPC64_SECTOFF_DS, R_PPC64_REL16 entries. Use complain_overflow_dont for R_PPC64_TOC. (ppc64_elf_relocate_section): Modify overflow test for 16-bit fields in instructions to signed/unsigned according to whether the field takes a signed or unsigned value. gold/ * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN. (Powerpc_relocate_functions::has_overflow_unsigned): New function. (Powerpc_relocate_functions::has_overflow_bitfield, overflowed): Use the above. (Target_powerpc::Relocate::relocate): Correct overflow checking for a number of relocations. Modify overflow test for 16-bit fields in instructions to signed/unsigned according to whether the field takes a signed or unsigned value.
Diffstat (limited to 'bfd/libnlm.h')
0 files changed, 0 insertions, 0 deletions