mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-01 13:17:19 +08:00
hppa: Remove elf/ and create crti.S/crtn.S
This patch removes the elf/ directory, moving any special configury down a directory e.g. TLS checks. This patch also implements the required crti.S and crtn.S files, verifying that they match the current implementation.
This commit is contained in:
parent
cde9262435
commit
c053fa34cd
@ -1,3 +1,17 @@
|
||||
2012-04-17 Carlos O'Donell <carlos@systemhalted.org>
|
||||
|
||||
* sysdeps/hppa/elf/configure: Removed file.
|
||||
* sysdeps/hppa/elf/configure.in: Move to...
|
||||
* sysdeps/hppa/configure.in: ... here.
|
||||
* sysdeps/hppa/configure: Regenerate.
|
||||
* sysdeps/hppa/elf/initfini.c: Removed file.
|
||||
* sysdeps/hppa/crti.S: New file.
|
||||
* sysdeps/hppa/crtn.S: New file.
|
||||
* sysdeps/hppa/elf/entry.h: Moved to ...
|
||||
* sysdeps/hppa/entry.h: ... here.
|
||||
* sysdeps/hppa/elf/start.S: Move to ...
|
||||
* sysdeps/hppa/start.S: ... here.
|
||||
|
||||
2012-03-22 Carlos O'Donell <carlos@systemhalted.org>
|
||||
|
||||
[BZ #6730]
|
||||
|
58
sysdeps/hppa/configure
vendored
58
sysdeps/hppa/configure
vendored
@ -84,7 +84,7 @@ $as_echo X/"$0" |
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler line separator" >&5
|
||||
$as_echo_n "checking for assembler line separator... " >&6; }
|
||||
if test "${libc_cv_asm_line_sep+set}" = set; then :
|
||||
if ${libc_cv_asm_line_sep+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat > conftest.s <<EOF
|
||||
@ -113,3 +113,59 @@ cat >>confdefs.h <<_ACEOF
|
||||
#define ASM_LINE_SEP $libc_cv_asm_line_sep
|
||||
_ACEOF
|
||||
|
||||
|
||||
# Check for support of thread-local storage handling in assembler and
|
||||
# linker.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hppa TLS support" >&5
|
||||
$as_echo_n "checking for hppa TLS support... " >&6; }
|
||||
if ${libc_cv_hppa_tls+:} false; then :
|
||||
$as_echo_n "(cached) " >&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\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }; then
|
||||
libc_cv_hppa_tls=yes
|
||||
else
|
||||
libc_cv_hppa_tls=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hppa_tls" >&5
|
||||
$as_echo "$libc_cv_hppa_tls" >&6; }
|
||||
if test $libc_cv_hppa_tls = no; then
|
||||
as_fn_error $? "the assembler must support TLS" "$LINENO" 5
|
||||
fi
|
||||
|
@ -19,3 +19,48 @@ else
|
||||
fi
|
||||
rm -f conftest*])
|
||||
AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
|
||||
|
||||
# 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 = no; then
|
||||
AC_MSG_ERROR([the assembler must support TLS])
|
||||
fi
|
||||
|
80
sysdeps/hppa/crti.S
Normal file
80
sysdeps/hppa/crti.S
Normal file
@ -0,0 +1,80 @@
|
||||
/* Special .init and .fini section support for HPPA
|
||||
Copyright (C) 2000-2012 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.
|
||||
|
||||
In addition to the permissions in the GNU Lesser General Public
|
||||
License, the Free Software Foundation gives you unlimited
|
||||
permission to link the compiled version of this file with other
|
||||
programs, and to distribute those programs without any restriction
|
||||
coming from the use of this file. (The GNU Lesser General Public
|
||||
License restrictions do apply in other respects; for example, they
|
||||
cover modification of the file, and distribution when not linked
|
||||
into another program.)
|
||||
|
||||
Note that people who make modified versions of this file are not
|
||||
obligated to grant this special exception for their modified
|
||||
versions; it is their choice whether to do so. The GNU Lesser
|
||||
General Public License gives permission to release a modified
|
||||
version without this exception; this exception also makes it
|
||||
possible to release a modified version which carries forward this
|
||||
exception.
|
||||
|
||||
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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* crti.S puts a function prologue at the beginning of the .init and
|
||||
.fini sections and defines global symbols for those addresses, so
|
||||
they can be called as functions. The symbols _init and _fini are
|
||||
magic and cause the linker to emit DT_INIT and DT_FINI. */
|
||||
|
||||
#include <libc-symbols.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifndef PREINIT_FUNCTION
|
||||
# define PREINIT_FUNCTION __gmon_start__
|
||||
#endif
|
||||
|
||||
#ifndef PREINIT_FUNCTION_WEAK
|
||||
# define PREINIT_FUNCTION_WEAK 1
|
||||
#endif
|
||||
|
||||
/* _init prologue. */
|
||||
.section .init, "ax", %progbits
|
||||
.align 4
|
||||
.globl _init
|
||||
.type _init,@function
|
||||
_init:
|
||||
stw %rp,-20(%sp)
|
||||
stwm %r4,64(%sp)
|
||||
stw %r19,-32(%sp)
|
||||
#if PREINIT_FUNCTION_WEAK
|
||||
bl PREINIT_FUNCTION,%rp
|
||||
copy %r19,%r4 /* delay slot */
|
||||
#else
|
||||
bl PREINIT_FUNCTION,%rp
|
||||
copy %r19,%r4 /* delay slot */
|
||||
#endif
|
||||
copy %r4,%r19
|
||||
|
||||
/* _fini prologue. */
|
||||
.section .fini,"ax",%progbits
|
||||
.align 4
|
||||
.globl _fini
|
||||
.type _fini,@function
|
||||
_fini:
|
||||
stw %rp,-20(%sp)
|
||||
stwm %r4,64(%sp)
|
||||
stw %r19,-32(%sp)
|
||||
copy %r19,%r4
|
||||
|
88
sysdeps/hppa/crtn.S
Normal file
88
sysdeps/hppa/crtn.S
Normal file
@ -0,0 +1,88 @@
|
||||
/* Special .init and .fini section support for HPPA
|
||||
Copyright (C) 2000-2012 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.
|
||||
|
||||
In addition to the permissions in the GNU Lesser General Public
|
||||
License, the Free Software Foundation gives you unlimited
|
||||
permission to link the compiled version of this file with other
|
||||
programs, and to distribute those programs without any restriction
|
||||
coming from the use of this file. (The GNU Lesser General Public
|
||||
License restrictions do apply in other respects; for example, they
|
||||
cover modification of the file, and distribution when not linked
|
||||
into another program.)
|
||||
|
||||
Note that people who make modified versions of this file are not
|
||||
obligated to grant this special exception for their modified
|
||||
versions; it is their choice whether to do so. The GNU Lesser
|
||||
General Public License gives permission to release a modified
|
||||
version without this exception; this exception also makes it
|
||||
possible to release a modified version which carries forward this
|
||||
exception.
|
||||
|
||||
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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
/* crtn.S puts function epilogues in the .init and .fini sections
|
||||
corresponding to the prologues in crti.S. */
|
||||
|
||||
/* Note that we cannot have a weak undefined __gmon_start__, because
|
||||
that would require this to be PIC, and the linker is currently not
|
||||
able to generate a proper procedure descriptor for _init. Sad but
|
||||
true. Anyway, HPPA is one of those horrible architectures where
|
||||
making the comparison and indirect call is quite expensive (see the
|
||||
comment in sysdeps/generic/initfini.c). */
|
||||
.text
|
||||
.align 4
|
||||
.weak __gmon_start__
|
||||
.type __gmon_start__,@function
|
||||
__gmon_start__:
|
||||
.proc
|
||||
.callinfo
|
||||
.entry
|
||||
bv,n %r0(%r2)
|
||||
.exit
|
||||
.procend
|
||||
|
||||
/* Here is the tail end of _init. We put __gmon_start before this so
|
||||
that the assembler creates the .PARISC.unwind section for us, ie.
|
||||
with the right attributes. */
|
||||
.section .init, "ax", @progbits
|
||||
ldw -84(%sp),%rp
|
||||
copy %r4,%r19
|
||||
bv %r0(%rp)
|
||||
_end_init:
|
||||
ldwm -64(%sp),%r4
|
||||
|
||||
/* Our very own unwind info, because the assembler can't handle
|
||||
functions split into two or more pieces. */
|
||||
.section .PARISC.unwind
|
||||
.extern _init
|
||||
.word _init, _end_init
|
||||
.byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
|
||||
|
||||
/* Here is the tail end of _fini. */
|
||||
.section .fini, "ax", @progbits
|
||||
ldw -84(%sp),%rp
|
||||
copy %r4,%r19
|
||||
bv %r0(%rp)
|
||||
_end_fini:
|
||||
ldwm -64(%sp),%r4
|
||||
|
||||
.section .PARISC.unwind
|
||||
.extern _fini
|
||||
.word _fini, _end_fini
|
||||
.byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08
|
||||
|
140
sysdeps/hppa/elf/configure
vendored
140
sysdeps/hppa/elf/configure
vendored
@ -1,140 +0,0 @@
|
||||
|
||||
# as_fn_set_status STATUS
|
||||
# -----------------------
|
||||
# Set $? to STATUS, without forking.
|
||||
as_fn_set_status ()
|
||||
{
|
||||
return $1
|
||||
} # as_fn_set_status
|
||||
|
||||
# as_fn_exit STATUS
|
||||
# -----------------
|
||||
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
|
||||
as_fn_exit ()
|
||||
{
|
||||
set +e
|
||||
as_fn_set_status $1
|
||||
exit $1
|
||||
} # as_fn_exit
|
||||
if expr a : '\(a\)' >/dev/null 2>&1 &&
|
||||
test "X`expr 00001 : '.*\(...\)'`" = X001; then
|
||||
as_expr=expr
|
||||
else
|
||||
as_expr=false
|
||||
fi
|
||||
|
||||
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
|
||||
as_basename=basename
|
||||
else
|
||||
as_basename=false
|
||||
fi
|
||||
|
||||
as_me=`$as_basename -- "$0" ||
|
||||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
|
||||
X"$0" : 'X\(//\)$' \| \
|
||||
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
$as_echo X/"$0" |
|
||||
sed '/^.*\/\([^/][^/]*\)\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\/\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\/\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'`
|
||||
|
||||
|
||||
as_lineno_1=$LINENO as_lineno_1a=$LINENO
|
||||
as_lineno_2=$LINENO as_lineno_2a=$LINENO
|
||||
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
|
||||
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
|
||||
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
|
||||
sed -n '
|
||||
p
|
||||
/[$]LINENO/=
|
||||
' <$as_myself |
|
||||
sed '
|
||||
s/[$]LINENO.*/&-/
|
||||
t lineno
|
||||
b
|
||||
:lineno
|
||||
N
|
||||
:loop
|
||||
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
|
||||
t loop
|
||||
s/-\n.*//
|
||||
' >$as_me.lineno &&
|
||||
chmod +x "$as_me.lineno" ||
|
||||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
|
||||
|
||||
# Don't try to exec as it changes $[0], causing all sort of problems
|
||||
# (the dirname of $[0] is not the place where we might find the
|
||||
# original and so on. Autoconf is especially sensitive to this).
|
||||
. "./$as_me.lineno"
|
||||
# Exit status is that of the last command.
|
||||
exit
|
||||
}
|
||||
|
||||
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
|
||||
# Local configure fragment for sysdeps/hppa/elf.
|
||||
|
||||
# Check for support of thread-local storage handling in assembler and
|
||||
# linker.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hppa TLS support" >&5
|
||||
$as_echo_n "checking for hppa TLS support... " >&6; }
|
||||
if test "${libc_cv_hppa_tls+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&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\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }; then
|
||||
libc_cv_hppa_tls=yes
|
||||
else
|
||||
libc_cv_hppa_tls=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hppa_tls" >&5
|
||||
$as_echo "$libc_cv_hppa_tls" >&6; }
|
||||
if test $libc_cv_hppa_tls = no; then
|
||||
as_fn_error $? "the assembler must support TLS" "$LINENO" 5
|
||||
fi
|
@ -1,47 +0,0 @@
|
||||
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||
# Local configure fragment for sysdeps/hppa/elf.
|
||||
|
||||
# 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 = no; then
|
||||
AC_MSG_ERROR([the assembler must support TLS])
|
||||
fi
|
@ -1,138 +0,0 @@
|
||||
/* Special .init and .fini section support for HPPA
|
||||
Copyright (C) 2000, 2002 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.
|
||||
|
||||
In addition to the permissions in the GNU Lesser General Public
|
||||
License, the Free Software Foundation gives you unlimited
|
||||
permission to link the compiled version of this file with other
|
||||
programs, and to distribute those programs without any restriction
|
||||
coming from the use of this file. (The GNU Lesser General Public
|
||||
License restrictions do apply in other respects; for example, they
|
||||
cover modification of the file, and distribution when not linked
|
||||
into another program.)
|
||||
|
||||
Note that people who make modified versions of this file are not
|
||||
obligated to grant this special exception for their modified
|
||||
versions; it is their choice whether to do so. The GNU Lesser
|
||||
General Public License gives permission to release a modified
|
||||
version without this exception; this exception also makes it
|
||||
possible to release a modified version which carries forward this
|
||||
exception.
|
||||
|
||||
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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This file is compiled into assembly code which is then munged by a sed
|
||||
script into two files: crti.s and crtn.s.
|
||||
|
||||
* crti.s puts a function prologue at the beginning of the
|
||||
.init and .fini sections and defines global symbols for
|
||||
those addresses, so they can be called as functions.
|
||||
|
||||
* crtn.s puts the corresponding function epilogues
|
||||
in the .init and .fini sections. */
|
||||
|
||||
/* If we use the standard C version, the linkage table pointer won't
|
||||
be properly preserved due to the splitting up of function prologues
|
||||
and epilogues. Therefore we write these in assembly to make sure
|
||||
they do the right thing.
|
||||
|
||||
Note that we cannot have a weak undefined __gmon_start__, because
|
||||
that would require this to be PIC, and the linker is currently not
|
||||
able to generate a proper procedure descriptor for _init. Sad but
|
||||
true. Anyway, HPPA is one of those horrible architectures where
|
||||
making the comparison and indirect call is quite expensive (see the
|
||||
comment in sysdeps/generic/initfini.c). */
|
||||
|
||||
__asm__ ("\
|
||||
\n\
|
||||
#include \"defs.h\"\n\
|
||||
\n\
|
||||
/*@HEADER_ENDS*/\n\
|
||||
\n\
|
||||
/*@_init_PROLOG_BEGINS*/\n\
|
||||
.section .init\n\
|
||||
.align 4\n\
|
||||
.globl _init\n\
|
||||
.type _init,@function\n\
|
||||
_init:\n\
|
||||
stw %rp,-20(%sp)\n\
|
||||
stwm %r4,64(%sp)\n\
|
||||
stw %r19,-32(%sp)\n\
|
||||
bl __gmon_start__,%rp\n\
|
||||
copy %r19,%r4 /* delay slot */\n\
|
||||
copy %r4,%r19\n\
|
||||
/*@_init_PROLOG_ENDS*/\n\
|
||||
\n\
|
||||
/*@_init_EPILOG_BEGINS*/\n\
|
||||
.text\n\
|
||||
.align 4\n\
|
||||
.weak __gmon_start__\n\
|
||||
.type __gmon_start__,@function\n\
|
||||
__gmon_start__:\n\
|
||||
.proc\n\
|
||||
.callinfo\n\
|
||||
.entry\n\
|
||||
bv,n %r0(%r2)\n\
|
||||
.exit\n\
|
||||
.procend\n\
|
||||
\n\
|
||||
/* Here is the tail end of _init. We put __gmon_start before this so\n\
|
||||
that the assembler creates the .PARISC.unwind section for us, ie.\n\
|
||||
with the right attributes. */\n\
|
||||
.section .init\n\
|
||||
ldw -84(%sp),%rp\n\
|
||||
copy %r4,%r19\n\
|
||||
bv %r0(%rp)\n\
|
||||
_end_init:\n\
|
||||
ldwm -64(%sp),%r4\n\
|
||||
\n\
|
||||
/* Our very own unwind info, because the assembler can't handle\n\
|
||||
functions split into two or more pieces. */\n\
|
||||
.section .PARISC.unwind\n\
|
||||
.extern _init\n\
|
||||
.word _init, _end_init\n\
|
||||
.byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n\
|
||||
\n\
|
||||
/*@_init_EPILOG_ENDS*/\n\
|
||||
\n\
|
||||
/*@_fini_PROLOG_BEGINS*/\n\
|
||||
.section .fini\n\
|
||||
.align 4\n\
|
||||
.globl _fini\n\
|
||||
.type _fini,@function\n\
|
||||
_fini:\n\
|
||||
stw %rp,-20(%sp)\n\
|
||||
stwm %r4,64(%sp)\n\
|
||||
stw %r19,-32(%sp)\n\
|
||||
copy %r19,%r4\n\
|
||||
/*@_fini_PROLOG_ENDS*/\n\
|
||||
\n\
|
||||
/*@_fini_EPILOG_BEGINS*/\n\
|
||||
.section .fini\n\
|
||||
ldw -84(%sp),%rp\n\
|
||||
copy %r4,%r19\n\
|
||||
bv %r0(%rp)\n\
|
||||
_end_fini:\n\
|
||||
ldwm -64(%sp),%r4\n\
|
||||
\n\
|
||||
.section .PARISC.unwind\n\
|
||||
.extern _fini\n\
|
||||
.word _fini, _end_fini\n\
|
||||
.byte 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n\
|
||||
\n\
|
||||
/*@_fini_EPILOG_ENDS*/\n\
|
||||
\n\
|
||||
/*@TRAILER_BEGINS*/\
|
||||
");
|
Loading…
Reference in New Issue
Block a user