Commit ee8d66f7 by Richard Henderson Committed by Richard Henderson

configure.in (alpha-linux*, [...]): Add crtbeginS.o and crtendS.o.

        * configure.in (alpha-linux*, alpha-netbsd) [extra_parts]:
        Add crtbeginS.o and crtendS.o.
        * alpha/elf.h (STARTFILE_SPEC): Use crtbeginS.o.
        (ENDFILE_SPEC): Use crtendS.o.
        * alpha/t-crtbe (crtbeginS.o, crtendS.o): New targets.

        * alpha/crtbegin.asm (__do_frame_takedown): Merge into ...
        (__do_global_dtors_aux): ... here.  Call __cxa_finalize if
        shared and present.
        (__dso_handle): New variable.
        * alpha/crtend.asm (__do_global_ctors_aux): Remove runtime
        bias to __CTOR_END__.

From-SVN: r32033
parent 3fbfa9f6
2000-02-16 Richard Henderson <rth@cygnus.com> 2000-02-16 Richard Henderson <rth@cygnus.com>
* configure.in (alpha-linux*, alpha-netbsd) [extra_parts]:
Add crtbeginS.o and crtendS.o.
* alpha/elf.h (STARTFILE_SPEC): Use crtbeginS.o.
(ENDFILE_SPEC): Use crtendS.o.
* alpha/t-crtbe (crtbeginS.o, crtendS.o): New targets.
* alpha/crtbegin.asm (__do_frame_takedown): Merge into ...
(__do_global_dtors_aux): ... here. Call __cxa_finalize if
shared and present.
(__dso_handle): New variable.
* alpha/crtend.asm (__do_global_ctors_aux): Remove runtime
bias to __CTOR_END__.
2000-02-16 Richard Henderson <rth@cygnus.com>
* Makefile.in (s-crtS, crtbeginS, crtendS): Prefix usage with $(T). * Makefile.in (s-crtS, crtbeginS, crtendS): Prefix usage with $(T).
Wed Feb 16 21:40:04 2000 Hans-Peter Nilsson <hp@bitrange.com> Wed Feb 16 21:40:04 2000 Hans-Peter Nilsson <hp@bitrange.com>
......
...@@ -69,11 +69,6 @@ __EH_FRAME_BEGIN__: ...@@ -69,11 +69,6 @@ __EH_FRAME_BEGIN__:
1: ldgp $29,0($29) 1: ldgp $29,0($29)
jsr $26,__do_global_dtors_aux jsr $26,__do_global_dtors_aux
# Ideally this call would go in crtend.o, except that we can't
# get hold of __EH_FRAME_BEGIN__ there.
jsr $26,__do_frame_takedown
# Must match the alignment we got from crti.o else we get # Must match the alignment we got from crti.o else we get
# zero-filled holes in our _fini function and then SIGILL. # zero-filled holes in our _fini function and then SIGILL.
.align 3 .align 3
...@@ -92,10 +87,29 @@ __EH_FRAME_BEGIN__: ...@@ -92,10 +87,29 @@ __EH_FRAME_BEGIN__:
# Invoke our destructors in order. # Invoke our destructors in order.
# #
.data .section .sdata
# Support recursive calls to exit. # Support recursive calls to exit.
$ptr: .quad __DTOR_LIST__ .type dtor_ptr,@object
.size dtor_ptr,8
dtor_ptr:
.quad __DTOR_LIST__ + 8
# A globally unique widget for c++ local destructors to hang off.
.global __dso_handle
.type __dso_handle,@object
.size __dso_handle,8
#ifdef SHARED
.section .data
.align 3
__dso_handle:
.quad __dso_handle
#else
.section .bss
.align 3
__dso_handle:
.zero 8
#endif
.text .text
...@@ -103,23 +117,41 @@ $ptr: .quad __DTOR_LIST__ ...@@ -103,23 +117,41 @@ $ptr: .quad __DTOR_LIST__
.ent __do_global_dtors_aux .ent __do_global_dtors_aux
__do_global_dtors_aux: __do_global_dtors_aux:
ldgp $29,0($27)
lda $30,-16($30) lda $30,-16($30)
.frame $30,16,$26,0 .frame $30,16,$26,0
stq $9,8($30) stq $9,8($30)
stq $26,0($30) stq $26,0($30)
.mask 0x4000200,-16 .mask 0x4000200,-16
.prologue 0 .prologue 1
lda $9,$ptr #ifdef SHARED
br 1f # Do c++ local destructors.
0: stq $1,0($9) lda $1,__cxa_finalize
beq $1,0f
lda $16,__dso_handle
jsr $26,__cxa_finalize
ldgp $29,0($26)
#endif
0: lda $9,dtor_ptr
br 2f
1: stq $1,0($9)
jsr $26,($27) jsr $26,($27)
1: ldq $1,0($9) ldgp $29,0($26)
ldq $27,8($1) 2: ldq $1,0($9)
ldq $27,0($1)
addq $1,8,$1 addq $1,8,$1
bne $27,0b bne $27,1b
ldq $26,0($30) # Remove our frame info.
lda $1,__deregister_frame_info
beq $1,3f
lda $16,__EH_FRAME_BEGIN__
jsr $26,__deregister_frame_info
ldgp $29,0($26)
3: ldq $26,0($30)
ldq $9,8($30) ldq $9,8($30)
lda $30,16($30) lda $30,16($30)
ret ret
...@@ -133,11 +165,11 @@ __do_global_dtors_aux: ...@@ -133,11 +165,11 @@ __do_global_dtors_aux:
# ??? How can we rationally keep this size correct? # ??? How can we rationally keep this size correct?
.section .bss .section .bss
.type $object,@object .type frame_object,@object
.size frame_object, 48
.align 3 .align 3
$object: frame_object:
.zero 48 .zero 48
.size $object, 48
.text .text
...@@ -155,38 +187,18 @@ __do_frame_setup: ...@@ -155,38 +187,18 @@ __do_frame_setup:
lda $1,__register_frame_info lda $1,__register_frame_info
beq $1,0f beq $1,0f
lda $16,__EH_FRAME_BEGIN__ lda $16,__EH_FRAME_BEGIN__
lda $17,$object lda $17,frame_object
jsr $26,__register_frame_info jsr $26,__register_frame_info
ldq $26,0($30) ldgp $29,0($26)
0: lda $30,16($30)
ret
.end __do_frame_setup
#
# Remove our frame info.
#
.align 3
.ent __do_frame_takedown
__do_frame_takedown:
ldgp $29,0($27)
lda $30,-16($30)
.frame $30,16,$26,0
stq $26,0($30)
.mask 0x4000000,-16
.prologue 1
lda $1,__deregister_frame_info
beq $1,0f
lda $16,__EH_FRAME_BEGIN__
jsr $26,__deregister_frame_info
ldq $26,0($30) ldq $26,0($30)
0: lda $30,16($30) 0: lda $30,16($30)
ret ret
.end __do_frame_takedown .end __do_frame_setup
.weak __register_frame_info .weak __register_frame_info
.weak __deregister_frame_info .weak __deregister_frame_info
#ifdef SHARED
.weak __cxa_finalize
#endif
...@@ -92,10 +92,10 @@ __do_global_ctors_aux: ...@@ -92,10 +92,10 @@ __do_global_ctors_aux:
.mask 0x4000200,-16 .mask 0x4000200,-16
.prologue 1 .prologue 1
lda $9,__CTOR_END__ lda $9,__CTOR_END__-8
br 1f br 1f
0: jsr $26,($27) 0: jsr $26,($27)
1: ldq $27,-8($9) 1: ldq $27,0($9)
subq $9,8,$9 subq $9,8,$9
not $27,$0 not $27,$0
bne $0,0b bne $0,0b
......
...@@ -507,19 +507,18 @@ void FN () \ ...@@ -507,19 +507,18 @@ void FN () \
/* Provide a STARTFILE_SPEC appropriate for ELF. Here we add the /* Provide a STARTFILE_SPEC appropriate for ELF. Here we add the
(even more) magical crtbegin.o file which provides part of the (even more) magical crtbegin.o file which provides part of the
support for getting C++ file-scope static object constructed before support for getting C++ file-scope static object constructed
entering `main'. before entering `main'.
Don't bother seeing crtstuff.c -- there is absolutely no hope of Don't bother seeing crtstuff.c -- there is absolutely no hope
getting that file to understand multiple GPs. GNU Libc provides a of getting that file to understand multiple GPs. We provide a
hand-coded version that is used on Linux; it could be copied here hand-coded assembly version. */
if there is ever a need. */
#undef STARTFILE_SPEC #undef STARTFILE_SPEC
#define STARTFILE_SPEC \ #define STARTFILE_SPEC \
"%{!shared: \ "%{!shared: \
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
crti.o%s crtbegin.o%s" crti.o%s %{shared:crtbeginS.o%s}%{!shared:crtbegin.o%s}"
/* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
magical crtend.o file which provides part of the support for magical crtend.o file which provides part of the support for
...@@ -528,7 +527,7 @@ void FN () \ ...@@ -528,7 +527,7 @@ void FN () \
#undef ENDFILE_SPEC #undef ENDFILE_SPEC
#define ENDFILE_SPEC \ #define ENDFILE_SPEC \
"crtend.o%s crtn.o%s" "%{shared:crtendS.o%s}%{!shared:crtend.o%s} crtn.o%s"
/* We support #pragma. */ /* We support #pragma. */
#define HANDLE_SYSV_PRAGMA #define HANDLE_SYSV_PRAGMA
......
...@@ -3,7 +3,10 @@ T = disable ...@@ -3,7 +3,10 @@ T = disable
# Assemble startup files. # Assemble startup files.
crtbegin.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES) crtbegin.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler $(srcdir)/config/alpha/crtbegin.asm $(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler-with-cpp $(srcdir)/config/alpha/crtbegin.asm
crtend.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES) crtend.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crtend.o -x assembler $(srcdir)/config/alpha/crtend.asm $(GCC_FOR_TARGET) -c -o crtend.o -x assembler-with-cpp $(srcdir)/config/alpha/crtend.asm
crtbeginS.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -DSHARED -c -o crtbeginS.o -x assembler-with-cpp $(srcdir)/config/alpha/crtbegin.asm
crtendS.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -DSHARED -c -o crtendS.o -x assembler-with-cpp $(srcdir)/config/alpha/crtend.asm
...@@ -620,7 +620,7 @@ changequote([,])dnl ...@@ -620,7 +620,7 @@ changequote([,])dnl
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h" tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
target_cpu_default="MASK_GAS" target_cpu_default="MASK_GAS"
tmake_file="t-linux t-linux-gnulibc1 alpha/t-linux alpha/t-crtbe alpha/t-ieee" tmake_file="t-linux t-linux-gnulibc1 alpha/t-linux alpha/t-crtbe alpha/t-ieee"
extra_parts="crtbegin.o crtend.o" extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
xmake_file=none xmake_file=none
gas=yes gnu_ld=yes gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then if test x$enable_threads = xyes; then
...@@ -631,7 +631,7 @@ changequote([,])dnl ...@@ -631,7 +631,7 @@ changequote([,])dnl
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h" tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
target_cpu_default="MASK_GAS" target_cpu_default="MASK_GAS"
tmake_file="t-linux alpha/t-linux alpha/t-crtbe alpha/t-ieee" tmake_file="t-linux alpha/t-linux alpha/t-crtbe alpha/t-ieee"
extra_parts="crtbegin.o crtend.o" extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
xmake_file=none xmake_file=none
gas=yes gnu_ld=yes gas=yes gnu_ld=yes
if test x$enable_threads = xyes; then if test x$enable_threads = xyes; then
...@@ -642,7 +642,7 @@ changequote([,])dnl ...@@ -642,7 +642,7 @@ changequote([,])dnl
tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h" tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h"
target_cpu_default="MASK_GAS" target_cpu_default="MASK_GAS"
tmake_file="alpha/t-crtbe alpha/t-ieee" tmake_file="alpha/t-crtbe alpha/t-ieee"
extra_parts="crtbegin.o crtend.o" extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
xmake_file=none xmake_file=none
gas=yes gnu_ld=yes gas=yes gnu_ld=yes
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment