From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix s390{,x} build
Date: Thu, 11 Mar 2004 09:17:00 -0000 [thread overview]
Message-ID: <20040311070814.GD3822@sunsite.ms.mff.cuni.cz> (raw)
Hi!
The recent dl-tls.c -> dl-sym.c reshuffling broke s390*.
Here is a fix, verified so far with doing dlsym on a STT_TLS symbol
in a shared library.
2004-03-11 Jakub Jelinek <jakub@redhat.com>
* sysdeps/s390/dl-tls.h: Only add __tls_get_offset assembly if
IS_IN_rtld.
(__TLS_GET_ADDR): Use __tls_get_offset, not __tls_get_addr.
--- libc/sysdeps/s390/dl-tls.h.jj 2003-01-28 11:34:02.000000000 +0100
+++ libc/sysdeps/s390/dl-tls.h 2004-03-11 09:47:56.536933703 +0100
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. s390 version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,6 +31,7 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti) attribute_hidden;
extern unsigned long __tls_get_offset (unsigned long got_offset);
+# ifdef IS_IN_rtld
/* The special thing about the s390 TLS ABI is that we do not have the
standard __tls_get_addr function but the __tls_get_offset function
which differs in two important aspects:
@@ -39,7 +40,7 @@ extern unsigned long __tls_get_offset (u
2) __tls_get_offset returns the offset of the requested variable to
the thread descriptor instead of a pointer to the variable.
*/
-#if defined __s390x__
+# if defined __s390x__
asm("\n\
.text\n\
.globl __tls_get_offset\n\
@@ -49,7 +50,7 @@ __tls_get_offset:\n\
la %r2,0(%r2,%r12)\n\
jg __tls_get_addr\n\
");
-#elif defined __s390__
+# elif defined __s390__
asm("\n\
.text\n\
.globl __tls_get_offset\n\
@@ -62,12 +63,15 @@ __tls_get_offset:\n\
b 0(%r4,%r3)\n\
1: .long __tls_get_addr - 0b\n\
");
-#endif
+# endif
+# endif
-#define GET_ADDR_OFFSET \
+# define GET_ADDR_OFFSET \
(ti->ti_offset - (unsigned long) __builtin_thread_pointer ())
-#define __TLS_GET_ADDR(__ti) \
- (__tls_get_addr(__ti) + (unsigned long) __builtin_thread_pointer ())
+# define __TLS_GET_ADDR(__ti) \
+ ({ extern char _GLOBAL_OFFSET_TABLE_[] attribute_hidden; \
+ (void *) __tls_get_offset ((char *) (__ti) - _GLOBAL_OFFSET_TABLE_) \
+ + (unsigned long) __builtin_thread_pointer (); })
#endif
Jakub
next reply other threads:[~2004-03-11 9:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-11 9:17 Jakub Jelinek [this message]
2004-03-11 9:39 ` Ulrich Drepper
2004-03-11 9:40 Martin Schwidefsky
2004-10-05 15:31 Jakub Jelinek
2009-05-29 17:11 Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040311070814.GD3822@sunsite.ms.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).