On Thu, Jan 24, 2019 at 12:03:21AM +0300, Dmitry V. Levin wrote: > Hi, > > On Wed, Jan 23, 2019 at 08:45:06PM +0000, Richard W.M. Jones wrote: > > On Wed, Jan 23, 2019 at 09:01:19PM +0100, Bruno Haible wrote: > [...] > > I checked the history of the Fedora package which adds these flags, and > > it seems like --as-needed was added for: > > > > https://fedoraproject.org/wiki/Changes/RemoveExcessiveLinking > > > > Removing -Wl,--as-needed fixes the problem. However I'm still unclear > > about this. Is Fedora wrong? Is hivex using gnulib wrongly? Is > > gnulib wrong? > > We also build everything with --as-needed by default, but > gnulib does the right thing nowadays by using > -Wl,--push-state -Wl,--no-as-needed -lpthread -Wl,--pop-state > instead of plain -lpthread.
hivex is using a very recent gnulib (34290cb926). The test is linked with: /bin/sh ../../libtool --tag=CC --preserve-dup-deps --mode=link gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o test-thread_create test-thread_create.o libtests.a ../../gnulib/lib/libgnu.la libtests.a -pthread -Wl,--push-state -Wl,--no-as-needed -lpthread -Wl,--pop-state As you can see from the last bit, the --push-state ... --pop-state seems correct. Yet the test still fails. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW