Patchwork [asan] : Compile g++.dg/asan tests with -D__NO_INLINE__ for *-*-linux* targets

login
register
mail settings
Submitter Uros Bizjak
Date Feb. 9, 2013, 11:46 a.m.
Message ID <CAFULd4aSqiZvyMNELCeTJwkcEuB2xY6O9n49kQuDoA7-60FPYQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/219385/
State New
Headers show

Comments

Uros Bizjak - Feb. 9, 2013, 11:46 a.m.
Hello!

Older glibcs (CentOS 2.5) have specialized extern inline functions
defined in stdlib.h that interfere with ASANs testcases in
g++.dg/asan:

#ifdef __USE_EXTERN_INLINES
/* Define inline functions which call the internal entry points.  */
...

These cause many strtol, strtoll and atoi runtime failures with
asan_test.C and interception-malloc-test-1.C, and build failures
(redefinition of strtol) for the other interception tests.

Patch avoids this unwanted inlining ba declaring __NO_INLINE__ for
linux targets.

2013-02-09  Uros Bizjak  <ubizjak@gmail.com>

	* g++.dg/asan/asan_test.C: Compile with -D__NO_INLINE__
	for *-*-linux* targets.
	* g++.dg/asan/interception-test-1.c: Ditto.
	* g++.dg/asan/interception-failure-test-1.C: Ditto.
	* g++.dg/asan/interception-malloc-test-1.C: Ditto.

Patch was tested on x86_64-pc-linux-gnu {,-m32} CentOS 5.9 (where it
fixes several runtime and build failures) and Fedora 17.

OK for mainline?

Uros.
Jakub Jelinek - Feb. 9, 2013, 1:47 p.m.
On Sat, Feb 09, 2013 at 12:46:23PM +0100, Uros Bizjak wrote:
> 2013-02-09  Uros Bizjak  <ubizjak@gmail.com>
> 
> 	* g++.dg/asan/asan_test.C: Compile with -D__NO_INLINE__
> 	for *-*-linux* targets.
> 	* g++.dg/asan/interception-test-1.c: Ditto.
> 	* g++.dg/asan/interception-failure-test-1.C: Ditto.
> 	* g++.dg/asan/interception-malloc-test-1.C: Ditto.
> 
> Patch was tested on x86_64-pc-linux-gnu {,-m32} CentOS 5.9 (where it
> fixes several runtime and build failures) and Fedora 17.
> 
> OK for mainline?

Ok.

	Jakub
Uros Bizjak - Feb. 9, 2013, 3:08 p.m.
On Sat, Feb 9, 2013 at 2:47 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Sat, Feb 09, 2013 at 12:46:23PM +0100, Uros Bizjak wrote:
>> 2013-02-09  Uros Bizjak  <ubizjak@gmail.com>
>>
>>       * g++.dg/asan/asan_test.C: Compile with -D__NO_INLINE__
>>       for *-*-linux* targets.
>>       * g++.dg/asan/interception-test-1.c: Ditto.
>>       * g++.dg/asan/interception-failure-test-1.C: Ditto.
>>       * g++.dg/asan/interception-malloc-test-1.C: Ditto.
>>
>> Patch was tested on x86_64-pc-linux-gnu {,-m32} CentOS 5.9 (where it
>> fixes several runtime and build failures) and Fedora 17.
>>
>> OK for mainline?
>
> Ok.

Thanks!

FYI, I have changed the target selector to a more strict
*-*-linux-gnu, as the define applies to glibc only.

The fix was re-tested on CentOS 5.9.

Uros.

Patch

Index: g++.dg/asan/interception-failure-test-1.C
===================================================================
--- g++.dg/asan/interception-failure-test-1.C	(revision 195912)
+++ g++.dg/asan/interception-failure-test-1.C	(working copy)
@@ -3,6 +3,7 @@ 
 
 // { dg-do run }
 // { dg-options "-fno-builtin-malloc -fno-builtin-free" }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux* } } }
 
 #include <stdlib.h>
 #include <stdio.h>
Index: g++.dg/asan/interception-test-1.C
===================================================================
--- g++.dg/asan/interception-test-1.C	(revision 195912)
+++ g++.dg/asan/interception-test-1.C	(working copy)
@@ -2,6 +2,7 @@ 
 
 // { dg-do run }
 // { dg-options "-fno-builtin-malloc -fno-builtin-free" }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux* } } }
 // { dg-shouldfail "asan" }
 // { dg-skip-if "Darwin uses mac function interposition" { *-*-darwin* } }
 
Index: g++.dg/asan/asan_test.C
===================================================================
--- g++.dg/asan/asan_test.C	(revision 195912)
+++ g++.dg/asan/asan_test.C	(working copy)
@@ -7,6 +7,7 @@ 
 // { dg-additional-options "-DASAN_LOW_MEMORY=1 -DASAN_NEEDS_SEGV=0" { target arm*-*-* } }
 // { dg-additional-options "-DASAN_AVOID_EXPENSIVE_TESTS=1" { target { ! run_expensive_tests } } }
 // { dg-additional-options "-msse2" { target { i?86-*-linux* x86_64-*-linux* } } }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux* } } }
 // { dg-final { asan-gtest } }
 
 #include "asan_test.cc"
Index: g++.dg/asan/interception-malloc-test-1.C
===================================================================
--- g++.dg/asan/interception-malloc-test-1.C	(revision 195912)
+++ g++.dg/asan/interception-malloc-test-1.C	(working copy)
@@ -2,6 +2,7 @@ 
 
 // { dg-do run { target *-*-linux* } }
 // { dg-options "-fno-builtin-free" }
+// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux* } } }
 // { dg-shouldfail "asan" }
 
 #include <stdlib.h>