PPC gold doesn't check for overflow properly
Cary Coutant
ccoutant@google.com
Thu Nov 20 18:12:00 GMT 2014
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
More information about the Binutils
mailing list