2006-04-21 Carlos O'Donell <carlos@systemhalted.org>
* sysdeps/hppa/dl-tls.h: New file * sysdeps/hppa/libc-tls.c: Likewise. * sysdeps/hppa/tls-macros.h: Likewise. * sysdeps/hppa/elf/configure: Likewise. * sysdeps/hppa/elf/configure.in: Likewise.
This commit is contained in:
parent
48dcf1c597
commit
c2dd372ef4
|
@ -1,3 +1,11 @@
|
|||
2006-04-21 Carlos O'Donell <carlos@systemhalted.org>
|
||||
|
||||
* sysdeps/hppa/dl-tls.h: New file
|
||||
* sysdeps/hppa/libc-tls.c: Likewise.
|
||||
* sysdeps/hppa/tls-macros.h: Likewise.
|
||||
* sysdeps/hppa/elf/configure: Likewise.
|
||||
* sysdeps/hppa/elf/configure.in: Likewise.
|
||||
|
||||
2006-04-20 Carlos O'Donell <carlos@systemhalted.org>
|
||||
|
||||
* sysdeps/hppa/fpu/fclrexcpt.c (feclearexcept): Use union to
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* Thread-local storage handling in the ELF dynamic linker. hppa version.
|
||||
Copyright (C) 2003 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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
|
||||
/* Type used for the representation of TLS information in the GOT. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long int ti_module;
|
||||
unsigned long int ti_offset;
|
||||
} tls_index;
|
||||
|
||||
|
||||
extern void *__tls_get_addr (tls_index *ti);
|
|
@ -0,0 +1,63 @@
|
|||
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
|
||||
# Local configure fragment for sysdeps/hppa/elf.
|
||||
|
||||
if test "$usetls" != no; then
|
||||
# Check for support of thread-local storage handling in assembler and
|
||||
# linker.
|
||||
echo "$as_me:$LINENO: checking for hppa TLS support" >&5
|
||||
echo $ECHO_N "checking for hppa TLS support... $ECHO_C" >&6
|
||||
if test "${libc_cv_hppa_tls+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat > conftest.s <<\EOF
|
||||
; Setup tls data
|
||||
.section ".tdata","awT",@progbits
|
||||
foo: .data 32
|
||||
.text
|
||||
; Test general dyanmic relocations
|
||||
test0:
|
||||
addil LT'foo-$tls_gdidx$, %r19
|
||||
ldo RT'foo-$tls_gdidx$(%r1), %r26
|
||||
b __tls_get_addr
|
||||
nop
|
||||
; Test local dynamic relocations
|
||||
test1:
|
||||
addil LT'foo-$tls_ldidx$, %r19
|
||||
b __tls_get_addr
|
||||
ldo RT'foo-$tls_ldidx$(%r1), %r26
|
||||
ldo RR'foo-$tls_dtpoff$(%r1), %r25
|
||||
; More variables can be loaded...
|
||||
; Test initial exec reloctiosn
|
||||
test2:
|
||||
mfctl %cr27, %r26
|
||||
addil LT'foo-$tls_ieoff$, %r19
|
||||
ldw RT'foo-$tls_ieoff$(%r1), %r25
|
||||
add %r26, %r25, %r24
|
||||
; Test local exec relocations
|
||||
test3:
|
||||
mfctl %cr27, %r26
|
||||
addil LR'foo-$tls_leoff$, %r26
|
||||
ldo RR'foo-$tls_leoff$(%r1), %r25
|
||||
; Done all the TLS tests.
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
libc_cv_hppa_tls=yes
|
||||
else
|
||||
libc_cv_hppa_tls=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $libc_cv_hppa_tls" >&5
|
||||
echo "${ECHO_T}$libc_cv_hppa_tls" >&6
|
||||
if test $libc_cv_hppa_tls = yes; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_TLS_SUPPORT 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,49 @@
|
|||
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||
# Local configure fragment for sysdeps/hppa/elf.
|
||||
|
||||
if test "$usetls" != no; then
|
||||
# Check for support of thread-local storage handling in assembler and
|
||||
# linker.
|
||||
AC_CACHE_CHECK(for hppa TLS support, libc_cv_hppa_tls, [dnl
|
||||
cat > conftest.s <<\EOF
|
||||
; Setup tls data
|
||||
.section ".tdata","awT",@progbits
|
||||
foo: .data 32
|
||||
.text
|
||||
; Test general dyanmic relocations
|
||||
test0:
|
||||
addil LT'foo-$tls_gdidx$, %r19
|
||||
ldo RT'foo-$tls_gdidx$(%r1), %r26
|
||||
b __tls_get_addr
|
||||
nop
|
||||
; Test local dynamic relocations
|
||||
test1:
|
||||
addil LT'foo-$tls_ldidx$, %r19
|
||||
b __tls_get_addr
|
||||
ldo RT'foo-$tls_ldidx$(%r1), %r26
|
||||
ldo RR'foo-$tls_dtpoff$(%r1), %r25
|
||||
; More variables can be loaded...
|
||||
; Test initial exec reloctiosn
|
||||
test2:
|
||||
mfctl %cr27, %r26
|
||||
addil LT'foo-$tls_ieoff$, %r19
|
||||
ldw RT'foo-$tls_ieoff$(%r1), %r25
|
||||
add %r26, %r25, %r24
|
||||
; Test local exec relocations
|
||||
test3:
|
||||
mfctl %cr27, %r26
|
||||
addil LR'foo-$tls_leoff$, %r26
|
||||
ldo RR'foo-$tls_leoff$(%r1), %r25
|
||||
; Done all the TLS tests.
|
||||
EOF
|
||||
dnl
|
||||
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
|
||||
libc_cv_hppa_tls=yes
|
||||
else
|
||||
libc_cv_hppa_tls=no
|
||||
fi
|
||||
rm -f conftest*])
|
||||
if test $libc_cv_hppa_tls = yes; then
|
||||
AC_DEFINE(HAVE_TLS_SUPPORT)
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,38 @@
|
|||
/* Thread-local storage handling in the ELF dynamic linker. hppa version.
|
||||
Copyright (C) 2003 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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <csu/libc-tls.c>
|
||||
#include <dl-tls.h>
|
||||
|
||||
#if USE_TLS
|
||||
|
||||
/* On hppa, linker optimizations are not required, so __tls_get_addr
|
||||
can be called even in statically linked binaries. In this case module
|
||||
must be always 1 and PT_TLS segment exist in the binary, otherwise it
|
||||
would not link. */
|
||||
|
||||
void *
|
||||
__tls_get_addr (tls_index *ti)
|
||||
{
|
||||
dtv_t *dtv = THREAD_DTV ();
|
||||
return (char *) dtv[1].pointer.val + ti->ti_offset;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
|
||||
/* HPPA Local Exec TLS access. */
|
||||
# define TLS_LE(x) \
|
||||
({ int * __result; \
|
||||
unsigned long __tmp; \
|
||||
asm ( \
|
||||
" mfctl %%cr27, %1\n" \
|
||||
" addil LR'" #x "-$tls_leoff$, %1\n" \
|
||||
" ldo RR'" #x "-$tls_leoff$(%%r1), %0\n" \
|
||||
: "=r" (__result), "=r" (__tmp) \
|
||||
: \
|
||||
: "r1" ); \
|
||||
__result; \
|
||||
})
|
||||
|
||||
/* HPPA Initial Exec TLS access. */
|
||||
# ifdef PIC
|
||||
# define TLS_IE(x) \
|
||||
({ int * __result; \
|
||||
unsigned long __tmp, __tmp2; \
|
||||
asm ( \
|
||||
" mfctl %%cr27, %1\n" \
|
||||
" addil LT'" #x "-$tls_ieoff$, %%r19\n" \
|
||||
" ldw RT'" #x "-$tls_ieoff$(%%r1), %2\n" \
|
||||
" add %1, %2, %0\n" \
|
||||
: "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
|
||||
: \
|
||||
: "r1" ); \
|
||||
__result; \
|
||||
})
|
||||
# else
|
||||
# define TLS_IE(x) \
|
||||
({ int * __result; \
|
||||
unsigned long __tmp, __tmp2; \
|
||||
asm ( \
|
||||
" mfctl %%cr27, %1\n" \
|
||||
" addil LR'" #x "-$tls_ieoff$, %%r27\n" \
|
||||
" ldw RR'" #x "-$tls_ieoff$(%%r1), %2\n" \
|
||||
" add %1, %2, %0\n" \
|
||||
: "=r" (__result), "=r" (__tmp), "=r" (__tmp2) \
|
||||
: \
|
||||
: "r1" ); \
|
||||
__result; \
|
||||
})
|
||||
# endif
|
||||
|
||||
# ifdef PIC
|
||||
/* HPPA Local Dynamic TLS access. */
|
||||
# define TLS_LD(x) \
|
||||
({ int * __result; \
|
||||
asm ( \
|
||||
" copy %%r19, %%r4\n" \
|
||||
" addil LT'" #x "-$tls_ldidx$, %%r19\n" \
|
||||
" bl __tls_get_addr, %%r2\n" \
|
||||
" ldo RT'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
|
||||
" addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
|
||||
" ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
|
||||
" copy %%r4, %%r19\n" \
|
||||
: "=r" (__result) \
|
||||
: \
|
||||
: "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
|
||||
"r25", "r26", "r28", "r29", "r31" ); \
|
||||
__result; \
|
||||
})
|
||||
# else
|
||||
# define TLS_LD(x) \
|
||||
({ int * __result; \
|
||||
asm ( \
|
||||
" addil LR'" #x "-$tls_ldidx$, %%r27\n" \
|
||||
" bl __tls_get_addr, %%r2\n" \
|
||||
" ldo RR'" #x "-$tls_ldidx$(%%r1), %%r26\n" \
|
||||
" addil LR'" #x "-$tls_dtpoff$, %%r28\n" \
|
||||
" ldo RR'" #x "-$tls_dtpoff$(%%r1), %0\n" \
|
||||
: "=r" (__result) \
|
||||
: \
|
||||
: "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
|
||||
"r25", "r26", "r28", "r29", "r31" ); \
|
||||
__result; \
|
||||
})
|
||||
# endif
|
||||
|
||||
/* HPPA General Dynamic TLS access. */
|
||||
# ifdef PIC
|
||||
# define TLS_GD(x) \
|
||||
({ int * __result; \
|
||||
asm ( \
|
||||
" copy %%r19, %%r4\n" \
|
||||
" addil LT'" #x "-$tls_gdidx$, %%r19\n" \
|
||||
" bl __tls_get_addr, %%r2\n" \
|
||||
" ldo RT'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
|
||||
" copy %%r28, %0\n" \
|
||||
" copy %%r4, %%r19\n" \
|
||||
: "=r" (__result) \
|
||||
: \
|
||||
: "r1", "r2", "r4", "r20", "r21", "r22", "r23", "r24", \
|
||||
"r25", "r26", "r28", "r29", "r31" ); \
|
||||
__result; \
|
||||
})
|
||||
# else
|
||||
# define TLS_GD(x) \
|
||||
({ int * __result; \
|
||||
asm ( \
|
||||
" addil LR'" #x "-$tls_gdidx$, %%r27\n" \
|
||||
" bl __tls_get_addr, %%r2\n" \
|
||||
" ldo RR'" #x "-$tls_gdidx$(%%r1), %%r26\n" \
|
||||
" copy %%r28, %0\n" \
|
||||
: "=r" (__result) \
|
||||
: \
|
||||
: "r1", "r2", "r20", "r21", "r22", "r23", "r24", \
|
||||
"r25", "r26", "r28", "r29", "r31" ); \
|
||||
__result; \
|
||||
})
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue