[Bug sanitizer/55561] TSAN: provide a TSAN instrumented libgomp
emil.styrke at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jan 21 12:44:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561
Emil Styrke <emil.styrke at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |emil.styrke at gmail dot com
--- Comment #42 from Emil Styrke <emil.styrke at gmail dot com> ---
Created attachment 31905
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31905&action=edit
Patch idea
(In reply to Joost VandeVondele from comment #40)
> I'm updating the summary for this bug. It is my impression that tsan & omp
> now work well together, but in order for this to be useful, a tsan
> instrumented libgomp needs to be linked in. In my opinion, it would be great
> if gcc would build to versions of the runtime library (one standard, one
> tsan instrumented) and link the tsan instrumented libgomp as needed.
>
> As a side effect, it will provide good checking for the libgomp library.
>
> I also believe this is a more sustainable approach than writing wrappers for
> all omp functionality.
I have made a try to create a patch for this, just to get the ball rolling.
However, my autotools knowledge is a bit thin and my experience with the GCC
codebase even thinner, so I didn't get all the way.
The idea is to create a tsan-instrumented libgomp as libgomp_tsan.so and change
the libgomp.spec to select that library instead if -fsanitize=thread is used.
Issues I didn't manage to sort out:
* Correctly detecting if tsan support is available (as evident by the
commented-out logic in the patch).
* The vpath magic for finding the files in config/ breaks for the new target
because explicit targets are created for each source file. I hacked around
this
by hard-coding the paths for Linux, but obviously this is ugly.
* It seems the multilib support broke with this patch (I get the resulting
library and spec file in lib/ instead of lib32/ and lib64/), but maybe I just
handled the build scripts wrong...
* There are no test cases...
Anyway, after manually fixing up the install it seems to work alright. If this
looks like a reasonable way forward, I'd be happy to improve the patch after
feedback or leave this embryo in the hands of someone more knowledgeable.
More information about the Gcc-bugs
mailing list