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

Bug#650145: dpkg-shlibdeps warning about gcc-added library (LTO)



Source: gcc-4.6
Severity: minor

(@Bernhard: /dpkg-shlibdeps: warning: dependency on.*could be avoided.*uselessly linked/)

I’ve just spotted this in the build logs:

dpkg-shlibdeps: warning: dependency on libgcc_s.so.1 could be avoided if "debian/mksh/bin/mksh" were not uselessly linked against it (they use none of its symbols).

This could, by the way, be used in the new checker. Anyway,
thing is, mksh doesn’t use libgcc_s or request any function
from it specifically; the dependency is added by gcc itself
and this should be fixed there.

The link command used is:

gcc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat
    -Wformat-security -Werror=format-security -Wall -Wextra
    -fno-strict-aliasing -fstack-protector-all -fwrapv -flto=jobserver
    -std=gnu99 -fPIE -pie -Wl,-z,relro -Wl,-z,now -fuse-linker-plugin
    -o mksh  lalloc.o edit.o eval.o exec.o expr.o funcs.o histrap.o jobs.o
    lex.o main.o misc.o shf.o syn.o tree.o var.o strlcpy.o printf.o

Looking at “gcc -dumpspecs”, I see this though:

*libgcc:
%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared-libgcc:-lgcc --as-needed -lgcc_s --no-as-needed}%{shared-libgcc:-lgcc_s%{!shared: -lgcc}}}}

No explicit -shared-libgcc here (from me, at least.) This would have
been the logic place to fix this.

Running this (in a sid/i386 chroot) on a Hello World programme I get
the same result. Adding -v shows the possible culprit to be:
    -plugin-opt=-pass-through=-lgcc_s
Actually, -Wl,-v is more legible and shows:
/usr/bin/ld -plugin /usr/lib/gcc/i486-linux-gnu/4.6/liblto_plugin.so -plugin-opt=/usr/lib/gcc/i486-linux-gnu/4.6/lto-wrapper -plugin-opt=-fresolution=/tmp/ccflfrHu.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr -m elf_i386 --hash-style=both -dynamic-linker /lib/ld-linux.so.2 -pie -o t /usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu/Scrt1.o /usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i486-linux-gnu/4.6/crtbeginS.o -L/usr/lib/gcc/i486-linux-gnu/4.6 -L/usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu -L/usr/lib/gcc/i486-linux-gnu/4.6/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.6/../../.. -z relro -z now t.o -v -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i486-linux-gnu/4.6/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu/crtn.o

bye,
//mirabilos
-- 
  “Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool.”
						-- Edward Burr



Reply to: