On Tue, Jun 03, 2014 at 08:06:41AM -0500, Peter Bergner wrote: > 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.
Ah, that is a powerpc*-linux* bug. All other linux targets include config/gnu-user.h header, perhaps early and override it, but rs6000* seems to be the only? exception that does not. So, either you need to include that header and perhaps tweak afterwards, or duplicate the asan/tsan related stuff in there and make sure to keep it up to date. Jakub