https://sourceware.org/bugzilla/show_bug.cgi?id=22903

--- Comment #7 from Jim Wilson <wilson at gcc dot gnu.org> ---
I don't particularly care how this gets fixed.

Your patch seems to have a flaw.  You are skipping over the first 4 bytes of
the stub if it isn't aligned, but you aren't increasing the size of the stub to
allow for alignment padding, which means you end up writing past the allocated
area.  You can see the problem with the testcase the original poster put in
this PR.  The first stub has its last word overwritten by the nop emitted for
the second stub, and the second stub has its last word chopped off.

My patch seems a little cleaner, as it just adds a nop to ensure that the first
stub is aligned.  The only problem I know of with my patch is that we can get
zero bytes added at the end of the text section sometimes, which prevents the
branch Marcus added at the start of the stub section from working as intended. 
That can be seen in the testcase in this bug report, where 0x100c is a 0.  I
tried your suggestion of setting NOP in ld/emulparams/aarch64elf.sh, that does
work, except I needed to add
NOP=0x1f2003d5
and I needed to add it to the aarch64linux.sh file.  Probably every
*aarch64*.sh file needs to be fixed.

My patch unfortunately does not apply as is, as some of the linker testcase *.d
files have been modified since I originally wrote my patch.  It doesn't look
too hard to fix though.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to