aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config/i386/sol2-c1.S
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2011-06-01 14:39:17 +0000
committerRainer Orth <ro@gcc.gnu.org>2011-06-01 14:39:17 +0000
commitca24c5ad7371a5b1947ccd01d4b163d666179669 (patch)
treedc80a01f55c46d4ecd769e8fd03fb169ba2688e2 /libgcc/config/i386/sol2-c1.S
parentce4fc506085489152bce27da53f172c4681ae450 (diff)
downloadgcc-ca24c5ad7371a5b1947ccd01d4b163d666179669.zip
gcc-ca24c5ad7371a5b1947ccd01d4b163d666179669.tar.gz
gcc-ca24c5ad7371a5b1947ccd01d4b163d666179669.tar.bz2
t-slibgcc-darwin: Move to ...
gcc: * config/t-slibgcc-darwin: Move to ... * config/t-slibgcc-dummy: .. this. Clarify comments. * config.gcc (i[34567]86-*-darwin*, x86_64-*-darwin*, powerpc-*-darwin*, powerpc64-*-darwin*): Reflect this. (i[3456x]86-*-netware*): Add t-slibgcc-dummy to tmake_file. (i[34567]86-*-rtems*): Remove extra_parts. Use i386/t-rtems. Remove i386/t-crtstuff from tmake_file. (i[34567]86-*-solaris2*): Remove t-svr4, t-slibgcc-elf-ver, t-slibgcc-sld from tmake_file, add t-slibgcc-dummy. (sparc-*-elf*, sparc64-*-elf*): Remove tmake_file, extra_parts. (sparc-*-rtems*, sparc64-*-rtems*): Remove sparc/t-crtin, sparc/t-crtfm from tmake_file. (sparc*-*-solaris2*): Remove sparc/t-sol2, sparc/t-crtfm, t-slibgcc-elf-ver, t-slibgcc-sld, add t-slibgcc-dummy. Remove extra_parts. * config/t-sol2 (TARGET_LIBGCC2_CFLAGS): Define. * config/i386/t-nwld (SHLIB_LINK): Remove. * config/i386/t-rtems-i386: Rename to ... * config/i386/t-rtems: ... this. ($(T)crti.o, $(T)crtn.o): Remove. (FPBIT, DPBIT, LIB2FUNCS_EXTRA): Remove. (dp-bit.c, fp-bit.c, xp-bit.c): Remove. (EXTRA_MULTILIB_PARTS, LIBGCC, INSTALL_LIBGCC): Remove. * config/i386/t-sol2-10 (LIBGCC, INSTALL_LIBGCC, EXTRA_MULTILIB_PARTS): Remove. * config/sparc/t-sol2-64: Likewise. * config/sparc/t-sol2: Remove. * config/sparc/t-crtin: Remove. * config/sparc/gmon-sol2.c: Move to ../libgcc/config. * config/i386/gmon-sol2.c: Remove. * config/i386/sol2-c1.asm: Move to ../libgcc/config/i386/sol2-c1.S. * config/i386/sol2-ci.asm: Move to ../libgcc/config/i386/sol2-ci.S. * config/i386/sol2-cn.asm: Move to ../libgcc/config/i386/sol2-cn.S. * config/i386/sol2-gc1.asm: Remove. * config/sparc/sol2-c1.asm: Move to ../libgcc/config/sparc/sol2-c1.S. * config/sparc/sol2-ci.asm: Move to ../libgcc/config/sparc/sol2-ci.S. * config/sparc/sol2-cn.asm: Move to ../libgcc/config/sparc/sol2-cn.S. * config/t-slibgcc-sld: Remove. libgcc: * Makefile.in (cpu_type): Define. * config.host (i[34567]86-*-rtems*): Handle it. (i[34567]86-*-solaris2*): Move body ... (*-*-solaris2*): ... here. New case, generalize. (sparc-*-elf*): Handle it. (sparc-*-linux*, sparc64-*-linux*): Replace sparc/t-crtfm by t-crtfm. (sparc-*-rtems*, sparc64-*-rtems*); Handle it. (sparc64-*-solaris2*, sparcv9-*-solaris2*, sparc-*-solaris2*): Fold into ... (sparc*-*-solaris2*): ... this. New case. (sparc64-*-elf*): Handle it. * config/gmon-sol2.c: Move from ../gcc/config/sparc. Merge ../gcc/config/i386/gmon-sol2.c. * config/i386/sol2-c1.S: Move from ../gcc/config/i386/sol2-c1.asm. Use C comments. Merge ../gcc/config/i386/sol2-gc1.asm. * config/i386/sol2-ci.S: Move from ../gcc/config/i386/sol2-ci.asm. Use C comments. * config/i386/sol2-cn.S: Move from ../gcc/config/i386/sol2-cn.asm. Use C comments. * config/i386/t-crtfm (crtfastmath.o): Use $<. * config/i386/t-crtstuff: New file. * config/i386/t-softfp: New file. * config/i386/t-sol2 ($(T)gmon.o, $(T)gcrt1.o, $(T)crt1.o), $(T)crti.o, $(T)crtn.o): Remove. (gcrt1.o): New rule. (TARGET_LIBGCC2_CFLAGS): Remove. * config/sparc/sol2-c1.S: Move from ../gcc/config/sparc/sol2-c1.asm. * config/sparc/sol2-ci.S: Move from ../gcc/config/sparc/sol2-ci.asm. * config/sparc/sol2-cn.S: Move from ../gcc/config/sparc/sol2-cn.asm. * config/sparc/t-sol2: New file. * config/sparc/t-crtfm: Move to ... * config/t-crtfm: ... this. Use $(cpu_type), $<. * config/t-crtin: New file. * config/sparc/t-softfp: New file. * config/sparc/t-softmul: New file. * config/t-rtems: New file. * config/t-slibgcc: New file. * config/t-slibgcc-elf-ver: New file. * config/t-slibgcc-gld: New file. * config/t-slibgcc-sld: New file. * config/t-sol2: New file. * configure.ac: Include ../config/lib-ld.m4. Call AC_LIB_PROG_LD_GNU. Substitute cpu_type. * configure: Regenerate. From-SVN: r174529
Diffstat (limited to 'libgcc/config/i386/sol2-c1.S')
-rw-r--r--libgcc/config/i386/sol2-c1.S173
1 files changed, 173 insertions, 0 deletions
diff --git a/libgcc/config/i386/sol2-c1.S b/libgcc/config/i386/sol2-c1.S
new file mode 100644
index 0000000..b2e473f
--- /dev/null
+++ b/libgcc/config/i386/sol2-c1.S
@@ -0,0 +1,173 @@
+/* crt1.s for Solaris 2, x86
+
+ Copyright (C) 1993, 1998, 2008, 2009, 2011 Free Software Foundation, Inc.
+ Written By Fred Fish, Nov 1992
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+This file 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
+General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+
+/* This file takes control of the process from the kernel, as specified
+ in section 3 of the System V Application Binary Interface, Intel386
+ Processor Supplement. It has been constructed from information obtained
+ from the ABI, information obtained from single stepping existing
+ Solaris executables through their startup code with gdb, and from
+ information obtained by single stepping executables on other i386 SVR4
+ implementations. This file is the first thing linked into any
+ executable. */
+
+#ifndef GCRT1
+ .ident "GNU C crt1.s"
+#define CLEANUP _cleanup
+#else
+/* This is a modified crt1.s by J.W.Hawtin <oolon@ankh.org> 15/8/96,
+ to allow program profiling, by calling monstartup on entry and _mcleanup
+ on exit. */
+ .ident "GNU C gcrt1.s"
+#define CLEANUP _mcleanup
+#endif
+ .weak _cleanup
+ .weak _DYNAMIC
+ .text
+
+/* Start creating the initial frame by pushing a NULL value for the return
+ address of the initial frame, and mark the end of the stack frame chain
+ (the innermost stack frame) with a NULL value, per page 3-32 of the ABI.
+ Initialize the first stack frame pointer in %ebp (the contents of which
+ are unspecified at process initialization). */
+
+ .globl _start
+_start:
+ pushl $0x0
+ pushl $0x0
+ movl %esp,%ebp
+
+/* As specified per page 3-32 of the ABI, %edx contains a function
+ pointer that should be registered with atexit(), for proper
+ shared object termination. Just push it onto the stack for now
+ to preserve it. We want to register _cleanup() first. */
+
+ pushl %edx
+
+/* Check to see if there is an _cleanup() function linked in, and if
+ so, register it with atexit() as the last thing to be run by
+ atexit(). */
+
+ movl $CLEANUP,%eax
+ testl %eax,%eax
+ je .L1
+ pushl $CLEANUP
+ call atexit
+ addl $0x4,%esp
+.L1:
+
+/* Now check to see if we have an _DYNAMIC table, and if so then
+ we need to register the function pointer previously in %edx, but
+ now conveniently saved on the stack as the argument to pass to
+ atexit(). */
+
+ movl $_DYNAMIC,%eax
+ testl %eax,%eax
+ je .L2
+ call atexit
+.L2:
+
+/* Register _fini() with atexit(). We will take care of calling _init()
+ directly. */
+
+ pushl $_fini
+ call atexit
+
+#ifdef GCRT1
+/* Start profiling. */
+
+ pushl %ebp
+ movl %esp,%ebp
+ pushl $_etext
+ pushl $_start
+ call monstartup
+ addl $8,%esp
+ popl %ebp
+#endif
+
+/* Compute the address of the environment vector on the stack and load
+ it into the global variable _environ. Currently argc is at 8 off
+ the frame pointer. Fetch the argument count into %eax, scale by the
+ size of each arg (4 bytes) and compute the address of the environment
+ vector which is 16 bytes (the two zero words we pushed, plus argc,
+ plus the null word terminating the arg vector) further up the stack,
+ off the frame pointer (whew!). */
+
+ movl 8(%ebp),%eax
+ leal 16(%ebp,%eax,4),%edx
+ movl %edx,_environ
+
+/* Push the environment vector pointer, the argument vector pointer,
+ and the argument count on to the stack to set up the arguments
+ for _init(), _fpstart(), and main(). Note that the environment
+ vector pointer and the arg count were previously loaded into
+ %edx and %eax respectively. The only new value we need to compute
+ is the argument vector pointer, which is at a fixed address off
+ the initial frame pointer. */
+
+/* Make sure the stack is properly aligned. */
+ andl $0xfffffff0,%esp
+ subl $4,%esp
+
+ pushl %edx
+ leal 12(%ebp),%edx
+ pushl %edx
+ pushl %eax
+
+/* Call _init(argc, argv, environ), _fpstart(argc, argv, environ), and
+ main(argc, argv, environ). */
+
+ call _init
+ call __fpstart
+ call main
+
+/* Pop the argc, argv, and environ arguments off the stack, push the
+ value returned from main(), and call exit(). */
+
+ addl $12,%esp
+ pushl %eax
+ call exit
+
+/* An inline equivalent of _exit, as specified in Figure 3-26 of the ABI. */
+
+ pushl $0x0
+ movl $0x1,%eax
+ lcall $7,$0
+
+/* If all else fails, just try a halt! */
+
+ hlt
+ .type _start,@function
+ .size _start,.-_start
+
+#ifndef GCRT1
+/* A dummy profiling support routine for non-profiling executables,
+ in case we link in some objects that have been compiled for profiling. */
+
+ .weak _mcount
+_mcount:
+ ret
+ .type _mcount,@function
+ .size _mcount,.-_mcount
+#endif