GNU bug report logs -
#56839
Use of -nostdlib for C++ links interferes with -fsanitize
Previous Next
Reported by: Jan Engelhardt <jengelh <at> inai.de>
Date: Sat, 30 Jul 2022 09:43:02 UTC
Severity: normal
Done: Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56839 in the body.
You can then email your comments to 56839 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-libtool <at> gnu.org
:
bug#56839
; Package
libtool
.
(Sat, 30 Jul 2022 09:43:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jan Engelhardt <jengelh <at> inai.de>
:
New bug report received and forwarded. Copy sent to
bug-libtool <at> gnu.org
.
(Sat, 30 Jul 2022 09:43:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Greetings.
libtool used to not work very well with passing -fsanitize. There was a
fix to that (commit a5c6466528c060cc4660ad0319c00740db0e42ba).
However, when C++ sources are involved, there is still a problem
with the current libtool 2.4.7, because it uses -nostdlib, which
makes the gcc driver drop the implied -lasan.
$ cat x.c
void f(int *p) { *p = 21; }
$ libtool --mode=compile --tag=CC gcc -fsanitize=address -c x.c
libtool: compile: gcc -fsanitize=address -c x.c -fPIC -DPIC -o .libs/x.o
libtool: compile: gcc -fsanitize=address -c x.c -o x.o >/dev/null 2>&1
$ libtool --mode=link --tag=CC gcc -o libx.la -fsanitize=address -rpath /usr/lib64 x.lo
libtool: link: rm -fr .libs/libx.a .libs/libx.la .libs/libx.lai .libs/libx.so .libs/libx.so.0 .libs/libx.so.0.0.0
libtool: link: gcc -shared -fPIC -DPIC .libs/x.o -fsanitize=address -Wl,-soname -Wl,libx.so.0 -o .libs/libx.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libx.so.0" && ln -s "libx.so.0.0.0" "libx.so.0")
libtool: link: (cd ".libs" && rm -f "libx.so" && ln -s "libx.so.0.0.0" "libx.so")
libtool: link: ar cr .libs/libx.a x.o
libtool: link: ranlib .libs/libx.a
libtool: link: ( cd ".libs" && rm -f "libx.la" && ln -s "../libx.la" "libx.la" )
$ ldd -r .libs/libx.so
linux-vdso.so.1 (0x00007ffc1b58e000)
libasan.so.8 => /lib64/libasan.so.8 (0x00007f03fb400000)
libc.so.6 => /lib64/libc.so.6 (0x00007f03fb000000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f03fac00000)
libm.so.6 => /lib64/libm.so.6 (0x00007f03fb31a000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f03fb2f9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f03fbac6000)
$ mv x.c x.cpp
$ cat x.cpp
void f(int *p) { *p = 21; }
$ libtool --mode=compile --tag=CXX g++ -fsanitize=address -c x.cpp
libtool: compile: g++ -fsanitize=address -c x.cpp -fPIC -DPIC -o .libs/x.o
libtool: compile: g++ -fsanitize=address -c x.cpp -o x.o >/dev/null 2>&1
$ libtool --mode=link --tag=CXX g++ -o libx.la -fsanitize=address -rpath /usr/lib64 x.lo
libtool: link: rm -fr .libs/libx.a .libs/libx.la .libs/libx.lai .libs/libx.so .libs/libx.so.0 .libs/libx.so.0.0.0
libtool: link: g++ -fPIC -DPIC -shared -nostdlib /usr/lib64/gcc/x86_64-suse-linux/12/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/12/crtbeginS.o .libs/x.o -L/usr/lib64/gcc/x86_64-suse-linux/12 -L/usr/lib64/gcc/x86_64-suse-linux/12/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/12/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib64/gcc/x86_64-suse-linux/12/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/12/../../../../lib64/crtn.o -fsanitize=address -Wl,-soname -Wl,libx.so.0 -o .libs/libx.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libx.so.0" && ln -s "libx.so.0.0.0" "libx.so.0")
libtool: link: (cd ".libs" && rm -f "libx.so" && ln -s "libx.so.0.0.0" "libx.so")
libtool: link: ar cr .libs/libx.a x.o
libtool: link: ranlib .libs/libx.a
libtool: link: ( cd ".libs" && rm -f "libx.la" && ln -s "../libx.la" "libx.la" )
$ ldd -r .libs/libx.so
linux-vdso.so.1 (0x00007fffd4bb3000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f5c29a00000)
libm.so.6 => /lib64/libm.so.6 (0x00007f5c29c91000)
libc.so.6 => /lib64/libc.so.6 (0x00007f5c29600000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f5c29c6e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5c29d95000)
undefined symbol: __asan_report_store4 (.libs/libx.so)
undefined symbol: __asan_init (.libs/libx.so)
undefined symbol: __asan_version_mismatch_check_v8 (.libs/libx.so)
Reply sent
to
Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>
:
You have taken responsibility.
(Wed, 13 Mar 2024 17:30:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jan Engelhardt <jengelh <at> inai.de>
:
bug acknowledged by developer.
(Wed, 13 Mar 2024 17:30:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 56839-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thank you for your bug report! The documentation has been updated
to note this issue rather than adding the -lasan flag to libtool.
--
Ileana Dumitrescu
GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354
[OpenPGP_0x6570EA01146F7354.asc (application/pgp-keys, attachment)]
[OpenPGP_signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 11 Apr 2024 11:24:21 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 27 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.