duplicate _r_debug symbol - binutils question or glibc question?

Tom Kacvinsky tkacvins@gmail.com
Thu Jan 28 21:21:10 GMT 2021


Hi all,

I am seeing this:

-bash-4.4$ readelf -a /home/Users/tjk/vector/build/vc20/Linux/vc//clicast |
grep _r_debug
000000e34320  0d0c00000005 R_X86_64_COPY     0000000000e34320
_r_debug@GLIBC_2.2.5 + 0
  3340: 0000000000e34320    40 OBJECT  GLOBAL DEFAULT   29
_r_debug@GLIBC_2.2.5 (10)
 18463: 0000000000e34320    40 OBJECT  GLOBAL DEFAULT   29 _r_debug

This is for our product (which is quite complicated).  If I make a simple
program, I
don't see this symbol/variable (unless I run in the debugger):

(gdb) info variables _r_debug
All variables matching regular expression "_r_debug":

File dl-debug.c:
struct r_debug _r_debug;

If I run our application under gdb, I see this

(gdb) info variables _r_debug
All variables matching regular expression "_r_debug":

File dl-debug.c:
struct r_debug _r_debug;

Non-debugging symbols:
0x0000000000e34320  _r_debug

So, my question is why does the symbol show up three times in readelf for
our program,
only once for a simple program (in gdb) and twice for our product (again,
under gdb).
I am wondering how much of this has to do with one of the _r_debug symbols
having type
R_X86_64_COPY?  Not sure if this is a binutils question or a glibc
question.  Any tips
as to how to find where the duplicate symbols are coming from would be
greatly appreciated.
I have tried with binutils 2.34 and 2.35.1, and am running with glibc 2.17
on CentOS 7 and
this also happens on CentOS 8 according to my co-worker.

Thanks,

Tom


More information about the Binutils mailing list