Control: forcemerge 751161 928254 Bug 751161 concerns the same issue. It mentions the -fsanitizer= flags, which had been fixed some time ago in libtool, but -static-libasan is still stripped.
The gcc man page says: Linker Options object-file-name -fuse-ld=linker -llibrary -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic -s -static -static-libgcc -static-libstdc++ -static-libasan -static-libtsan -static-liblsan -static-libubsan -static-libmpx -static-libmpxwrappers -shared -shared-libgcc -symbolic -T script -Wl,option -Xlinker option -u symbol -z keyword so that some other options may also be concerned (see below the current list of flags that are passed through unchanged). On 2019-05-02 14:06:03 +0200, Vincent Lefevre wrote: > On 2019-05-02 10:10:33 +0200, Vincent Lefevre wrote: > > On 2019-05-01 20:54:05 +0200, Matthias Klose wrote: > > > the linker never sees your CFLAGS. At least -static-libasan needs to > > > be added to LDFLAGS. Actually adding it to LDFLAGS too does not solve the problem. libtool strips -static-libasan even in this case. > > Indeed, I can see -static-libasan in the "libtool --mode=link" line, > > but libtool drops this option in the gcc call: > > > > /bin/sh ../libtool --tag=CC --mode=link gcc -O0 -march=native > > -fsanitize=address -static-libasan -version-info 6:0:0 > > -Wl,--disable-new-dtags -o libmpfr.la -rpath /usr/local/lib [.lo files] > > -lgmp > > libtool: link: gcc -shared -fPIC -DPIC [.o files] -lgmp -O0 > > -march=native -fsanitize=address -Wl,--disable-new-dtags -Wl,-soname > > -Wl,libmpfr.so.6 -o .libs/libmpfr.so.6.0.0 > > > > Why does libtool do that, while it preserves > > "-O0 -march=native -fsanitize=address"? > > I can see that the libtool script contains: > > # Flags to be passed through unchanged, with rationale: > # -64, -mips[0-9] enable 64-bit mode for the SGI compiler > # -r[0-9][0-9]* specify processor for the SGI compiler > # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler > # +DA*, +DD* enable 64-bit mode for the HP compiler > # -q* compiler args for the IBM compiler > # -m*, -t[45]*, -txscale* architecture-specific flags for GCC > # -F/path path to uninstalled frameworks, gcc on darwin > # -p, -pg, --coverage, -fprofile-* profiling flags for GCC > # -fstack-protector* stack protector flags for GCC > # @file GCC response files > # -tp=* Portland pgcc target processor selection > # --sysroot=* for sysroot support > # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time > optimization > # -specs=* GCC specs files > # -stdlib=* select c++ std lib with clang > # -fsanitize=* Clang/GCC memory and address sanitizer > # -fuse-ld=* Linker select flags for GCC > -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ > > -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ > > -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ > -specs=*|-fsanitize=*|-fuse-ld=*) > func_quote_for_eval "$arg" > arg=$func_quote_for_eval_result > func_append compile_command " $arg" > func_append finalize_command " $arg" > func_append compiler_flags " $arg" > continue > ;; > > i.e. it misses the -static-libasan flag. > > Reassigning to libtool. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)