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

--- Comment #3 from Kilian Kegel <minnowware at hotmail dot com> ---
Hi H.J.Lu,
thanks a lot.

in ldBugDemo0 the bug          appears, because "char var" is kept
unintilialized.
in ldBugDemo1 the bug does not appear , because "char var" is       
intilialized.
in ldBugDemo2 the bug does not appear , because "char var" is       
intilialized.

If you check the screen shot from the diff tool:

https://github.com/KilianKegel/GNU-ld-for-MicrosoftCOFF-to-LinuxELF/blob/master/bssbug.png

you can see, that on the left side var has the faulty address 403013 in
getaddr1() line 8
but the correct address 403014 in getaddr2() line 14.

THIS IS THE .BSS bug!

The work around is to initialize var to 0. 
In that case the linker doesn't create a "common symbol". Instead
the compiler creates an initialized var placed in .BSS that is not "common".

In ldBugDemo2 var is uninitialized too, but is placed in a separate file.
In that case the .BSS bug doesn't occure despite var is a "common symbol" in
.BSS.


https://github.com/KilianKegel/GNU-ld-for-MicrosoftCOFF-to-LinuxELF/blob/master/bssbugMAP.png

Regards,
Kilian

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to