This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR gold/18609
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>, "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Thu, 9 Jul 2015 10:49:14 -0700
- Subject: Re: [PATCH] PR gold/18609
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3ufsJmH8trBQ6GJ5ZWBRxEpXbTTr-cDY_X=hxrkEsK=pQ at mail dot gmail dot com>
> 2015-07-09 Andrew Senkevich <andrew.senkevich@intel.com>
>
> * gold/x86_64.cc: Added overflow check for converting
> R_X86_64_GOTPCREL to R_X86_64_PC32.
Factor out "gold/" from the filename, add the PR number, and prefer
present tense:
gold/
PR gold/18609
* x86_64.cc: Add overflow check for converting
R_X86_64_GOTPCREL to R_X86_64_PC32.
> @@ -3543,7 +3511,9 @@ Target_x86_64<size>::Relocate::relocate(
> // mov foo@GOTPCREL(%rip), %reg
> // to lea foo(%rip), %reg.
> // if possible.
> - if (rela.get_r_offset() >= 2
> + int64_t x = psymval->value(object, addend) - address;
> + if (x == static_cast<int64_t>(static_cast<int32_t>(x))
> + && rela.get_r_offset() >= 2
Please use Bits<32>::has_overflow(x) to check for overflow (from reloc.h).
OK with those changes. Thanks!
-cary