about summary refs log tree commit diff
path: root/sysdeps/sparc64/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-06-29 22:05:27 +0000
committerUlrich Drepper <drepper@redhat.com>1997-06-29 22:05:27 +0000
commit5ae3e846b9e5dc0c32b581dff29aaf8587f89bfa (patch)
treed7042b5844f386c3843169e7bca1de968acfce5e /sysdeps/sparc64/elf
parentbca973bcd954bb43e0d55b6fe3dd0648df52466a (diff)
downloadglibc-5ae3e846b9e5dc0c32b581dff29aaf8587f89bfa.tar.gz
glibc-5ae3e846b9e5dc0c32b581dff29aaf8587f89bfa.tar.xz
glibc-5ae3e846b9e5dc0c32b581dff29aaf8587f89bfa.zip
1997-06-29 23:43  Ulrich Drepper  <drepper@cygnus.com>

	* config.make.in: Define need-nopic-initfini.
	* configure.in: Write out nopic_initfini.
	* csu/Makefile: Generate no-PIC crt code if need-nopic-initfini
	is defined.

	* sysdeps/i386/fpu/fraiseexcpt.c: Correct FE_INEXACT case.

	* sysdeps/sparc/rem.S: Get trap definition properly.
	* sysdeps/sparc/sdiv.S: Likewise.
	* sysdeps/sparc/udiv.S: Likewise.
	* sysdeps/sparc/urem.S: Likewise.
	* sysdeps/sparc/setjmp.S: Include <sys/trap.h>.
	* sysdeps/sparc/sys/trap.h: New file.
	* sysdeps/unix/sysv/linux/sparc/sys/trap.h: New file.

1997-06-25 10:26  Thorsten Kukuk  <kukuk@uni-paderborn.de>

	* sysdeps/generic/rpc/auth.h: Add xdr_opaque_auth declaration.

1997-06-29 10:34  Fila Kolodny  <fila@ibi.com>

	* sysdeps/mach/hurd/select.c (__select): Change MACH_MSG_SIZE_INTEGER_T
	to MACH_MSG_TYPE_INTEGER_T.

1997-06-29  01:04  Richard Henderson  <richard@gnu.ai.mit.edu>

	Initial sparc64-linux support:
	* configure.in: Recognize sparc64 as being different from sparc.
	* io/ftwtest-sh: Only invoke ld.so if it exists.
	* math/Makefile (LDLIBS-*): Change from libm to math/libm to get
	static tests to link.  Honour $(omit-long-double-fcts) == yes.
	* math/libm-test.c (test_single_exception): The argument to
	fetestexcept is `int' not `fexcept_t'.
	* shlib-versions: Recognize sparc64.
	* signal/signal.h: Add typedef for stack_t.

	* stdio-common/_itoa.c: Defaulting UMUL_TIME==UDIV_TIME is broken.
	Attempt to fix up most of this by cleaning up assumptions below,
	but give up and change the defaults.

	* setjmp/longjmp.c: Moved to ...
	* sysdeps/generic/longjmp.c: ... here.
	* setjmp/sigjmp.c: Moved to ...
	* sysdeps/generic/sigjmp.c: ... here.

	* sysdeps/sparc/bsd-_setjmp.S [PIC]: There wasn't even valid asm here.
	Ought to fix up gas to catch these silly things properly.
	* sysdeps/sparc/bsd-setjmp.S: Likewise.

	* sysdeps/unix/sysv/linux/sparc/errno.c: Remove.
	* sysdeps/unix/sysv/linux/sparc/kernel_sigaction.h: Remove.
	* sysdeps/unix/sysv/linux/sparc/kernel_stat.h: Tell xstat about
	the unused fields.

	* sysdeps/sparc/sparc64/add_n.s: Moved to ...
	* sysdeps/sparc64/add_n.S: ... here.  Fix up %g4 and stack usage.
	* sysdeps/sparc/sparc64/addmul_1.s: Likewise.
	* sysdeps/sparc/sparc64/gmp-mparam.h: Likewise.
	* sysdeps/sparc/sparc64/lshift.s: Likewise.
	* sysdeps/sparc/sparc64/mul_1.s: Likewise.
	* sysdeps/sparc/sparc64/rshift.s: Likewise.
	* sysdeps/sparc/sparc64/sub_n.s: Likewise.
	* sysdeps/sparc/sparc64/submul_1.s: Likewise.

	* sysdeps/sparc64/Implies: New file.
	* sysdeps/sparc64/Makefile: Likewise.
	* sysdeps/sparc64/bits/endian.h: Likewise.
	* sysdeps/sparc64/bsd-_setjmp.S: Likewise.
	* sysdeps/sparc64/bsd-setjmp.S: Likewise.
	* sysdeps/sparc64/dl-machine.h: Likewise.
	* sysdeps/sparc64/elf/Makefile: Likewise.
	* sysdeps/sparc64/elf/crtbegin.S: Likewise.
	* sysdeps/sparc64/elf/crtbeginS.S: Likewise.
	* sysdeps/sparc64/elf/crtend.S: Likewise.
	* sysdeps/sparc64/elf/crtendS.S: Likewise.
	* sysdeps/sparc64/elf/start.S: Likewise.
	* sysdeps/sparc64/fpu_control.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/__longjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/bits/setjmp.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/bits/types.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/brk.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/fork.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/getcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/init-first.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/kernel_stat.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/longjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/pipe.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/profil-counter.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/setcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/setjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/sigjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc64/ucontext.h: Likewise.

