[BUG] error in global variables strong aliasing
Amir Shalem
amir at boom.org.il
Fri Mar 24 20:49:03 UTC 2006
I have attached below a test-case for the effect of strong aliasing for
variables.
when you run `make` it will compile two programs with the same code
first test.c is loaded dynamically, and then test.c is compiled
statically within the program
as you can see the output of the program shows that for strong alias
variable
the base address and the aliases variable address are different.
here's sample output on freebsd amd64 6.1, debian x86 sarge, and latest
buildroot + latest uClibc + gcc 4.1.0 + binutils 2.16.1:
(the only difference are the addresses)
Running dynamic program:
LD_LIBRARY_PATH="." ./prog-dynamic
strong alias : 0x500be4 (base) != 0x500be8 (alias)
weak alias : 0x500be0 (base) == 0x500be0 (alias)
---
Running static program:
./prog-static
strong alias : 0x500b10 (base) == 0x500b10 (alias)
weak alias : 0x500b14 (base) == 0x500b14 (alias)
now,
there's strong aliases between __environ and environ in uClibc code
uClibc uses __environ, and busybox ash shell uses environ
but __environ and environ when busybox program is running (when
dynamically linked against uClibc)
have different addresses which invalidates the environ variable.
amir.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Makefile
Url: http://lists.busybox.net/pipermail/uclibc/attachments/20060324/2a34346e/attachment.diff
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: prog.c
Url: http://lists.busybox.net/pipermail/uclibc/attachments/20060324/2a34346e/attachment-0001.diff
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.c
Url: http://lists.busybox.net/pipermail/uclibc/attachments/20060324/2a34346e/attachment-0002.diff
More information about the uClibc
mailing list