From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13649 invoked by alias); 21 Jan 2014 12:44:24 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13587 invoked by uid 48); 21 Jan 2014 12:44:21 -0000 From: "emil.styrke at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/55561] TSAN: provide a TSAN instrumented libgomp Date: Tue, 21 Jan 2014 12:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: emil.styrke at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg02253.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561 Emil Styrke changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |emil.styrke at gmail dot com --- Comment #42 from Emil Styrke --- 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.