1997-06-28 16:28  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* configure.in: Add -nostartfiles -nostdlib when check for
	--version-script.

1997-06-28 12:03  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* sysdeps/powerpc/bits/endian.h: New file.

1997-06-28 20:52  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/syscalls.list: Add getresgid and
	setresgid.
Diffstat (limited to 'sysdeps/sparc64/elf')
-rw-r--r--sysdeps/sparc64/elf/Makefile10
-rw-r--r--sysdeps/sparc64/elf/crtbegin.S49
-rw-r--r--sysdeps/sparc64/elf/crtbeginS.S1
-rw-r--r--sysdeps/sparc64/elf/crtend.S50
-rw-r--r--sysdeps/sparc64/elf/crtendS.S1
-rw-r--r--sysdeps/sparc64/elf/start.S93
6 files changed, 204 insertions, 0 deletions
diff --git a/sysdeps/sparc64/elf/Makefile b/sysdeps/sparc64/elf/Makefile
new file mode 100644
index 0000000000..1b38355b38
--- /dev/null
+++ b/sysdeps/sparc64/elf/Makefile
@@ -0,0 +1,10 @@
+# The assembler on SPARC needs the -fPIC flag even when it's assembler code.
+ASFLAGS-.so = -fPIC
+
+ifeq ($(subdir), csu)
+extra-objs += crtbegin.o crtend.o crtbeginS.o crtendS.o
+install-lib += crtbegin.o crtend.o crtbeginS.o crtendS.o
+
+CPPFLAGS-crtbeginS.S = -fPIC -DPIC
+CPPFLAGS-crtendS.S = -fPIC -DPIC
+endif
diff --git a/sysdeps/sparc64/elf/crtbegin.S b/sysdeps/sparc64/elf/crtbegin.S
new file mode 100644
index 0000000000..fbd731cad0
--- /dev/null
+++ b/sysdeps/sparc64/elf/crtbegin.S
@@ -0,0 +1,49 @@
+.section ".ctors",#alloc,#write
+
+	.align 8
+__CTOR_LIST__:
+	.xword	-1
+
+.section ".dtors",#alloc,#write
+
+	.align 8
+__DTOR_LIST__:
+	.xword	-1
+
+.section ".fini",#alloc,#execinstr
+
+	call	__do_global_dtors_aux
+	 nop
+
+.text
+
+	.align 4
+	.type __do_global_dtors_aux,#function
+__do_global_dtors_aux:
+	save	%sp,-160,%sp
+
+#ifdef PIC
+1:	rd	%pc, %g1
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
+	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
+	add	%l7, %g1, %l7
+	sethi	%hi(__DTOR_LIST__), %l0
+	or	%l0, %lo(__DTOR_LIST__), %l0
+	ldx	[%l7+%l0], %l0
+#else
+	sethi	%hi(__DTOR_LIST__), %l0
+	or	%l0, %lo(__DTOR_LIST__), %l0
+	add	%l0, %g4, %l0
+#endif
+
+	ba	3f
+	 ldx	[%l0+8], %l1
+2:	jmpl	%l1, %o7
+	 ldx	[%l0+8], %l1
+3:	brnz,pt	%l1, 2b
+	 add	%l0, 8, %l0
+
+	ret
+	 restore
+
+	.size __do_global_dtors_aux,.-__do_global_dtors_aux
diff --git a/sysdeps/sparc64/elf/crtbeginS.S b/sysdeps/sparc64/elf/crtbeginS.S
new file mode 100644
index 0000000000..7db4bc590e
--- /dev/null
+++ b/sysdeps/sparc64/elf/crtbeginS.S
@@ -0,0 +1 @@
+#include "crtbegin.S"
diff --git a/sysdeps/sparc64/elf/crtend.S b/sysdeps/sparc64/elf/crtend.S
new file mode 100644
index 0000000000..ea69083d69
--- /dev/null
+++ b/sysdeps/sparc64/elf/crtend.S
@@ -0,0 +1,50 @@
+.section ".ctors",#alloc,#write
+
+	.align 8
+__CTOR_END__:
+	.xword	0
+
+.section ".dtors",#alloc,#write
+
+	.align 8
+__DTOR_END__:
+	.xword	0
+
+.section ".init",#alloc,#execinstr
+
+	call	__do_global_ctors_aux
+	 nop
+
+.text
+
+	.align 4
+	.type __do_global_ctors_aux,#function
+__do_global_ctors_aux:
+	save	%sp,-160,%sp
+
+#ifdef PIC
+1:	rd	%pc, %g1
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
+	or	%l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
+	add	%l7, %g1, %l7
+	sethi	%hi(__CTOR_END__), %l0
+	or	%l0, %lo(__CTOR_END__), %l0
+	ldx	[%l7+%l0], %l0
+#else
+	sethi	%hi(__CTOR_END__), %l0
+	or	%l0, %lo(__CTOR_END__), %l0
+	add	%l0, %g4, %l0
+#endif
+
+	ba	3f
+	 ldx	[%l0+8], %l1
+2:	jmpl	%l1, %o7
+	 ldx	[%l0+8], %l1
+3:	addcc	%l1, 1, %g0
+	bnz,pt	%xcc, 2b
+	 add	%l0, 8, %l0
+
+	ret
+	 restore
+
+	.size __do_global_ctors_aux,.-__do_global_ctors_aux
diff --git a/sysdeps/sparc64/elf/crtendS.S b/sysdeps/sparc64/elf/crtendS.S
new file mode 100644
index 0000000000..56532f567d
--- /dev/null
+++ b/sysdeps/sparc64/elf/crtendS.S
@@ -0,0 +1 @@
+#include "crtend.S"
diff --git a/sysdeps/sparc64/elf/start.S b/sysdeps/sparc64/elf/start.S
new file mode 100644
index 0000000000..334f85b129
--- /dev/null
+++ b/sysdeps/sparc64/elf/start.S
@@ -0,0 +1,93 @@
+/* Startup code for elf64-sparc
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+   Cambridge, MA 02139, USA.  */
+
+#include <sysdep.h>
+
+
+	.section ".text"
+	.align 4
+	.global _start
+	.type _start,#function
+_start:
+
+  /* First order of business is to load %g4 with our base address.  */
+	sethi	%uhi(_start), %g4
+	or	%g4, %ulo(_start), %g4
+	sllx	%g4, 32, %g4
+
+  /* Terminate the stack frame, and reserve space for functions to
+     drop their arguments.  */
+	mov	%g0, %fp
+	sub	%sp, 6*8, %sp
+
+  /* Save %g1.  When starting a binary via the dynamic linker, %g1
+     contains the address of the shared library termination function,
+     which we will register below with atexit() to be called by exit().
+     If we are statically linked, this will be NULL.  */
+
+  /* Do essential libc initialization (sp points to argc, argv, and envp)  */
+	call	__libc_init_first
+	 mov	%g1, %l0
+
+  /* Now that we have the proper stack frame, register library termination
+     function, if there is any:  */
+
+	brz,pn	%l0, 1f
+	 nop
+	call	atexit
+	 mov	%l0, %o0
+1:
+
+  /* Extract the arguments and environment as encoded on the stack.  The
+     argument info starts after one register window (16 words) past the SP,
+     plus the bias we added, plus the magic v9 STACK_BIAS.  */
+	ldx	[%sp+STACK_BIAS+22*8], %o0
+	add	%sp, STACK_BIAS+23*8, %o1
+	sllx	%o0, 3, %o2
+	add	%o2, %o1, %o2
+	sethi	%hi(__environ), %g2
+	add	%o2, 8, %o2
+	add	%g2, %g4, %g2
+	stx	%o2, [%g2+%lo(__environ)]
+
+	mov	%o0, %l0		/* tuck them away */
+	mov	%o1, %l1
+
+  /* Call _init, the entry point to our own .init section.  */
+	call	_init
+	 mov	%o2, %l2
+
+  /* Register our .fini section with atexit.  */
+	sethi	%hi(_fini), %o0
+	add	%o0, %g4, %o0
+	call	atexit
+	 add	%o0, %lo(_fini), %o0
+
+  /* Call the user's main and exit with its return value.  */
+	mov	%l0, %o0
+	mov	%l1, %o1
+	call	main
+	 mov	%l2, %o2
+	call	exit
+	 nop
+
+  /* Die very horribly if exit returns.  */
+	illtrap	0
+
+	.size _start,.-_start