[forwarded from https://bugs.debian.org/796246] seen on the gcc-5-branch. $ uname -r 4.1.0-3-generic $ echo 'void main(void){}' | gcc -pie -fPIE -fsanitize=thread -xc - -ltsan && ./a.out FATAL: ThreadSanitizer: unexpected memory mapping 0x555caf24a000-0x555caf24b000 """ There was an intentional change in the kernel that causes PIEs to be loaded in a different address range: https://git.kernel.org/linus/d1fd836dcf00d2028c700c7e44d2c23404062c90 I think ThreadSanitizer is just going to have to learn about this. """
Reported on the ThreadSanitizer bugtracker: https://code.google.com/p/thread-sanitizer/issues/detail?id=96
ThreadSanitizer moved to github so the bug is now: https://github.com/google/sanitizers/issues/503
It looks like PIE is no longer needed (at least with gcc 5.2). echo 'void main(void){}' | gcc -fsanitize=thread -xc - -ltsan && ./a.out just work fine.
I've got the same problem with GCC 4.8.5 and that release doesn't allow me to exclude the -pie flag. gcc: error: -fsanitize=thread linking must be done with -pie or -shared
I did not test my self but this is supposed to be fixed in trunk (and not backported to 6.x): https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=241977 http://llvm.org/viewvc/llvm-project?view=revision&revision=282152
Fixed for GCC 7.