Dynamic linker issue with bind now?
Petar Jovanovic
petar.jovanovic@rt-rk.com
Wed Aug 20 22:08:00 GMT 2014
> I'm guessing it should be possible to write a linker script to
> generate a minimal binary that exhibits the issue,
Yes, that is what I had in mind as well.
Speaking of which, I have just found out that I am not the first one to
report this issue and propose (this) patch.
The issue was reported [1] two years ago, and the issue page has a
small test case. For your convenience, I will copy it here:
$ cat > test.c <<EOF
#include <stdio.h>
static int __attribute__((section(".bar"))) bar = 0x12345678;
static const char foo[] = "foo";
int main() {
printf("%s\n", foo);
return 0;
}
EOF
$ cat > script <<EOF
SECTIONS
{
.bar : { *(.bar) }
}
INSERT AFTER .rela.dyn;
EOF
$ gcc -o test test.c -fPIE -Wl,-T,script
$ LD_BIND_NOW=1 ./test
./test: error while loading shared libraries: unexpected reloc type
0x006008a0
I have just double-checked, and the test case is still valid (and fixed
with the patch). Let me know what you think.
Thank you.
Regards,
Petar
[1] Dynamic linker crash when DT_JMPREL and DT_REL{,A} are not contiguous,
https://sourceware.org/bugzilla/show_bug.cgi?id=14341
More information about the Libc-alpha
mailing list