[PATCH] PR59063

Yury Gribov y.gribov@samsung.com
Wed Nov 13 09:35:00 GMT 2013


This patch is supposed to fix PR59063 
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59063).

The original bug results from libasan providing clock_gettime wrapper 
and then trying to call the "real" clock_gettime. The "real" symbol is 
supposed to come from librt.so which was not necessarily linked to 
executable. The net result is a NULL call.

Patch is based on Evgeniy Stepanov's and Jakub's suggestions in bugzilla 
discussion. It instructs frontend to add -lrt on static Asan compilation 
and also links dynamic libasan.so against librt.so.

This was tested against gcc asan testsuite on x86_64.

-Y

-------------- next part --------------
A non-text attachment was scrubbed...
Name: asan_librt_patch_1.diff
Type: text/x-patch
Size: 8830 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131113/37d31ce3/attachment.bin>
-------------- next part --------------
2013-11-13  Yury Gribov  <y.gribov@samsung.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/59063
	* config/gnu-user.h: Add librt to ASAN_STATIC_LIBS.


-------------- next part --------------
2013-11-13  Yury Gribov  <y.gribov@samsung.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/59063
	* c-c++-common/asan/pr59063-1.c: New test.
	* c-c++-common/asan/pr59063-2.c: Likewise.


-------------- next part --------------
2013-11-13  Yury Gribov  <y.gribov@samsung.com>
	        Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/59063
	* configure.ac: Check whether clock_* routines come from librt.
	* asan/Makefile.am (libasan_la_LDFLAGS): Link libasan against librt if necessary.
	* asan/Makefile.in: Regenerate.
	* interception/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.




More information about the Gcc-patches mailing list