Browse Source

* removed aout entries

peter 26 years ago
parent
commit
77af080111
4 changed files with 88 additions and 131 deletions
  1. 33 20
      rtl/linux/i386/cprt0.as
  2. 25 15
      rtl/linux/i386/gprt0.as
  3. 30 15
      rtl/linux/i386/prt0.as
  4. 0 81
      rtl/linux/i386/prt1.as

+ 33 - 20
rtl/linux/i386/gprt1.as → rtl/linux/i386/cprt0.as

@@ -13,14 +13,13 @@
 #
 #
 #**********************************************************************}
 #**********************************************************************}
 #
 #
-# Linux ELF startup code with profiling support for Free Pascal
-# Note: Needs linking with -lgmon and -lc
+# Linux ELF startup code for Free Pascal
 #
 #
 
 
-        .file   "gprt1.as"
+        .file   "prt1.as"
         .text
         .text
-        .globl _start
-        .type _start,@function
+        .globl  _start
+        .type   _start,@function
 _start:
 _start:
         /* First locate the start of the environment variables */
         /* First locate the start of the environment variables */
         popl    %ecx
         popl    %ecx
@@ -35,20 +34,27 @@ _start:
         movl    %ecx,U_SYSLINUX_ARGC    /* Move the argument counter    */
         movl    %ecx,U_SYSLINUX_ARGC    /* Move the argument counter    */
         movl    %ebx,U_SYSLINUX_ARGV    /* Move the argument pointer    */
         movl    %ebx,U_SYSLINUX_ARGV    /* Move the argument pointer    */
 
 
-        finit                           /* initialize fpu */
-        fwait
-        fldcw   ___fpucw
+        movl    %eax,__environ          /* libc environ */
 
 
-        pushl   $_etext                 /* Initialize gmon */
-        pushl   $_start
-        call    monstartup
-        addl    $8,%esp
-        pushl   $_mcleanup
+        pushl   %eax
+        pushl   %ebx
+        pushl   %ecx
+
+        call    __libc_init             /* init libc */
+        movzwl  __fpu_control,%eax
+        pushl   %eax
+        call    __setfpucw
+        addl    $4,%esp
+        pushl   $_fini
         call    atexit
         call    atexit
         addl    $4,%esp
         addl    $4,%esp
+        call    _init
+
+        popl    %eax
+        popl    %eax
 
 
         xorl    %ebp,%ebp
         xorl    %ebp,%ebp
-        call    PASCALMAIN
+        call    PASCALMAIN              /* start the program */
 
 
         .globl _haltproc
         .globl _haltproc
         .type _haltproc,@function
         .type _haltproc,@function
@@ -67,8 +73,6 @@ _haltproc:
 
 
 .data
 .data
         .align  4
         .align  4
-___fpucw:
-        .long   0x1332
 
 
         .globl  ___fpc_brk_addr         /* heap management */
         .globl  ___fpc_brk_addr         /* heap management */
         .type   ___fpc_brk_addr,@object
         .type   ___fpc_brk_addr,@object
@@ -82,15 +86,24 @@ ___fpc_brk_addr:
 __curbrk:
 __curbrk:
         .long   0
         .long   0
 
 
+        .globl  __environ
+        .type   __environ,@object
+        .size   __environ,4
+__environ:
+        .long   0
+
 #
 #
 # $Log$
 # $Log$
-# Revision 1.5  1998-11-04 10:16:27  peter
+# Revision 1.1  1999-11-08 23:07:48  peter
+#   * removed aout entries
+#
+# Revision 1.3  1998/11/04 10:16:25  peter
 #   + xorl ebp,ebp to indicate end of backtrace
 #   + xorl ebp,ebp to indicate end of backtrace
 #
 #
-# Revision 1.4  1998/10/14 21:28:48  peter
+# Revision 1.2  1998/10/14 21:28:46  peter
 #   * initialize fpu so sigfpe is finally generated for fpu errors
 #   * initialize fpu so sigfpe is finally generated for fpu errors
 #
 #
-# Revision 1.3  1998/08/08 14:42:10  peter
-#   * added missing ___fpc_sbrk and logs
+# Revision 1.1  1998/08/12 19:16:09  peter
+#   + loader including libc init and exit
 #
 #
 #
 #

+ 25 - 15
rtl/linux/i386/gprt0.as

@@ -13,21 +13,27 @@
 #
 #
 #**********************************************************************}
 #**********************************************************************}
 #
 #
-# Linux a.out startup code with profiling support for Free Pascal
+# Linux ELF startup code with profiling support for Free Pascal
 # Note: Needs linking with -lgmon and -lc
 # Note: Needs linking with -lgmon and -lc
 #
 #
 
 
-        .file "gprt0.as"
+        .file   "gprt1.as"
         .text
         .text
