diff mbox

[s390] Define a __tls_get_addr macro to avoid declaring it again

Message ID 20150108135656.GA26244@spoyarek.pnq.redhat.com
State New
Headers show

Commit Message

Siddhesh Poyarekar Jan. 8, 2015, 1:56 p.m. UTC
commit 050f7298e1ecc39887c329037575ccd972071255 added an extern
declaration for __tls_get_addr that conflicts with the one in s390
dl-tls.h, based on whether __tls_get_addr is defined as a macro.  The
rationale seems to be based on the assumption that __tls_get_addr is
exported for every architecture and hence an internal non-plt alias is
needed.  This is not true for s390 though, since it exports
__tls_get_offset and not __tls_get_addr.  This results in tst-audit9
being stuck in an infinite loop.

This patch fixes this by defining a __tls_get_addr macro to itself so
as to not use the conflicting declaration.

Tested on Fedora rawhide.

Siddhesh

	* sysdeps/s390/dl-tls.h [IS_IN (rtld)]: Define __tls_get_addr
	macro.

---
 sysdeps/s390/dl-tls.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Siddhesh Poyarekar Jan. 12, 2015, 12:40 p.m. UTC | #1
Ping!

Siddhesh

On Thu, 8 Jan 2015 19:26:56 +0530
Siddhesh Poyarekar <siddhesh@redhat.com> wrote:

> commit 050f7298e1ecc39887c329037575ccd972071255 added an extern
> declaration for __tls_get_addr that conflicts with the one in s390
> dl-tls.h, based on whether __tls_get_addr is defined as a macro.  The
> rationale seems to be based on the assumption that __tls_get_addr is
> exported for every architecture and hence an internal non-plt alias is
> needed.  This is not true for s390 though, since it exports
> __tls_get_offset and not __tls_get_addr.  This results in tst-audit9
> being stuck in an infinite loop.
> 
> This patch fixes this by defining a __tls_get_addr macro to itself so
> as to not use the conflicting declaration.
> 
> Tested on Fedora rawhide.
> 
> Siddhesh
> 
> 	* sysdeps/s390/dl-tls.h [IS_IN (rtld)]: Define __tls_get_addr
> 	macro.
> 
> ---
>  sysdeps/s390/dl-tls.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/sysdeps/s390/dl-tls.h b/sysdeps/s390/dl-tls.h
> index 0fa8045..8132b10 100644
> --- a/sysdeps/s390/dl-tls.h
> +++ b/sysdeps/s390/dl-tls.h
> @@ -33,6 +33,13 @@ extern unsigned long __tls_get_offset (unsigned
> long got_offset); 
>  #  include <shlib-compat.h>
>  
> +/* dl-tls.c declares __tls_get_addr as an exported symbol if it is
> not defined
> +   as a macro.  It seems suitable to do that in the generic code
> because all
> +   architectures other than s390 export __tls_get_addr.  The
> declaration causes
> +   problems in s390 though, so we define __tls_get_addr here to
> avoid declaring
> +   __tls_get_addr again.  */
> +#  define __tls_get_addr __tls_get_addr
> +
>  extern void *__tls_get_addr (tls_index *ti) attribute_hidden;
>  /* Make a temporary alias of __tls_get_addr to remove the hidden
>     attribute.  Then export __tls_get_addr as __tls_get_addr_internal
Andreas Schwab Jan. 13, 2015, 8:12 a.m. UTC | #2
Siddhesh Poyarekar <siddhesh@redhat.com> writes:

> commit 050f7298e1ecc39887c329037575ccd972071255 added an extern
> declaration for __tls_get_addr that conflicts with the one in s390
> dl-tls.h, based on whether __tls_get_addr is defined as a macro.  The
> rationale seems to be based on the assumption that __tls_get_addr is
> exported for every architecture and hence an internal non-plt alias is
> needed.  This is not true for s390 though, since it exports
> __tls_get_offset and not __tls_get_addr.  This results in tst-audit9
> being stuck in an infinite loop.
>
> This patch fixes this by defining a __tls_get_addr macro to itself so
> as to not use the conflicting declaration.
>
> Tested on Fedora rawhide.

Also tested on openSUSE Factory.

Andreas.
Stefan Liebler Jan. 13, 2015, 1:25 p.m. UTC | #3
On 01/08/2015 02:56 PM, Siddhesh Poyarekar wrote:
> commit 050f7298e1ecc39887c329037575ccd972071255 added an extern
> declaration for __tls_get_addr that conflicts with the one in s390
> dl-tls.h, based on whether __tls_get_addr is defined as a macro.  The
> rationale seems to be based on the assumption that __tls_get_addr is
> exported for every architecture and hence an internal non-plt alias is
> needed.  This is not true for s390 though, since it exports
> __tls_get_offset and not __tls_get_addr.  This results in tst-audit9
> being stuck in an infinite loop.
>
> This patch fixes this by defining a __tls_get_addr macro to itself so
> as to not use the conflicting declaration.
>
> Tested on Fedora rawhide.

tested on s390 31/64bit.

Now __tls_get_addr isnĀ“t exported anymore
(test elf/check-abi-ld passes).

The test tst-audit9 passes, too.

Thanks.
Andreas Krebbel Jan. 14, 2015, 3:18 p.m. UTC | #4
On 01/12/2015 01:40 PM, Siddhesh Poyarekar wrote:
>> Siddhesh
>>
>> 	* sysdeps/s390/dl-tls.h [IS_IN (rtld)]: Define __tls_get_addr
>> 	macro.

Ok to apply. Thanks!

-Andreas-
diff mbox

Patch

diff --git a/sysdeps/s390/dl-tls.h b/sysdeps/s390/dl-tls.h
index 0fa8045..8132b10 100644
--- a/sysdeps/s390/dl-tls.h
+++ b/sysdeps/s390/dl-tls.h
@@ -33,6 +33,13 @@  extern unsigned long __tls_get_offset (unsigned long got_offset);
 
 #  include <shlib-compat.h>
 
+/* dl-tls.c declares __tls_get_addr as an exported symbol if it is not defined
+   as a macro.  It seems suitable to do that in the generic code because all
+   architectures other than s390 export __tls_get_addr.  The declaration causes
+   problems in s390 though, so we define __tls_get_addr here to avoid declaring
+   __tls_get_addr again.  */
+#  define __tls_get_addr __tls_get_addr
+
 extern void *__tls_get_addr (tls_index *ti) attribute_hidden;
 /* Make a temporary alias of __tls_get_addr to remove the hidden
    attribute.  Then export __tls_get_addr as __tls_get_addr_internal