[Bug gcov-profile/83879] __gcov_dump doesn't work with dlopen-ed libraries

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 22 10:18:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83879

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-01-22
                 CC|                            |nathan at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, problem is that we create 2 shared libraries that both have
__gcov_master symbol defined. When dlopen is used for the library:

#0  __gcov_init (info=0x7ffff7817160) at ../../../libgcc/libgcov-driver.c:904
#1  0x00007ffff7614070 in _GLOBAL__sub_I_00100_0_func.c () from ./func.shared
#2  0x00007ffff7de6b8a in call_init (l=<optimized out>, argc=argc@entry=1,
argv=argv@entry=0x7fffffffdbe8, env=env@entry=0x7fffffffdbf8) at dl-init.c:72
#3  0x00007ffff7de6c96 in call_init (env=0x7fffffffdbf8, argv=0x7fffffffdbe8,
argc=1, l=<optimized out>) at dl-init.c:119
#4  _dl_init (main_map=main_map@entry=0x607280, argc=1, argv=0x7fffffffdbe8,
env=0x7fffffffdbf8) at dl-init.c:120
#5  0x00007ffff7deb3ee in dl_open_worker (a=a@entry=0x7fffffffd880) at
dl-open.c:564
#6  0x00007ffff794d7c4 in __GI__dl_catch_error (objname=0x7fffffffd870,
errstring=0x7fffffffd878, mallocedp=0x7fffffffd86f, operate=0x7ffff7deb060
<dl_open_worker>, args=0x7fffffffd880) at dl-error-skeleton.c:198
#7  0x00007ffff7deab99 in _dl_open (file=0x4034b8 "func.shared",
mode=-2147483391, caller_dlopen=0x400e6f <main+73>, nsid=-2, argc=<optimized
out>, argv=<optimized out>, env=0x7fffffffdbf8) at dl-open.c:649

Then we end up with situation where __gcov_master from main.c is different from
the ones living in the shared libraries. And then we end with multiple
__gcov_master symbols which is wrong. The symbol should live in the process
image just once.

Nathan any ideas how to fix that?


More information about the Gcc-bugs mailing list