On Tue, 2014-06-03 at 08:41 +0200, Jakub Jelinek wrote: > On Tue, Jun 03, 2014 at 10:19:48AM +0400, Yury Gribov wrote: > > >I took that patch and applied it to the gcc sources, > > >but I still see the error on ppc: > > >... > > >[bergner@makalu-lp1 asan]$ > > >LD_LIBRARY_PATH=:/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc:/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/32:/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/powerpc64-linux/32/libsanitizer/asan/.libs::/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc:/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/32:/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/powerpc64-linux/32/libsanitizer/asan/.libs: > > > ldd ./asan-interface-1.exe > > > linux-vdso32.so.1 => (0x00100000) > > > libm.so.6 => /lib/power8/libm.so.6 (0x0ff00000) > > > libasan.so.1 => > > > /home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/powerpc64-linux/32/libsanitizer/asan/.libs/libasan.so.1 > > > (0x0f930000) > > > > Now check indeed seems to be useful: libasan should be the first > > library in the list when -fsanitize=address flag is present. Are > > compiler specs for Power somehow special? > > -fsanitize=address should insert -lasan quite early on the linker command > line, please try to cut'n'paste the command line from testsuite/g++/g++.log > and add -v to see what is passed to the linker. > Perhaps the linker reorders the libraries? > Or do you have LD_PRELOAD?
No LD_PRELOAD. It adds -lasan "early", but after the libraries and object files that are explicitly added to the linker command. Since -lm is explicitly added to the linker command, the implicitly added -lasan comes after. The -v command is below. Peter /home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/collect2 -plugin /home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/liblto_plugin.so -plugin-opt=/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/lto-wrapper -plugin-opt=-fresolution=/tmp/cckyoSrJ.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 --eh-frame-hdr -V -m elf32ppclinux -dynamic-linker /lib/ld.so.1 -o ./asan-interface-1.exe /lib/../lib/crt1.o /lib/../lib/crti.o /home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/32/crtbegin.o -L/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/powerpc64-linux/32/libsanitizer/asan/.libs -L/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/32 -L/lib/../lib -L/usr/lib/../lib -L/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc -L/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/powerpc64-linux/32/libsanitizer -L/home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/powerpc64-linux/32/libsanitizer/asan /tmp/ccUTAlke.o -lm -lasan -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/bergner/gcc/build/gcc-fsf-mainline-asan-debug-3/gcc/32/crtend.o /lib/../lib/crtn.o