<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Use of gold linker breaks debugging"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=86666#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Use of gold linker breaks debugging"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=86666">bug 86666</a>
              from <span class="vcard"><a class="email" href="mailto:peter@lekensteyn.nl" title="Peter Wu <peter@lekensteyn.nl>"> <span class="fn">Peter Wu</span></a>
</span></b>
        <pre>(In reply to Zbigniew Jedrzejewski-Szmek from <a href="show_bug.cgi?id=86666#c2">comment #2</a>)
<span class="quote">> (In reply to Peter Wu from <a href="show_bug.cgi?id=86666#c0">comment #0</a>)
> >  - The debugging section gets dropped, making the /usr/lib/debug/ files
> >    useless.
> What about this? What are the symptoms?</span >

This is a bug different from the .eh_frame gold linker issue but also hurts the
debugging experience:

The cause was mentioned in the IRC channel. For some reason, libtool does not
keep the -g option during linking (rm libgudev-1.0.la .libs/libgudev-1.0.so* &&
make libgudev-1.0.la V=1):

/bin/sh ./libtool  --tag=CC   --mode=link gcc -std=gnu99 -pipe [-W, -I, etc.]
-g -O2 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections
-Wl,--print-gc-sections -Wl,-z,relro -Wl,-z,now -pie -Wl,-fuse-ld=gold  
-version-info 2:0:2 -export-dynamic -no-undefined
-Wl,--version-script=../src/gudev/libgudev-1.0.sym  -o libgudev-1.0.la -rpath
/usr/lib src/gudev/libgudev_1_0_la-gudevclient.lo
src/gudev/libgudev_1_0_la-gudevdevice.lo
src/gudev/libgudev_1_0_la-gudevenumerator.lo
src/gudev/libgudev_1_0_la-gudevmarshal.lo
src/gudev/libgudev_1_0_la-gudevenumtypes.lo libudev.la -lgio-2.0 -lgobject-2.0
-lglib-2.0  -ldl 

libtool: link: gcc -shared  -fPIC -DPIC 
src/gudev/.libs/libgudev_1_0_la-gudevclient.o
src/gudev/.libs/libgudev_1_0_la-gudevdevice.o
src/gudev/.libs/libgudev_1_0_la-gudevenumerator.o
src/gudev/.libs/libgudev_1_0_la-gudevmarshal.o
src/gudev/.libs/libgudev_1_0_la-gudevenumtypes.o   -Wl,-rpath
-Wl,/tmp/systemd/build/.libs ./.libs/libudev.so -lrt -lcap -lgio-2.0
-lgobject-2.0 -lglib-2.0 -ldl  -flto -pthread -O2 -Wl,--as-needed
-Wl,--no-undefined -Wl,--gc-sections -Wl,--print-gc-sections -Wl,-z -Wl,relro
-Wl,-z -Wl,now -Wl,-fuse-ld=gold
-Wl,--version-script=../src/gudev/libgudev-1.0.sym   -pthread -Wl,-soname
-Wl,libgudev-1.0.so.0 -o .libs/libgudev-1.0.so.0.2.0

After the above steps, there are no debug sections:

    objdump -h .libs/libgudev-1.0.so.0 | grep debug

With '-g' appended to the libtool command above, the output is non-empty:

 27 .debug_info   0000b5be  0000000000000000  0000000000000000  0000a01a  2**0
 28 .debug_abbrev 00000d5b  0000000000000000  0000000000000000  000155d8  2**0
 29 .debug_loc    00007f25  0000000000000000  0000000000000000  00016333  2**0
 30 .debug_aranges 00000090  0000000000000000  0000000000000000  0001e258  2**0
 31 .debug_ranges 00000460  0000000000000000  0000000000000000  0001e2e8  2**0
 32 .debug_line   00000e11  0000000000000000  0000000000000000  0001e748  2**0
 33 .debug_str    00002b19  0000000000000000  0000000000000000  0001f559  2**0

This is with GCC 4.9.2.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>