[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-21 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #19 from Jakub Jelinek jakub at gcc dot gnu.org 2012-11-21 08:40:52 UTC --- (In reply to comment #18) For actual ThreadSanitizer runtime -fPIC -ftls-model=initial-exec causes degradation of generated code. Linker emits the

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-21 Thread dvyukov at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #20 from Dmitry Vyukov dvyukov at google dot com 2012-11-21 09:04:07 UTC --- (In reply to comment #19) (In reply to comment #18) For actual ThreadSanitizer runtime -fPIC -ftls-model=initial-exec causes degradation of

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-21 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #21 from Jakub Jelinek jakub at gcc dot gnu.org 2012-11-21 09:23:56 UTC --- (In reply to comment #20) What I see is that it also affect code generation (register allocation). Do we need to file a bug on that? If you see a

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-20 Thread dvyukov at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #18 from Dmitry Vyukov dvyukov at google dot com 2012-11-21 07:45:20 UTC --- (In reply to comment #17) When building libtsan as a shared library (for which I had to hack our assembly blobs a bit) we get two sources of

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-19 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #14 from Jakub Jelinek jakub at gcc dot gnu.org 2012-11-19 08:54:47 UTC --- I bet 9.5% or more of that is due to the PLT call. The thing is, even when you have initial-exec TLS model code, if you link it into an executable and

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-19 Thread konstantin.s.serebryany at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #15 from Konstantin Serebryany konstantin.s.serebryany at gmail dot com 2012-11-19 09:03:35 UTC --- You are right that -fPIC -ftls-model=initial-exec does not affect performance if we link libtsan statically (I checked). As

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-19 Thread konstantin.s.serebryany at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #16 from Konstantin Serebryany konstantin.s.serebryany at gmail dot com 2012-11-19 09:06:26 UTC --- So, using -fPIC -ftls-model=initial-exec is a great idea, it will allow to build the files once and have both static and

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-19 Thread dvyukov at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #17 from Dmitry Vyukov dvyukov at google dot com 2012-11-19 10:53:04 UTC --- When building libtsan as a shared library (for which I had to hack our assembly blobs a bit) we get two sources of slowdown: 1. __tsan_read8 and

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-18 Thread konstantin.s.serebryany at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #9 from Konstantin Serebryany konstantin.s.serebryany at gmail dot com 2012-11-18 19:35:43 UTC --- As dvyuokv@ pointed out, -ftls-model=initial-exec improves the situation, but does not fully help. Experiment: % cat x.c

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-18 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #10 from Jakub Jelinek jakub at gcc dot gnu.org 2012-11-18 19:54:37 UTC --- (In reply to comment #9) NOT-SO-BAD: -fPIC -shared -ftls-model=initial-exec % gcc x.c -O2 -fPIC -shared -o x.so -ftls-model=initial-exec ; objdump

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-18 Thread konstantin.s.serebryany at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #11 from Konstantin Serebryany konstantin.s.serebryany at gmail dot com 2012-11-18 19:59:42 UTC --- The above comment is correct. -fPIE is only applicable if we build libtsan.a and link it statically to the pie executable.

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-18 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #12 from Jakub Jelinek jakub at gcc dot gnu.org 2012-11-18 20:09:39 UTC --- That would effectively require building libtsan as libtsan.so.0, libtsan.a (both -fPIC built) and libtsan_pie.a (-fPIE built), where the gcc driver

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-18 Thread konstantin.s.serebryany at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #13 from Konstantin Serebryany konstantin.s.serebryany at gmail dot com 2012-11-19 04:13:23 UTC --- of course everything would need to be done only given appropriate benchmarks of real-world programs. We have a synthetic

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-17 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #7 from H.J. Lu hjl.tools at gmail dot com 2012-11-17 20:35:57 UTC --- (In reply to comment #6) Answering my own question: we can get static linking with -Wl,-Bstatic -lasan -Wl,-Bdynamic -ldl -lpthread The

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-17 Thread markus at trippelsdorf dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 Markus Trippelsdorf markus at trippelsdorf dot de changed: What|Removed |Added CC|

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-16 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 Andrew Pinski pinskia at gcc dot gnu.org changed: What|Removed |Added Version|unknown |4.8.0

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-16 Thread dvyukov at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #2 from Dmitry Vyukov dvyukov at google dot com 2012-11-16 17:20:43 UTC --- Not much better performance. Sole -fPIE vs -fPIC gives us 20% speedup on real programs. Indirect call will add another 10%.

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-16 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-16 Thread konstantin.s.serebryany at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #4 from Konstantin Serebryany konstantin.s.serebryany at gmail dot com 2012-11-16 20:28:34 UTC --- You have been warned (especially about tsan performance. tsan run-time heavily depends on TLS, and TLS is much slower with -fPIC

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-16 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2012-11-16 20:46:35 UTC --- For TLS, you can just use -ftls-model=initial-exec or __attribute__((tls_model (initial-exec))). libasan from what I can see doesn't use TLS at all, and

[Bug other/55354] [asan] by default, the asan run-time should be linked statically, not dynamically

2012-11-16 Thread konstantin.s.serebryany at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55354 --- Comment #6 from Konstantin Serebryany konstantin.s.serebryany at gmail dot com 2012-11-16 20:54:40 UTC --- Answering my own question: we can get static linking with -Wl,-Bstatic -lasan -Wl,-Bdynamic -ldl -lpthread For TLS, you