This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR gold/18609


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]