-        .globl  __entry
-__entry:
-        movl    8(%esp),%eax            /* Move the environment pointer */
-        movl    4(%esp),%ebx            /* Move the argument pointer */
-        movl    (%esp),%ecx             /* Move the argument counter */
+        .globl _start
+        .type _start,@function
+_start:
+        /* First locate the start of the environment variables */
+        popl    %ecx
+        movl    %esp,%ebx               /* Points to the arguments */
+        movl    %ecx,%eax
+        incl    %eax
+        shll    $2,%eax
+        addl    %esp,%eax
+        andl    $0xfffffff8,%esp        /* Align stack */
 
 
-        movl    %eax,U_SYSLINUX_ENVP
-        movl    %ebx,U_SYSLINUX_ARGV
-        movl    %ecx,U_SYSLINUX_ARGC
+        movl    %eax,U_SYSLINUX_ENVP    /* Move the environment pointer */
+        movl    %ecx,U_SYSLINUX_ARGC    /* Move the argument counter    */
+        movl    %ebx,U_SYSLINUX_ARGV    /* Move the argument pointer    */
 
 
         finit                           /* initialize fpu */
         finit                           /* initialize fpu */
         fwait
         fwait
@@ -44,8 +50,8 @@ __entry:
         xorl    %ebp,%ebp
         xorl    %ebp,%ebp
         call    PASCALMAIN
         call    PASCALMAIN
 
 
-        .globl  _haltproc
-        .type   _haltproc,@function
+        .globl _haltproc
+        .type _haltproc,@function
 _haltproc:
 _haltproc:
         xorl    %ebx,%ebx               /* load and save exitcode */
         xorl    %ebx,%ebx               /* load and save exitcode */
         movw    U_SYSLINUX_EXITCODE,%bx
         movw    U_SYSLINUX_EXITCODE,%bx
@@ -68,6 +74,7 @@ ___fpucw:
         .type   ___fpc_brk_addr,@object
         .type   ___fpc_brk_addr,@object
         .size   ___fpc_brk_addr,4
         .size   ___fpc_brk_addr,4
 ___fpc_brk_addr:
 ___fpc_brk_addr:
+        .long   0
 
 
         .globl  __curbrk                /* necessary for libc */
         .globl  __curbrk                /* necessary for libc */
         .type   __curbrk,@object
         .type   __curbrk,@object
@@ -77,13 +84,16 @@ __curbrk:
 
 
 #
 #
 # $Log$
 # $Log$
-# Revision 1.5  1998-11-04 10:16:26  peter
+# Revision 1.6  1999-11-08 23:07:48  peter
+#   * removed aout entries
+#
+# Revision 1.5  1998/11/04 10:16:27  peter
 #   + xorl ebp,ebp to indicate end of backtrace
 #   + xorl ebp,ebp to indicate end of backtrace
 #
 #
-# Revision 1.4  1998/10/14 21:28:47  peter
+# Revision 1.4  1998/10/14 21:28:48  peter
 #   * initialize fpu so sigfpe is finally generated for fpu errors
 #   * initialize fpu so sigfpe is finally generated for fpu errors
 #
 #
-# Revision 1.3  1998/08/08 14:42:09  peter
+# Revision 1.3  1998/08/08 14:42:10  peter
 #   * added missing ___fpc_sbrk and logs
 #   * added missing ___fpc_sbrk and logs
 #
 #
 #
 #

+ 30 - 15
rtl/linux/i386/prt0.as

@@ -1,8 +1,8 @@
 #
 #
 #   $Id$
 #   $Id$
 #   This file is part of the Free Pascal run time library.
 #   This file is part of the Free Pascal run time library.
-#   Copyright (c) 1996-98 by Michael Van Canneyt
-#   member of the Free Pascal development team.
+#   Copyright (c) 1993,97 by Michael Van Canneyt and Peter Vreman
+#   members of the Free Pascal development team.
 #
 #
 #   See the file COPYING.FPC, included in this distribution,
 #   See the file COPYING.FPC, included in this distribution,
 #   for details about the copyright.
 #   for details about the copyright.
@@ -13,20 +13,26 @@
 #
 #
 #**********************************************************************}
 #**********************************************************************}
 #
 #
-# Linux a.out startup code for Free Pascal
+# Linux ELF startup code for Free Pascal
 #
 #
 
 
-        .file "prt0.as"
+        .file   "prt1.as"
         .text
         .text
