about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-02-08 15:25:07 +0100
committerAndreas Schwab <schwab@linux-m68k.org>2012-02-08 22:25:14 +0100
commitba988fc5638dcf4a70a84a79d9b6a47a12ff94a3 (patch)
tree6af60be8eebde3a51e14004206507a0ba84fed65 /sysdeps
parent26ecc33a0290293ff779f76ac0324381b6dfafda (diff)
downloadglibc-ba988fc5638dcf4a70a84a79d9b6a47a12ff94a3.tar.gz
glibc-ba988fc5638dcf4a70a84a79d9b6a47a12ff94a3.tar.xz
glibc-ba988fc5638dcf4a70a84a79d9b6a47a12ff94a3.zip
powerpc: add crt files
	* sysdeps/powerpc/powerpc32/crti.S: New file.
	* sysdeps/powerpc/powerpc32/crtn.S: New file.
	* sysdeps/powerpc/powerpc64/crti.S: New file.
	* sysdeps/powerpc/powerpc64/crtn.S: New file.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/powerpc/powerpc32/crti.S90
-rw-r--r--sysdeps/powerpc/powerpc32/crtn.S54
-rw-r--r--sysdeps/powerpc/powerpc64/crti.S107
-rw-r--r--sysdeps/powerpc/powerpc64/crtn.S52
4 files changed, 303 insertions, 0 deletions
diff --git a/sysdeps/powerpc/powerpc32/crti.S b/sysdeps/powerpc/powerpc32/crti.S
new file mode 100644
index 0000000000..72e9cf4ce0
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/crti.S
@@ -0,0 +1,90 @@
+/* Special .init and .fini section support for PowerPC.
+   Copyright (C) 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* 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
+
+#if PREINIT_FUNCTION_WEAK
+	weak_extern (PREINIT_FUNCTION)
+#else
+	.hidden PREINIT_FUNCTION
+#endif
+
+	.section .init,"ax",@progbits
+	.align	2
+	.globl	_init
+	.type	_init, @function
+_init:
+	stwu r1, -16(r1)
+	mflr r0
+	stw r0, 20(r1)
+	stw r30, 8(r1)
+	SETUP_GOT_ACCESS (r30, .Lgot_label_i)
+	addis r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@ha
+	addi r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@l
+#if PREINIT_FUNCTION_WEAK
+	lwz r0, PREINIT_FUNCTION@got(r30)
+	cmpwi cr7, r0, 0
+	beq+ cr7, 1f
+	bl PREINIT_FUNCTION@plt
+1:
+#else
+	bl PREINIT_FUNCTION@local
+#endif
+
+	.section .fini,"ax",@progbits
+	.align	2
+	.globl	_fini
+	.type	_fini, @function
+_fini:
+	stwu r1, -16(r1)
+	mflr r0
+	stw r0, 20(r1)
+	stw r30, 8(r1)
+	SETUP_GOT_ACCESS (r30, .Lgot_label_f)
diff --git a/sysdeps/powerpc/powerpc32/crtn.S b/sysdeps/powerpc/powerpc32/crtn.S
new file mode 100644
index 0000000000..af690c1260
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/crtn.S
@@ -0,0 +1,54 @@
+/* Special .init and .fini section support for PowerPC.
+   Copyright (C) 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+   corresponding to the prologues in crti.S. */
+
+#include <sysdep.h>
+
+	.section .init,"ax",@progbits
+	lwz r0, 20(r1)
+	mtlr r0
+	lwz r30, 8(r1)
+	addi r1, r1, 16
+	blr
+
+	.section .fini,"ax",@progbits
+	lwz r0, 20(r1)
+	mtlr r0
+	lwz r30, 8(r1)
+	addi r1, r1, 16
+	blr
diff --git a/sysdeps/powerpc/powerpc64/crti.S b/sysdeps/powerpc/powerpc64/crti.S
new file mode 100644
index 0000000000..bce256d9ca
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/crti.S
@@ -0,0 +1,107 @@
+/* Special .init and .fini section support for PowerPC64.
+   Copyright (C) 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* 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
+
+#if PREINIT_FUNCTION_WEAK
+	weak_extern (PREINIT_FUNCTION)
+#else
+	.hidden PREINIT_FUNCTION
+#endif
+
+#if PREINIT_FUNCTION_WEAK
+	.section ".toc", "aw"
+.LC0:
+	.tc PREINIT_FUNCTION[TC], PREINIT_FUNCTION
+#endif
+	.type BODY_LABEL (_init), @function
+	.globl _init
+	.section ".opd", "aw"
+	.align 3
+_init:	OPD_ENT (_init)
+#ifdef HAVE_ASM_GLOBAL_DOT_NAME
+	.globl BODY_LABEL (_init)
+	.size _init, 24
+#else
+	.type _init, @function
+#endif
+	.section ".init", "ax", @progbits
+	.align ALIGNARG (2)
+BODY_LABEL (_init):
+	mflr 0
+	std 0, 16(r1)
+	stdu r1, -112(r1)
+#if PREINIT_FUNCTION_WEAK
+	addis r9, r2, .LC0@toc@ha
+	ld r0, .LC0@toc@l(r9)
+	cmpdi cr7, r0, 0
+	beq+ cr7, 1f
+#endif
+	bl JUMPTARGET (PREINIT_FUNCTION)
+	nop
+1:
+
+	.type BODY_LABEL (_fini), @function
+	.globl _fini
+	.section ".opd", "aw"
+	.align 3
+_fini:	OPD_ENT (_fini)
+#ifdef HAVE_ASM_GLOBAL_DOT_NAME
+	.globl BODY_LABEL (_fini)
+	.size _fini, 24
+#else
+	.type _fini, @function
+#endif
+	.section ".fini", "ax", @progbits
+	.align ALIGNARG (2)
+BODY_LABEL (_fini):
+	mflr 0
+	std 0, 16(r1)
+	stdu r1, -112(r1)
diff --git a/sysdeps/powerpc/powerpc64/crtn.S b/sysdeps/powerpc/powerpc64/crtn.S
new file mode 100644
index 0000000000..52d46b3364
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/crtn.S
@@ -0,0 +1,52 @@
+/* Special .init and .fini section support for PowerPC64.
+   Copyright (C) 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* crtn.S puts function epilogues in the .init and .fini sections
+   corresponding to the prologues in crti.S. */
+
+#include <sysdep.h>
+
+	.section .init,"ax",@progbits
+	addi r1, r1, 112
+	ld r0, 16(r1)
+	mtlr r0
+	blr
+
+	.section .fini,"ax",@progbits
+	addi r1, r1, 112
+	ld r0, 16(r1)
+	mtlr r0
+	blr