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

--- Comment #4 from Paul Koning <pkoning at equallogic dot com> ---
Created attachment 11638
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11638&action=edit
Test case object files and script

I ran into this issue some time ago while debugging pdp11-gcc test case
failures.  Here is one.  I extracted the needed object files from the libc
library it uses, included the linker script, and a shell script to build it
showing the failure.

In this one, the bug corrupts a message supposed to be printed by exit().  In
exit.S you can see that status 0 results in message "exit: ok\n".  If you
objdump lib_a-exit.o, you will see that message.

Now link the program using linkbug.sh.  In the objdump of executable "bug", the
message shows up in the objdump .data output for address 1610.  It shows that
"exit" is now "e\000it", i.e., the string is truncated by the spurious zero
byte at the second character.

It appears the issue is not directly related to alignment > 2, because the link
script in this example only has ALIGNED(2) in it.  I suspect the reason it
seemed that way in the original is that changing alignment moves where the
stray 0 lands, and probably for alignment 2 in his example it ended up in some
spot where it does no damage.

-- 
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