This problem turned out to be because the objects in
libasan.a of gcc-6-branch are built with -fPIC / -DPIC :
if 'PIC' is defined, the code in asan_linux.c is
assuming it has been dynamically loaded , and so
does not allow libasan.so NOT to be the first
required dynamic library. But adding '-lasan'
is a bad idea, since then the
   dlsym(RTLD_NEXT,"sigaction")
actually resolves to __interception::sigaction
which ends up calling itself until stack is exhausted.

For some reason (which I am trying to figure out, but
which is not obvious) the gcc-7-branch libasan build
does build all the libasan.a objects without -fPIC -DPIC
correctly, and so does not have this problem.

It looks like use of 'static-libasan' in GCC 6 builds
is thoroughly disabled and broken because of libasan.a
objects ARE built with -fPIC / -DPIC .

Maybe I should raise a bug about this?

Thanks & Regards,
Jason



Reply via email to