* Bug in the compiler? It miss to add R_X86_64_PLT32 instead of R_X86_64_PC32 with -fPIE GCC 4.3.2
@ 2009-01-24 0:44 Magnus Granberg
0 siblings, 0 replies; only message in thread
From: Magnus Granberg @ 2009-01-24 0:44 UTC (permalink / raw)
To: gcc-help
Hi
I'am trying to fix this bug http://bugs.gentoo.org/show_bug.cgi?id=254355
Error: /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/ld:
gre.o: relocation R_X86_64_PC32 against undefined symbol
`libnet_getgre_length'
can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/ld:
final link failed: Bad value
We are using a hardened compiler but the vanilla gcc 4.3.2 fail to with -fPIE
added on gre.
If you look at the gre.o with readelf -a on the fail one (GCC 4.3.2 Hardened)
0000000003e3 002e00000004 R_X86_64_PLT32 0000000000000000
libnet_build_gre_sre + fffffffffffffffc
0000000003f7 002f00000002 R_X86_64_PC32 0000000000000000
libnet_getgre_length + fffffffffffffffc
000000000451 003000000004 R_X86_64_PLT32 0000000000000000 libnet_build_gre
+ fffffffffffffffc
I add gre.o: CFLAGS += -fPIE and gre: LDFLAGS += -pie in the Makefile.in to
test if the vanilla GCC 4.3.2 no hardened compiler works I get the same error
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/ld:
gre.o: relocation R_X86_64_PC32 against undefined symbol
`libnet_getgre_length'
can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/ld:
final link failed: Bad value
But if i use GCC 4.1 no hardened it compiles fine and i run readelf -a on the
gre.o file i get
00000000040b 003c00000004 R_X86_64_PLT32 0000000000000000
libnet_build_gre_sre + fffffffffffffffc
00000000041f 003d00000004 R_X86_64_PLT32 0000000000000000
libnet_getgre_length + fffffffffffffffc
00000000047a 003e00000004 R_X86_64_PLT32 0000000000000000 libnet_build_gre
+ fffffffffffffffc
Some way R_X86_64_PLT32 get R_X86_64_PC32 instead
The part of source is
len = libnet_getgre_length(gre_flags);
size += len;
t = libnet_build_gre(
gre_flags, /* flags & version */
(gre_flags & GRE_VERSION_1 ? GRE_PPP : GRE_IP), /* type */
checksum, /* v0: checksum / v1:
payload_s */
offset, /* v0: offset / v1:
callID */
key, /* v0: key / v1: seq
bum */
seq, /* v0: seq num / v1: ack
*/
size, /* length */
NULL, /* payload */
0, /* payload size */
l, /* libnet handle */
0); /* libnet id */
if (t == -1)
{
fprintf(stderr, "Can't build GRE header: %s\n", libnet_geterror(l));
goto bad;
}
For more files or info see the bugreport or
http://www.ume.nu/~zorry/filer/libnet/
/zorry
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-24 0:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-24 0:44 Bug in the compiler? It miss to add R_X86_64_PLT32 instead of R_X86_64_PC32 with -fPIE GCC 4.3.2 Magnus Granberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).