diff options
author | Cary Coutant <ccoutant@gmail.com> | 2016-02-06 14:47:05 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2016-02-06 14:47:05 -0800 |
commit | 19ef3f4d2eaac10e98c7ba3f9eace8609ab5278e (patch) | |
tree | f759db3d5c30cc937c6bf904c5b5e200f9350d45 /gold/reloc.h | |
parent | 72c55146bb505642994637071b305bf4d30ef685 (diff) | |
download | gdb-19ef3f4d2eaac10e98c7ba3f9eace8609ab5278e.zip gdb-19ef3f4d2eaac10e98c7ba3f9eace8609ab5278e.tar.gz gdb-19ef3f4d2eaac10e98c7ba3f9eace8609ab5278e.tar.bz2 |
Fix overflow checking for 32-bit pc-relative relocations on x32.
The problem here is that x32 is really using 64-bit addressing,
while pretending to be 32-bit. Even though the object file format
is 32-bit, we need to do the overflow checking with 64-bit
arithmetic (because that's what the hardware will be using).
This patch overrides the pcrela32_check functions in reloc.h
with target-specific versions that do 64-bit checking.
I've also updated the test case to use -Tdata instead of adding
a huge .space directive, to reduce the size of the .o files.
gold/
PR gold/19567
* reloc.h (Relocate_functions::Overflow_check): Add comments.
* x86_64.cc (X86_64_relocate_functions): New class.
(Target_x86_64::Relocate::relocate): Use the new class.
* testsuite/Makefile.am (x86_64_overflow_pc32): Add -Tdata option.
(x32_overflow_pc32): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/x32_overflow_pc32.sh: New script.
* testsuite/x86_64_overflow_pc32.s: Remove .space directive.
Diffstat (limited to 'gold/reloc.h')
-rw-r--r-- | gold/reloc.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gold/reloc.h b/gold/reloc.h index 9c09c7c..72f6c46 100644 --- a/gold/reloc.h +++ b/gold/reloc.h @@ -336,9 +336,14 @@ class Relocate_functions enum Overflow_check { + // No overflow checking. CHECK_NONE, + // Check for overflow of a signed value. CHECK_SIGNED, + // Check for overflow of an unsigned value. CHECK_UNSIGNED, + // Check for overflow of a signed or unsigned value. + // (i.e., no error if either signed or unsigned fits.) CHECK_SIGNED_OR_UNSIGNED }; |