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

--- Comment #2 from Steven Noonan <steven at uplinklabs dot net> ---
I just noticed that libtool appears to be stripping some of the arguments in
LDFLAGS when invoking GCC:

/bin/sh ../libtool  --tag=CC   --mode=link gcc -flto -Wall -Wstrict-prototypes
-Werror=declaration-after-statement -Werror=missing-prototypes
-Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self
-Werror=format=2 -Werror=missing-include-dirs -fvisibility=hidden -O2
-fsanitize=undefined -Wl,-Bsymbolic-functions  -version-info 4400:0:4400
-export-dynamic  -O2 -fsanitize=undefined -o libglib-2.0.la -rpath
/usr/local/lib [[.lo files]] libcharset/libcharset.la pcre/libpcre.la 
-lpthread

libtool: link: gcc -flto -shared  -fPIC -DPIC  [[.o files]] 
-Wl,--whole-archive libcharset/.libs/libcharset.a pcre/.libs/libpcre.a
-Wl,--no-whole-archive  -lpthread  -flto -O2 -Wl,-Bsymbolic-functions -O2  
-Wl,-soname -Wl,libglib-2.0.so.0 -o .libs/libglib-2.0.so.0.4400.0

In particular it dropped the -fsanitize=undefined flag.

If I invoke the libtool-generated GCC command line with '-fsanitize=undefined'
added then there's no ICE.

$ gcc -flto -shared  -fPIC -DPIC  [[.o files]]  -Wl,--whole-archive
libcharset/.libs/libcharset.a pcre/.libs/libpcre.a -Wl,--no-whole-archive 
-lpthread  -flto -O2 -Wl,-Bsymbolic-functions -O2   -Wl,-soname
-Wl,libglib-2.0.so.0 -o .libs/libglib-2.0.so.0.4400.0 -fsanitize=undefined
$ ls -cahl .libs/libglib-2.0.so.0.4400.0
-rwxr-xr-x 1 snoonan snoonan 4.3M Apr 21 03:31 .libs/libglib-2.0.so.0.4400.0

Hmm.

Reply via email to