bug-binutils
[Top][All Lists]
Advanced

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

relocation information disappears


From: Katsuya TANAKA
Subject: relocation information disappears
Date: Thu, 6 Apr 2017 20:20:28 +0900


---- ---- ---- w.c
#include <stdio.h>

extern int debug_f __attribute__ ((weak));

int main(int, char *[]);

int main(int argc, char *argv[])
{
        printf("flag %d", debug_f);
}
---- ---- ---- w.c

# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc -march=armv7-a -o w w.c
# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-readelf -r w

Relocation section '.rel.dyn' at offset 0x270 contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
0002101c  00000315 R_ARM_GLOB_DAT    00000000   __gmon_start__

Relocation section '.rel.plt' at offset 0x278 contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
0002100c  00000116 R_ARM_JUMP_SLOT   00000000   address@hidden
00021010  00000216 R_ARM_JUMP_SLOT   00000000   address@hidden
00021014  00000316 R_ARM_JUMP_SLOT   00000000   __gmon_start__
00021018  00000416 R_ARM_JUMP_SLOT   00000000   address@hidden

There is no "debug_f" symbol.
Why not?


# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc -march=armv7-a -c  w.c
# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-readelf -r w.o

Relocation section '.rel.text' at offset 0x1dc contains 5 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000014  00000d2b R_ARM_MOVW_ABS_NC 00000000   debug_f
00000018  00000d2c R_ARM_MOVT_ABS    00000000   debug_f
00000024  0000072b R_ARM_MOVW_ABS_NC 00000000   .LC0
00000028  0000072c R_ARM_MOVT_ABS    00000000   .LC0
0000002c  00000e1c R_ARM_CALL        00000000   printf

There is a "debug_f" symbol in object file.


---- ---- ---- w2.c
extern void debug_info(void) __attribute__ ((weak));

int main(int, char *[]);

int main(int argc, char *argv[])
{
    if (debug_info) {
        debug_info();
    }
}
---- ---- ----
# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc -march=armv7-a -o w2 w2.c
# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-readelf -r  w2

Relocation section '.rel.dyn' at offset 0x274 contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
0002101c  00000315 R_ARM_GLOB_DAT    00000000   __gmon_start__

Relocation section '.rel.plt' at offset 0x27c contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
0002100c  00000116 R_ARM_JUMP_SLOT   00000000   debug_info
00021010  00000216 R_ARM_JUMP_SLOT   00000000   address@hidden
00021014  00000316 R_ARM_JUMP_SLOT   00000000   __gmon_start__
00021018  00000416 R_ARM_JUMP_SLOT   00000000   address@hidden

There is a debug_info symbol.
Variable is not good.


tool verison is

# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/home/tanaka/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/home/tanaka/x-tools/arm-unknown-linux-gnueabi/libexec/gcc/arm-unknown-linux-gnueabi/6.3.0/lto-wrapper
Target: arm-unknown-linux-gnueabi
Configured with: /ftp/src/tools/.build/src/gcc-6.3.0/configure --build=x86_64-build_pc-linux-gnu
--host=x86_64-build_pc-linux-gnu --target=arm-unknown-linux-gnueabi
--prefix=/home/tanaka/x-tools/arm-unknown-linux-gnueabi
--with-sysroot=/home/tanaka/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot --enable-languages=c
--with-pkgversion='crosstool-NG ' --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp
--disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx
--with-gmp=/ftp/src/tools/.build/arm-unknown-linux-gnueabi/buildtools
--with-mpfr=/ftp/src/tools/.build/arm-unknown-linux-gnueabi/buildtools
--with-mpc=/ftp/src/tools/.build/arm-unknown-linux-gnueabi/buildtools
--with-isl=/ftp/src/tools/.build/arm-unknown-linux-gnueabi/buildtools --enable-lto
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--enable-threads=posix --enable-target-optspace --disable-plugin --disable-nls
--enable-tls --disable-multilib
--with-local-prefix=/home/tanaka/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot --enable-long-long
Thread model: posix
gcc version 6.3.0 (crosstool-NG )

# ~/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld -v
GNU ld (crosstool-NG ) 2.28

--------
Katsuya TANAKA.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]