-        .globl  __entry
-__entry:
-        movl    8(%esp),%eax            /* Move the environment pointer */
-        movl    4(%esp),%ebx            /* Move the argument pointer */
-        movl    (%esp),%ecx             /* Move the argument counter */
+        .globl  _start
+        .type   _start,@function
+_start:
+        /* First locate the start of the environment variables */
+        popl    %ecx
+        movl    %esp,%ebx               /* Points to the arguments */
+        movl    %ecx,%eax
+        incl    %eax
+        shll    $2,%eax
+        addl    %esp,%eax
+        andl    $0xfffffff8,%esp        /* Align stack */
 
 
-        movl    %eax,U_SYSLINUX_ENVP
-        movl    %ebx,U_SYSLINUX_ARGV
-        movl    %ecx,U_SYSLINUX_ARGC
+        movl    %eax,U_SYSLINUX_ENVP    /* Move the environment pointer */
+        movl    %ecx,U_SYSLINUX_ARGC    /* Move the argument counter    */
+        movl    %ebx,U_SYSLINUX_ARGV    /* Move the argument pointer    */
 
 
         finit                           /* initialize fpu */
         finit                           /* initialize fpu */
         fwait
         fwait
@@ -55,15 +61,24 @@ ___fpucw:
 ___fpc_brk_addr:
 ___fpc_brk_addr:
         .long   0
         .long   0
 
 
+        .globl  __curbrk                /* necessary for libc */
+        .type   __curbrk,@object
+        .size   __curbrk,4
+__curbrk:
+        .long   0
+
 #
 #
 # $Log$
 # $Log$
-# Revision 1.5  1998-11-04 10:16:28  peter
+# Revision 1.6  1999-11-08 23:07:48  peter
+#   * removed aout entries
+#
+# Revision 1.5  1998/11/04 10:16:29  peter
 #   + xorl ebp,ebp to indicate end of backtrace
 #   + xorl ebp,ebp to indicate end of backtrace
 #
 #
-# Revision 1.4  1998/10/14 21:28:49  peter
+# Revision 1.4  1998/10/14 21:28:50  peter
 #   * initialize fpu so sigfpe is finally generated for fpu errors
 #   * initialize fpu so sigfpe is finally generated for fpu errors
 #
 #
-# Revision 1.3  1998/08/08 14:42:11  peter
+# Revision 1.3  1998/08/08 14:42:12  peter
 #   * added missing ___fpc_sbrk and logs
 #   * added missing ___fpc_sbrk and logs
 #
 #
 #
 #

+ 0 - 81
rtl/linux/i386/prt1.as

@@ -1,81 +0,0 @@
-#
-#   $Id$
-#   This file is part of the Free Pascal run time library.
-#   Copyright (c) 1993,97 by Michael Van Canneyt and Peter Vreman
-#   members of the Free Pascal development team.
-#
-#   See the file COPYING.FPC, included in this distribution,
-#   for details about the copyright.
-#
-#   This program 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.
-#
-#**********************************************************************}
-#
-# Linux ELF startup code for Free Pascal
-#
-
-        .file   "prt1.as"
-        .text
-        .globl  _start
-        .type   _start,@function
-_start:
-        /* First locate the start of the environment variables */
-        popl    %ecx
-        movl    %esp,%ebx               /* Points to the arguments */
-        movl    %ecx,%eax
-        incl    %eax
-        shll    $2,%eax
-        addl    %esp,%eax
-        andl    $0xfffffff8,%esp        /* Align stack */
-
-        movl    %eax,U_SYSLINUX_ENVP    /* Move the environment pointer */
-        movl    %ecx,U_SYSLINUX_ARGC    /* Move the argument counter    */
-        movl    %ebx,U_SYSLINUX_ARGV    /* Move the argument pointer    */
-
-        finit                           /* initialize fpu */
-        fwait
-        fldcw   ___fpucw
-
-        xorl    %ebp,%ebp
-        call    PASCALMAIN
-
-        .globl  _haltproc
-        .type   _haltproc,@function
-_haltproc:
-        movl    $1,%eax                 /* exit call */
-        xorl    %ebx,%ebx
-        movw    U_SYSLINUX_EXITCODE,%bx
-        int     $0x80
-        jmp     _haltproc
-
-.data
-        .align  4
-___fpucw:
-        .long   0x1332
-
-        .globl  ___fpc_brk_addr         /* heap management */
-        .type   ___fpc_brk_addr,@object
-        .size   ___fpc_brk_addr,4
-___fpc_brk_addr:
-        .long   0
-
-        .globl  __curbrk                /* necessary for libc */
-        .type   __curbrk,@object
-        .size   __curbrk,4
-__curbrk:
-        .long   0
-
-#
-# $Log$
-# Revision 1.5  1998-11-04 10:16:29  peter
-#   + xorl ebp,ebp to indicate end of backtrace
-#
-# Revision 1.4  1998/10/14 21:28:50  peter
-#   * initialize fpu so sigfpe is finally generated for fpu errors
-#
-# Revision 1.3  1998/08/08 14:42:12  peter
-#   * added missing ___fpc_sbrk and logs
-#
-#