This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PPC gold doesn't check for overflow properly
- From: Cary Coutant <ccoutant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>, Binutils <binutils at sourceware dot org>
- Date: Thu, 20 Nov 2014 10:12:22 -0800
- Subject: Re: PPC gold doesn't check for overflow properly
- Authentication-results: sourceware.org; auth=none
- References: <CAHACq4rr8Z6bKL74tmunhwZYUJx1s6md=+0vg5+oWVDjNr84bA at mail dot gmail dot com> <20141120111444 dot GB4477 at bubble dot grove dot modra dot org>
In rela(), you pass (value >> right_shift) to overflowed():
return overflowed<valsize>(value >> right_shift, overflow);
But in addr24(), you pass a valsize of 26:
+ Status stat = This::template rela<32,26>(view, 0, 0x03fffffc,
+ value, overflow);
Given the right shift, shouldn't that be 24?
(addr14() uses a right shift of 0, so valsize == 16 looks right for that case.)
- if (status != Powerpc_relocate_functions<size, big_endian>::STATUS_OK)
- gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
- _("relocation overflow"));
+ if (status != Powerpc_relocate_functions<size, big_endian>::STATUS_OK
+ && !has_stub_value
+ && !(gsym != NULL
+ && gsym->is_weak_undefined()
+ && is_branch_reloc(r_type)))
+ {
+ gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
+ _("relocation overflow"));
+ if (has_stub_value)
+ gold_info(_("try relinking with a smaller --stub-group-size"));
+ }
With !has_stub_value in the outer condition, I don't think that info
message will ever get printed. Why add all the new conditions? Should
those be guarding only the new info message?
-cary