On 17/12/13 20:38, Matthew Gretton-Dann wrote:
+Ryan, +Kugan,
On 17 December 2013 08:45, Michael Hudson-Doyle michael.hudson@linaro.org wrote:
Will Newton will.newton@linaro.org writes:
On 17 December 2013 07:53, Michael Hudson-Doyle michael.hudson@linaro.org wrote:
Ah... found it! This is the code that determines the offset to patch into the code (elfnn-aarch64.c line 3845):
value = (symbol_got_offset (input_bfd, h, r_symndx) + globals->root.sgot->output_section->vma + globals->root.sgot->output_section->output_offset);
and this is the code that determines the offset as written into the relocation (elfnn-aarch64.c line 4248):
off = symbol_got_offset (input_bfd, h, r_symndx); ... rela.r_offset = globals->root.sgot->output_section->vma + globals->root.sgot->output_offset + off;
Can you see the difference? The former is "root.sgot->output_section->output_offset", the latter is "root.sgot->output_offset".
Yes, that does look a bit odd.
Yes. And one is the difference between the reloc and the code value and the other is zero...
This suggests the rather obvious attached patch. I haven't tested this exact patch, but its an obvious translation from a patch to 692e2b8bcdd8325ebfbe1daace87100d53d15ad6^ which does work. I also haven't tested the second hunk at all, but it seems plausible...
Thanks for you analysis, the fix does look plausible indeed. ;-)
Have you verified it fixes the problem you were seeing?
To be super correct, I have not verified that the patch I sent you, when applied to binutils tip, fixes the problem. But a patch that's basically the same when applied to a slightly random commit from June results in working binaries (and the unpatched version does not).
I'm about to disappear to sunnier climes
One advantage of the southern hemisphere: my climes are already sunny...
for three weeks but I'll definitely look at it when I get back. I've added Marcus to CC in case he isn't reading this list.
Cool. Would it be useful to report the bug in https://sourceware.org/bugzilla/ as well?
Yes please.
Ryan or Kugan can you look at fixing this please?
OK, I will look at it.
Thanks, Kugan