Bug in the compiler? It miss to add R_X86_64_PLT32 instead of R_X86_64_PC32 with -fPIE GCC 4.3.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux