public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] libsanitizer
@ 2015-11-10 22:01 Andreas Tobler
  2016-01-11 18:28 ` Bernd Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Tobler @ 2015-11-10 22:01 UTC (permalink / raw)
  To: GCC Patches

Hi all,

the attached patch removes the hard-coded requirement for the link 
operation with -ldl. On FreeBSD we do not need that, it breaks compilation.

The patch is tested against CentOS7.1

Ok to apply for trunk?

TIA,
Andreas

2015-11-10  Andreas Tobler  <andreast@gcc.gnu.org>

	* configure.ac: Replace the hard-coded -ldl requirement for
	link_sanitizer_common with a configure time check for -ldl.
	* configure: Regenerate.


Index: configure.ac
===================================================================
--- configure.ac	(revision 230119)
+++ configure.ac	(working copy)
@@ -96,7 +96,7 @@
  AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime)

  # Common libraries that we need to link against for all sanitizer libs.
-link_sanitizer_common='-lpthread -ldl -lm'
+link_sanitizer_common='-lpthread -lm'

  # At least for glibc, shm_open is in librt.  But don't pull that
  # in if it still doesn't give us the function we want.  This
@@ -130,6 +130,12 @@
  # Other sanitizers do not override clock_* API
  ])

+# Do a configure time check for -ldl
+AC_CHECK_LIB(dl, dlsym,
+  [link_libasan="-ldl $link_libasan"
+link_libtsan="-ldl $link_libtsan"
+])
+
  case "$host" in
    *-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;;
    *) MAC_INTERPOSE=false ;;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] libsanitizer
  2015-11-10 22:01 [patch] libsanitizer Andreas Tobler
@ 2016-01-11 18:28 ` Bernd Schmidt
  2016-01-11 18:37   ` Andreas Tobler
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Schmidt @ 2016-01-11 18:28 UTC (permalink / raw)
  To: Andreas Tobler, GCC Patches

On 11/10/2015 11:00 PM, Andreas Tobler wrote:
> the attached patch removes the hard-coded requirement for the link
> operation with -ldl. On FreeBSD we do not need that, it breaks compilation.
>
>
>   # Common libraries that we need to link against for all sanitizer libs.
> -link_sanitizer_common='-lpthread -ldl -lm'
> +link_sanitizer_common='-lpthread -lm'
>
>   # At least for glibc, shm_open is in librt.  But don't pull that
>   # in if it still doesn't give us the function we want.  This
> @@ -130,6 +130,12 @@
>   # Other sanitizers do not override clock_* API
>   ])
>
> +# Do a configure time check for -ldl
> +AC_CHECK_LIB(dl, dlsym,
> +  [link_libasan="-ldl $link_libasan"
> +link_libtsan="-ldl $link_libtsan"
> +])
> +

Why not add this to link_sanitizer_common, just after the similar check 
for shm_open? I'm not entirely sure how libsanitizer is structured, but 
I see references to dlsym inside the sanitizer_common directory.


Bernd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] libsanitizer
  2016-01-11 18:28 ` Bernd Schmidt
@ 2016-01-11 18:37   ` Andreas Tobler
  2016-01-11 18:57     ` Jakub Jelinek
  2016-01-13 17:40     ` Bernd Schmidt
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Tobler @ 2016-01-11 18:37 UTC (permalink / raw)
  To: Bernd Schmidt, GCC Patches

Hi Bernd,

On 11.01.16 19:28, Bernd Schmidt wrote:
> On 11/10/2015 11:00 PM, Andreas Tobler wrote:
>> the attached patch removes the hard-coded requirement for the link
>> operation with -ldl. On FreeBSD we do not need that, it breaks compilation.
>>
>>
>>    # Common libraries that we need to link against for all sanitizer libs.
>> -link_sanitizer_common='-lpthread -ldl -lm'
>> +link_sanitizer_common='-lpthread -lm'
>>
>>    # At least for glibc, shm_open is in librt.  But don't pull that
>>    # in if it still doesn't give us the function we want.  This
>> @@ -130,6 +130,12 @@
>>    # Other sanitizers do not override clock_* API
>>    ])
>>
>> +# Do a configure time check for -ldl
>> +AC_CHECK_LIB(dl, dlsym,
>> +  [link_libasan="-ldl $link_libasan"
>> +link_libtsan="-ldl $link_libtsan"
>> +])
>> +
>
> Why not add this to link_sanitizer_common, just after the similar check
> for shm_open? I'm not entirely sure how libsanitizer is structured, but
> I see references to dlsym inside the sanitizer_common directory.

Hm, looks simpler, yes.

@@ -104,6 +104,10 @@
  AC_CHECK_LIB(rt, shm_open,
    [link_sanitizer_common="-lrt $link_sanitizer_common"])

+# Do a configure time check for -ldl
+AC_CHECK_LIB(dl, dlsym,
+  [link_sanitizer_common="-lrt $link_sanitizer_common"])
+

I'll give it a test run.

Thanks,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] libsanitizer
  2016-01-11 18:37   ` Andreas Tobler
@ 2016-01-11 18:57     ` Jakub Jelinek
  2016-01-11 19:25       ` Andreas Tobler
  2016-01-13 17:40     ` Bernd Schmidt
  1 sibling, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2016-01-11 18:57 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: Bernd Schmidt, GCC Patches

On Mon, Jan 11, 2016 at 07:37:30PM +0100, Andreas Tobler wrote:
> @@ -104,6 +104,10 @@
>  AC_CHECK_LIB(rt, shm_open,
>    [link_sanitizer_common="-lrt $link_sanitizer_common"])
> 
> +# Do a configure time check for -ldl
> +AC_CHECK_LIB(dl, dlsym,
> +  [link_sanitizer_common="-lrt $link_sanitizer_common"])

s/-lrt/-ldl/, no?

	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] libsanitizer
  2016-01-11 18:57     ` Jakub Jelinek
@ 2016-01-11 19:25       ` Andreas Tobler
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Tobler @ 2016-01-11 19:25 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Bernd Schmidt, GCC Patches

On 11.01.16 19:57, Jakub Jelinek wrote:
> On Mon, Jan 11, 2016 at 07:37:30PM +0100, Andreas Tobler wrote:
>> @@ -104,6 +104,10 @@
>>   AC_CHECK_LIB(rt, shm_open,
>>     [link_sanitizer_common="-lrt $link_sanitizer_common"])
>>
>> +# Do a configure time check for -ldl
>> +AC_CHECK_LIB(dl, dlsym,
>> +  [link_sanitizer_common="-lrt $link_sanitizer_common"])
>
> s/-lrt/-ldl/, no?

Sicher, danke!
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] libsanitizer
  2016-01-11 18:37   ` Andreas Tobler
  2016-01-11 18:57     ` Jakub Jelinek
@ 2016-01-13 17:40     ` Bernd Schmidt
  2016-01-14 20:51       ` Andreas Tobler
  1 sibling, 1 reply; 7+ messages in thread
From: Bernd Schmidt @ 2016-01-13 17:40 UTC (permalink / raw)
  To: Andreas Tobler, GCC Patches

On 01/11/2016 07:37 PM, Andreas Tobler wrote:

> +# Do a configure time check for -ldl
> +AC_CHECK_LIB(dl, dlsym,
> +  [link_sanitizer_common="-lrt $link_sanitizer_common"])
> +
>
> I'll give it a test run.

If that works (with -ldl instead of -lrt) it's ok.


Bernd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch] libsanitizer
  2016-01-13 17:40     ` Bernd Schmidt
@ 2016-01-14 20:51       ` Andreas Tobler
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Tobler @ 2016-01-14 20:51 UTC (permalink / raw)
  To: Bernd Schmidt, GCC Patches

On 13.01.16 18:39, Bernd Schmidt wrote:
> On 01/11/2016 07:37 PM, Andreas Tobler wrote:
>
>> +# Do a configure time check for -ldl
>> +AC_CHECK_LIB(dl, dlsym,
>> +  [link_sanitizer_common="-lrt $link_sanitizer_common"])
>> +
>>
>> I'll give it a test run.
>
> If that works (with -ldl instead of -lrt) it's ok.

It does, tested on FreeBSD x86_64 and Linux/GNU x86_64.

Committed to trunk.

Note, there is a chunk in configure which is not from me.

It was a missing part from the last commit (r230739). There it was 
mentioned that configure was regenerated, but it did not get committed.

Thanks,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-14 20:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 22:01 [patch] libsanitizer Andreas Tobler
2016-01-11 18:28 ` Bernd Schmidt
2016-01-11 18:37   ` Andreas Tobler
2016-01-11 18:57     ` Jakub Jelinek
2016-01-11 19:25       ` Andreas Tobler
2016-01-13 17:40     ` Bernd Schmidt
2016-01-14 20:51       ` Andreas Tobler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).