Browse Source

* properties set

git-svn-id: trunk@8209 -
florian 18 years ago
parent
commit
065b187c26

+ 33 - 33
.gitattributes

@@ -4702,10 +4702,10 @@ rtl/inc/wstrings.inc svneol=native#text/plain
 rtl/linux/Makefile svneol=native#text/plain
 rtl/linux/Makefile.fpc svneol=native#text/plain
 rtl/linux/arm/bsyscall.inc svneol=native#text/plain
-rtl/linux/arm/cprt0.as -text
-rtl/linux/arm/dllprt0.as -text
-rtl/linux/arm/gprt0.as -text
-rtl/linux/arm/prt0.as -text
+rtl/linux/arm/cprt0.as svneol=native#text/plain
+rtl/linux/arm/dllprt0.as svneol=native#text/plain
+rtl/linux/arm/gprt0.as svneol=native#text/plain
+rtl/linux/arm/prt0.as svneol=native#text/plain
 rtl/linux/arm/sighnd.inc svneol=native#text/plain
 rtl/linux/arm/sighndh.inc svneol=native#text/plain
 rtl/linux/arm/stat.inc svneol=native#text/plain
@@ -4719,12 +4719,12 @@ rtl/linux/fpcylix.pp svneol=native#text/plain
 rtl/linux/fpmake.inc svneol=native#text/plain
 rtl/linux/gpm.pp svneol=native#text/plain
 rtl/linux/i386/bsyscall.inc svneol=native#text/plain
-rtl/linux/i386/cprt0.as -text
-rtl/linux/i386/cprt21.as -text
-rtl/linux/i386/dllprt0.as -text
-rtl/linux/i386/gprt0.as -text
-rtl/linux/i386/gprt21.as -text
-rtl/linux/i386/prt0.as -text
+rtl/linux/i386/cprt0.as svneol=native#text/plain
+rtl/linux/i386/cprt21.as svneol=native#text/plain
+rtl/linux/i386/dllprt0.as svneol=native#text/plain
+rtl/linux/i386/gprt0.as svneol=native#text/plain
+rtl/linux/i386/gprt21.as svneol=native#text/plain
+rtl/linux/i386/prt0.as svneol=native#text/plain
 rtl/linux/i386/si_c.inc svneol=native#text/plain
 rtl/linux/i386/si_c21.inc svneol=native#text/plain
 rtl/linux/i386/si_c21g.inc svneol=native#text/plain
@@ -4742,13 +4742,13 @@ rtl/linux/ipcsys.inc svneol=native#text/plain
 rtl/linux/linux.pp svneol=native#text/plain
 rtl/linux/linuxvcs.pp -text
 rtl/linux/m68k/bsyscall.inc svneol=native#text/plain
-rtl/linux/m68k/cprt0.as -text
-rtl/linux/m68k/cprt21.as -text
-rtl/linux/m68k/dllprt0.as -text
-rtl/linux/m68k/gprt0.as -text
-rtl/linux/m68k/gprt21.as -text
-rtl/linux/m68k/prt0.as -text
-rtl/linux/m68k/prt1.as -text
+rtl/linux/m68k/cprt0.as svneol=native#text/plain
+rtl/linux/m68k/cprt21.as svneol=native#text/plain
+rtl/linux/m68k/dllprt0.as svneol=native#text/plain
+rtl/linux/m68k/gprt0.as svneol=native#text/plain
+rtl/linux/m68k/gprt21.as svneol=native#text/plain
+rtl/linux/m68k/prt0.as svneol=native#text/plain
+rtl/linux/m68k/prt1.as svneol=native#text/plain
 rtl/linux/m68k/sighnd.inc svneol=native#text/plain
 rtl/linux/m68k/sighndh.inc svneol=native#text/plain
 rtl/linux/m68k/stat.inc svneol=native#text/plain
@@ -4761,10 +4761,10 @@ rtl/linux/osmacro.inc svneol=native#text/plain
 rtl/linux/ossysc.inc svneol=native#text/plain
 rtl/linux/ostypes.inc svneol=native#text/plain
 rtl/linux/powerpc/bsyscall.inc svneol=native#text/plain
-rtl/linux/powerpc/cprt0.as -text
-rtl/linux/powerpc/dllprt0.as -text
-rtl/linux/powerpc/gprt0.as -text
-rtl/linux/powerpc/prt0.as -text
+rtl/linux/powerpc/cprt0.as svneol=native#text/plain
+rtl/linux/powerpc/dllprt0.as svneol=native#text/plain
+rtl/linux/powerpc/gprt0.as svneol=native#text/plain
+rtl/linux/powerpc/prt0.as svneol=native#text/plain
 rtl/linux/powerpc/sighnd.inc svneol=native#text/plain
 rtl/linux/powerpc/sighndh.inc svneol=native#text/plain
 rtl/linux/powerpc/stat.inc svneol=native#text/plain
@@ -4772,10 +4772,10 @@ rtl/linux/powerpc/syscall.inc svneol=native#text/plain
 rtl/linux/powerpc/syscallh.inc svneol=native#text/plain
 rtl/linux/powerpc/sysnr.inc svneol=native#text/plain
 rtl/linux/powerpc64/bsyscall.inc svneol=native#text/plain
-rtl/linux/powerpc64/cprt0.as -text
-rtl/linux/powerpc64/dllprt0.as -text
-rtl/linux/powerpc64/gprt0.as -text
-rtl/linux/powerpc64/prt0.as -text
+rtl/linux/powerpc64/cprt0.as svneol=native#text/plain
+rtl/linux/powerpc64/dllprt0.as svneol=native#text/plain
+rtl/linux/powerpc64/gprt0.as svneol=native#text/plain
+rtl/linux/powerpc64/prt0.as svneol=native#text/plain
 rtl/linux/powerpc64/sighnd.inc svneol=native#text/plain
 rtl/linux/powerpc64/sighndh.inc svneol=native#text/plain
 rtl/linux/powerpc64/stat.inc svneol=native#text/plain
@@ -4793,10 +4793,10 @@ rtl/linux/si_intf.inc svneol=native#text/plain
 rtl/linux/si_prc.pp svneol=native#text/plain
 rtl/linux/signal.inc svneol=native#text/plain
 rtl/linux/sparc/bsyscall.inc svneol=native#text/plain
-rtl/linux/sparc/cprt0.as -text
-rtl/linux/sparc/dllprt0.as -text
-rtl/linux/sparc/gprt0.as -text
-rtl/linux/sparc/prt0.as -text
+rtl/linux/sparc/cprt0.as svneol=native#text/plain
+rtl/linux/sparc/dllprt0.as svneol=native#text/plain
+rtl/linux/sparc/gprt0.as svneol=native#text/plain
+rtl/linux/sparc/prt0.as svneol=native#text/plain
 rtl/linux/sparc/sighnd.inc svneol=native#text/plain
 rtl/linux/sparc/sighndh.inc svneol=native#text/plain
 rtl/linux/sparc/stat.inc svneol=native#text/plain
@@ -4817,10 +4817,10 @@ rtl/linux/unxsockh.inc svneol=native#text/plain
 rtl/linux/unxsysc.inc svneol=native#text/plain
 rtl/linux/unxsysch.inc svneol=native#text/plain
 rtl/linux/x86_64/bsyscall.inc svneol=native#text/plain
-rtl/linux/x86_64/cprt0.as -text
-rtl/linux/x86_64/dllprt0.as -text
-rtl/linux/x86_64/gprt0.as -text
-rtl/linux/x86_64/prt0.as -text
+rtl/linux/x86_64/cprt0.as svneol=native#text/plain
+rtl/linux/x86_64/dllprt0.as svneol=native#text/plain
+rtl/linux/x86_64/gprt0.as svneol=native#text/plain
+rtl/linux/x86_64/prt0.as svneol=native#text/plain
 rtl/linux/x86_64/si_c.inc svneol=native#text/plain
 rtl/linux/x86_64/si_prc.inc svneol=native#text/plain
 rtl/linux/x86_64/sighnd.inc svneol=native#text/plain

+ 75 - 75
rtl/linux/m68k/cprt0.as

@@ -1,75 +1,75 @@
-|
-|   $Id: cprt0.as,v 1.1.2.2 2001/08/01 13:26:17 pierre Exp $
-|   This file is part of the Free Pascal run time library.
-|   Copyright (c) 2001 by Free Pascal Core 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 m68k ELF startup code for linking with C lib for Free Pascal
-|
-        .file   "cprt0.as"
-	.text
-        .globl  _start
-        .type   _start,@function
-_start:
-        .globl  __entry
-        .type   __entry,@function
-__entry:
-        move.l   8(%sp),%d0
-        move.l   %d0,U_SYSLINUX_ENVP
-        move.l   %d0,__environ
-        move.l   4(%sp),%d0
-        move.l   %d0,U_SYSLINUX_ARGV
-        move.l   (%sp),%d0
-        move.l   %d0,U_SYSLINUX_ARGC
-|       The arguments should be in correct order for
-|       calling __libc_init
-|       This code is untested for now PM
-        jsr     __libc_init
-|       insert _fini in atexit chain
-        move.l   _fini,-(%sp)
-        jsr      atexit
-        addq.l   #4,%sp
-|       call _init function
-        jsr      _init
-
-        jsr      PASCALMAIN
-
-|       Used by System_exit procedure
-        .globl  _haltproc
-_haltproc:
-|       Call C exit function
-        move.w   U_SYSLINUX_EXITCODE,%d1
-        move.l   %d1,-(%sp)
-        jsr      exit
-        moveq.l  #1,%d0
-        move.l   (%sp)+,%d1
-        trap     #0
-        bra      _haltproc
-
-
-|       Is this still needed ??
-|        .data
-|        .align	4
-|        .globl	___fpc_brk_addr
-|___fpc_brk_addr:
-|       .long	0
-
-
-|
-| $Log: cprt0.as,v $
-| Revision 1.1.2.2  2001/08/01 13:26:17  pierre
-|  * syntax adapted to GNU as
-|
-| Revision 1.1.2.1  2001/07/13 15:29:32  pierre
-|  first version of cprt0.as
-|
-|
-
+|
+|   $Id: cprt0.as,v 1.1.2.2 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Free Pascal Core 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 m68k ELF startup code for linking with C lib for Free Pascal
+|
+        .file   "cprt0.as"
+	.text
+        .globl  _start
+        .type   _start,@function
+_start:
+        .globl  __entry
+        .type   __entry,@function
+__entry:
+        move.l   8(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ENVP
+        move.l   %d0,__environ
+        move.l   4(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGV
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGC
+|       The arguments should be in correct order for
+|       calling __libc_init
+|       This code is untested for now PM
+        jsr     __libc_init
+|       insert _fini in atexit chain
+        move.l   _fini,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+|       call _init function
+        jsr      _init
+
+        jsr      PASCALMAIN
+
+|       Used by System_exit procedure
+        .globl  _haltproc
+_haltproc:
+|       Call C exit function
+        move.w   U_SYSLINUX_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        jsr      exit
+        moveq.l  #1,%d0
+        move.l   (%sp)+,%d1
+        trap     #0
+        bra      _haltproc
+
+
+|       Is this still needed ??
+|        .data
+|        .align	4
+|        .globl	___fpc_brk_addr
+|___fpc_brk_addr:
+|       .long	0
+
+
+|
+| $Log: cprt0.as,v $
+| Revision 1.1.2.2  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.1  2001/07/13 15:29:32  pierre
+|  first version of cprt0.as
+|
+|
+

+ 144 - 144
rtl/linux/m68k/cprt21.as

@@ -1,144 +1,144 @@
-|
-|   $Id: cprt21.as,v 1.1.2.5 2002/02/28 22:44:44 pierre Exp $
-|   This file is part of the Free Pascal run time library.
-|   Copyright (c) 1999-2000 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 */
-        move.l    (%sp)+,%d3
-        move.l    %d0,%d4
-
-        move.l    %sp,%d1               /* Points to the arguments */
-        move.l    %d3,%d0
-        addq.l    #1,%d0
-        lsl.l     #2,%d0
-        add.l     %sp,%d0
-
-        move.l    %sp,%d7
-        and.l     #0xfffffff8,%d7        /* Align stack */
-        move.l    %d7,%sp
-
-        move.l    %d0,U_SYSLINUX_ENVP    /* Move the environment pointer */
-        move.l    %d3,U_SYSLINUX_ARGC    /* Move the argument counter    */
-        move.l    %d1,U_SYSLINUX_ARGV    /* Move the argument pointer    */
-
-        move.l   #0,%fp                  /* Zero frame pointer to end call stack */
-
-|
-|       Start of args for __libc_start_main
-|
-|
-        move.l   %d4,-(%sp)
-        move.l   %sp,-(%sp)
-        move.l   %a1,-(%sp)
-        pea.l    _fini_dummy
-        pea.l    _init_dummy
-        move.l   %d1,-(%sp)
-        move.l   %d3,-(%sp)
-        pea.l    main
-        jsr      __libc_start_main
-        trap     #0
-
-/* fake main routine which will be run from libc */
-main:
-        /* save return address */
-        move.l    (%sp)+,%d0
-        move.l    %d0,___fpc_ret
-        move.l    %d1,___fpc_ret_d1
-        move.l    %fp,___fpc_ret_fp
-        move.l    %d0,-(%sp)
-
-        /* start the program */
-        move.l   #0,%fp
-        jsr      PASCALMAIN
-
-        .globl _haltproc
-        .type _haltproc,@function
-_haltproc:
-        eor.l    %d0,%d0               /* load and save exitcode */
-        move.w   U_SYSLINUX_EXITCODE,%d0
-
-        move.l    ___fpc_ret,%d3         /* return to libc */
-        move.l    ___fpc_ret_fp,%fp
-        move.l    ___fpc_ret_d1,%d1
-        move.l    %d3,-(%sp)
-_init_dummy:
-_fini_dummy:
-        rts
-
-.data
-        .align  4
-
-        .globl  ___fpc_brk_addr         /* heap management */
-        .type   ___fpc_brk_addr,@object
-        .size   ___fpc_brk_addr,4
-___fpc_brk_addr:
-        .long   0
-
-___fpc_ret:                             /* return address to libc */
-        .long   0
-___fpc_ret_d1:
-        .long   0
-___fpc_ret_fp:
-        .long   0
-
-
-|
-| $Log: cprt21.as,v $
-| Revision 1.1.2.5  2002/02/28 22:44:44  pierre
-|  + add some comments
-|
-| Revision 1.1.2.4  2001/08/02 21:23:59  pierre
-|  * fix the args to __libc_start_main
-|
-| Revision 1.1.2.3  2001/07/30 20:05:07  pierre
-|  * fix a assembler syntax eror in last commit
-|
-| Revision 1.1.2.2  2001/07/30 16:18:53  pierre
-|  * converted from i386 code
-|
-| Revision 1.1.2.2  2001/06/04 18:04:32  peter
-|   * use own dummies for _init and _fini
-|
-| Revision 1.1.2.1  2001/02/14 22:18:45  pierre
-|  * fix Sebastian's problem with HeapTrace
-|
-| Revision 1.1  2000/07/13 06:30:55  michael
-| + Initial import
-|
-| Revision 1.3  2000/01/07 16:41:42  daniel
-|   * copyright 2000
-|
-| Revision 1.2  2000/01/07 16:32:28  daniel
-|   * copyright 2000 added
-|
-| Revision 1.1  1999/05/03 21:29:36  peter
-|   + glibc 2.1 support
-|
-| Revision 1.3  1998/11/04 10:16:25  peter
-|   + xorl fp,fp to indicate end of backtrace
-|
-| Revision 1.2  1998/10/14 21:28:46  peter
-|   * initialize fpu so sigfpe is finally generated for fpu errors
-|
-| Revision 1.1  1998/08/12 19:16:09  peter
-|   + loader including libc init and exit
-|
-|
+|
+|   $Id: cprt21.as,v 1.1.2.5 2002/02/28 22:44:44 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 1999-2000 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 */
+        move.l    (%sp)+,%d3
+        move.l    %d0,%d4
+
+        move.l    %sp,%d1               /* Points to the arguments */
+        move.l    %d3,%d0
+        addq.l    #1,%d0
+        lsl.l     #2,%d0
+        add.l     %sp,%d0
+
+        move.l    %sp,%d7
+        and.l     #0xfffffff8,%d7        /* Align stack */
+        move.l    %d7,%sp
+
+        move.l    %d0,U_SYSLINUX_ENVP    /* Move the environment pointer */
+        move.l    %d3,U_SYSLINUX_ARGC    /* Move the argument counter    */
+        move.l    %d1,U_SYSLINUX_ARGV    /* Move the argument pointer    */
+
+        move.l   #0,%fp                  /* Zero frame pointer to end call stack */
+
+|
+|       Start of args for __libc_start_main
+|
+|
+        move.l   %d4,-(%sp)
+        move.l   %sp,-(%sp)
+        move.l   %a1,-(%sp)
+        pea.l    _fini_dummy
+        pea.l    _init_dummy
+        move.l   %d1,-(%sp)
+        move.l   %d3,-(%sp)
+        pea.l    main
+        jsr      __libc_start_main
+        trap     #0
+
+/* fake main routine which will be run from libc */
+main:
+        /* save return address */
+        move.l    (%sp)+,%d0
+        move.l    %d0,___fpc_ret
+        move.l    %d1,___fpc_ret_d1
+        move.l    %fp,___fpc_ret_fp
+        move.l    %d0,-(%sp)
+
+        /* start the program */
+        move.l   #0,%fp
+        jsr      PASCALMAIN
+
+        .globl _haltproc
+        .type _haltproc,@function
+_haltproc:
+        eor.l    %d0,%d0               /* load and save exitcode */
+        move.w   U_SYSLINUX_EXITCODE,%d0
+
+        move.l    ___fpc_ret,%d3         /* return to libc */
+        move.l    ___fpc_ret_fp,%fp
+        move.l    ___fpc_ret_d1,%d1
+        move.l    %d3,-(%sp)
+_init_dummy:
+_fini_dummy:
+        rts
+
+.data
+        .align  4
+
+        .globl  ___fpc_brk_addr         /* heap management */
+        .type   ___fpc_brk_addr,@object
+        .size   ___fpc_brk_addr,4
+___fpc_brk_addr:
+        .long   0
+
+___fpc_ret:                             /* return address to libc */
+        .long   0
+___fpc_ret_d1:
+        .long   0
+___fpc_ret_fp:
+        .long   0
+
+
+|
+| $Log: cprt21.as,v $
+| Revision 1.1.2.5  2002/02/28 22:44:44  pierre
+|  + add some comments
+|
+| Revision 1.1.2.4  2001/08/02 21:23:59  pierre
+|  * fix the args to __libc_start_main
+|
+| Revision 1.1.2.3  2001/07/30 20:05:07  pierre
+|  * fix a assembler syntax eror in last commit
+|
+| Revision 1.1.2.2  2001/07/30 16:18:53  pierre
+|  * converted from i386 code
+|
+| Revision 1.1.2.2  2001/06/04 18:04:32  peter
+|   * use own dummies for _init and _fini
+|
+| Revision 1.1.2.1  2001/02/14 22:18:45  pierre
+|  * fix Sebastian's problem with HeapTrace
+|
+| Revision 1.1  2000/07/13 06:30:55  michael
+| + Initial import
+|
+| Revision 1.3  2000/01/07 16:41:42  daniel
+|   * copyright 2000
+|
+| Revision 1.2  2000/01/07 16:32:28  daniel
+|   * copyright 2000 added
+|
+| Revision 1.1  1999/05/03 21:29:36  peter
+|   + glibc 2.1 support
+|
+| Revision 1.3  1998/11/04 10:16:25  peter
+|   + xorl fp,fp to indicate end of backtrace
+|
+| Revision 1.2  1998/10/14 21:28:46  peter
+|   * initialize fpu so sigfpe is finally generated for fpu errors
+|
+| Revision 1.1  1998/08/12 19:16:09  peter
+|   + loader including libc init and exit
+|
+|

+ 66 - 66
rtl/linux/m68k/dllprt0.as

@@ -1,66 +1,66 @@
-|
-|   $Id: dllprt0.as,v 1.1.2.4 2001/08/01 13:26:17 pierre Exp $
-|   This file is part of the Free Pascal run time library.
-|   Copyright (c) 2001 by Pierre Muller
-|
-|   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 m68k ELF shared library startup code for Free Pascal
-|
-        .file "dllprt0.as"
-	.text
-        .globl  _startlib
-        .type   _startlib,@function
-_startlib:
-        .globl  FPC_LIB_START
-        .type   FPC_LIB_START,@function
-FPC_LIB_START:
-|
-|       The args and envs are not tested yet
-|
-        move.l   (%sp)+, %d0
-        lea      4(%sp,%d0*4),%a0
-        move.l   %a0, U_SYSLINUX_ENVP
-        move.l   %sp,U_SYSLINUX_ARGV
-        move.l   %d0,U_SYSLINUX_ARGC
-        jsr      PASCALMAIN
-        rts
-
-        .globl  _haltproc
-        .type   _haltproc,@function
-haltproc:
-        moveq.l   #1,%d0
-        move.w    U_SYSLINUX_EXITCODE,%d1
-        trap      #0
-        bra       _haltproc
-
-
-        .data
-	.align  4
-	.globl  ___fpc_brk_addr
-___fpc_brk_addr:
-        .long   0
-
-|
-| $Log: dllprt0.as,v $
-| Revision 1.1.2.4  2001/08/01 13:26:17  pierre
-|  * syntax adapted to GNU as
-|
-| Revision 1.1.2.3  2001/07/13 15:13:47  pierre
-|  + add and fix some comments
-|
-| Revision 1.1.2.2  2001/07/13 15:04:35  pierre
-|  * correct assembler error
-|
-| Revision 1.1.2.1  2001/07/13 15:03:02  pierre
-|  + New file converted from i386 version
-|
-|
-
+|
+|   $Id: dllprt0.as,v 1.1.2.4 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Pierre Muller
+|
+|   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 m68k ELF shared library startup code for Free Pascal
+|
+        .file "dllprt0.as"
+	.text
+        .globl  _startlib
+        .type   _startlib,@function
+_startlib:
+        .globl  FPC_LIB_START
+        .type   FPC_LIB_START,@function
+FPC_LIB_START:
+|
+|       The args and envs are not tested yet
+|
+        move.l   (%sp)+, %d0
+        lea      4(%sp,%d0*4),%a0
+        move.l   %a0, U_SYSLINUX_ENVP
+        move.l   %sp,U_SYSLINUX_ARGV
+        move.l   %d0,U_SYSLINUX_ARGC
+        jsr      PASCALMAIN
+        rts
+
+        .globl  _haltproc
+        .type   _haltproc,@function
+haltproc:
+        moveq.l   #1,%d0
+        move.w    U_SYSLINUX_EXITCODE,%d1
+        trap      #0
+        bra       _haltproc
+
+
+        .data
+	.align  4
+	.globl  ___fpc_brk_addr
+___fpc_brk_addr:
+        .long   0
+
+|
+| $Log: dllprt0.as,v $
+| Revision 1.1.2.4  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.3  2001/07/13 15:13:47  pierre
+|  + add and fix some comments
+|
+| Revision 1.1.2.2  2001/07/13 15:04:35  pierre
+|  * correct assembler error
+|
+| Revision 1.1.2.1  2001/07/13 15:03:02  pierre
+|  + New file converted from i386 version
+|
+|
+

+ 92 - 92
rtl/linux/m68k/gprt0.as

@@ -1,92 +1,92 @@
-|
-|   $Id: gprt0.as,v 1.1.2.3 2001/08/01 13:26:17 pierre Exp $
-|   This file is part of the Free Pascal run time library.
-|   Copyright (c) 2001 by Free Pascal Core 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 m68k ELF startup code with profiling support for Free Pascal
-| Note: Needs linking with -lgmon and -lc
-|
-        .file   "gprt0.as"
-	.text
-        .globl  _start
-        .type   _start,@function
-_start:
-        .globl  __entry
-        .type   __entry,@function
-__entry:
-        move.l   8(%sp),%d0
-        move.l   %d0,U_SYSLINUX_ENVP
-        move.l   %d0,__environ
-        move.l   4(%sp),%d0
-        move.l   %d0,U_SYSLINUX_ARGV
-        move.l   (%sp),%d0
-        move.l   %d0,U_SYSLINUX_ARGC
-|       Initialize gmon
-|       Should this be done before or after __libc_init call ??
-|
-        move.l   _etext,-(%sp)                 /* Initialize gmon */
-        move.l   _start,-(%sp)
-        jsr      monstartup
-        addq.l   #8,%sp
-        move.l   _mcleanup,-(%sp)
-        jsr      atexit
-        addq.l   #4,%sp
-
-
-|       The arguments should be in correct order for
-|       calling __libc_init
-|       This code is untested for now PM
-        jsr     __libc_init
-|       insert _fini in atexit chain
-        move.l   _fini,-(%sp)
-        jsr      atexit
-        addq.l     #4,%sp
-|       call _init function
-        jsr      _init
-
-        jsr     PASCALMAIN
-
-|       Used by System_exit procedure
-        .globl  _haltproc
-_haltproc:
-|       Call C exit function
-        move.w   U_SYSLINUX_EXITCODE,%d1
-        move.l   %d1,-(%sp)
-        jsr      exit
-        moveq.l  #1,%d0
-        move.l   (%sp)+,%d1
-        trap     #0
-        bra      _haltproc
-
-
-|       Is this still needed ??
-|        .data
-|        .align	4
-|        .globl	___fpc_brk_addr
-|___fpc_brk_addr:
-|       .long	0
-
-
-|
-| $Log: gprt0.as,v $
-| Revision 1.1.2.3  2001/08/01 13:26:17  pierre
-|  * syntax adapted to GNU as
-|
-| Revision 1.1.2.2  2001/07/13 15:43:22  pierre
-|  assembler error corrected
-|
-| Revision 1.1.2.1  2001/07/13 15:38:54  pierre
-|  first version of gprt0.as file
-|
-|
-|
-
+|
+|   $Id: gprt0.as,v 1.1.2.3 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Free Pascal Core 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 m68k ELF startup code with profiling support for Free Pascal
+| Note: Needs linking with -lgmon and -lc
+|
+        .file   "gprt0.as"
+	.text
+        .globl  _start
+        .type   _start,@function
+_start:
+        .globl  __entry
+        .type   __entry,@function
+__entry:
+        move.l   8(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ENVP
+        move.l   %d0,__environ
+        move.l   4(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGV
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGC
+|       Initialize gmon
+|       Should this be done before or after __libc_init call ??
+|
+        move.l   _etext,-(%sp)                 /* Initialize gmon */
+        move.l   _start,-(%sp)
+        jsr      monstartup
+        addq.l   #8,%sp
+        move.l   _mcleanup,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+
+
+|       The arguments should be in correct order for
+|       calling __libc_init
+|       This code is untested for now PM
+        jsr     __libc_init
+|       insert _fini in atexit chain
+        move.l   _fini,-(%sp)
+        jsr      atexit
+        addq.l     #4,%sp
+|       call _init function
+        jsr      _init
+
+        jsr     PASCALMAIN
+
+|       Used by System_exit procedure
+        .globl  _haltproc
+_haltproc:
+|       Call C exit function
+        move.w   U_SYSLINUX_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        jsr      exit
+        moveq.l  #1,%d0
+        move.l   (%sp)+,%d1
+        trap     #0
+        bra      _haltproc
+
+
+|       Is this still needed ??
+|        .data
+|        .align	4
+|        .globl	___fpc_brk_addr
+|___fpc_brk_addr:
+|       .long	0
+
+
+|
+| $Log: gprt0.as,v $
+| Revision 1.1.2.3  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.2  2001/07/13 15:43:22  pierre
+|  assembler error corrected
+|
+| Revision 1.1.2.1  2001/07/13 15:38:54  pierre
+|  first version of gprt0.as file
+|
+|
+|
+

+ 95 - 95
rtl/linux/m68k/gprt21.as

@@ -1,95 +1,95 @@
-|
-|   $Id: gprt21.as,v 1.1.2.2 2001/08/01 13:26:17 pierre Exp $
-|   This file is part of the Free Pascal run time library.
-|   Copyright (c) 2001 by Free Pascal Core 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 m68k ELF startup code with profiling support for Free Pascal
-| Note: Needs linking with -lgmon and -lc
-|
-        .file   "gprt0.as"
-	.text
-        .globl   _start
-        .type    _start,@function
-_start:
-        .globl   __entry
-        .type    __entry,@function
-__entry:
-        move.l   8(%sp),%d0
-        move.l   %d0,U_SYSLINUX_ENVP
-        move.l   %d0,__environ
-        move.l   4(%sp),%d0
-        move.l   %d0,U_SYSLINUX_ARGV
-        move.l   (%sp),%d0
-        move.l   %d0,U_SYSLINUX_ARGC
-|       Initialize gmon
-|       Should this be done before or after __libc_init call ??
-|
-        move.l   _etext,-(%sp)                 /* Initialize gmon */
-        move.l   _start,-(%sp)
-        jsr      monstartup
-        addq.l   #8,%sp
-        move.l   _mcleanup,-(%sp)
-        jsr      atexit
-        addq.l   #4,%sp
-
-
-|       The arguments should be in correct order for
-|       calling __libc_init
-|       This code is untested for now PM
-        jsr      __libc_init
-|       insert _fini in atexit chain
-        move.l   _fini,-(%sp)
-        jsr      atexit
-        addq.l   #4,%sp
-|       call _init function
-        jsr      _init
-
-        jsr      PASCALMAIN
-
-|       Used by System_exit procedure
-        .globl  _haltproc
-_haltproc:
-|       Call C exit function
-        move.w   U_SYSLINUX_EXITCODE,%d1
-        move.l   %d1,-(%sp)
-        jsr      exit
-        moveq.l  #1,%d0
-        move.l   (%sp)+,%d1
-        trap     #0
-        bra      _haltproc
-
-
-|       Is this still needed ??
-|        .data
-|        .align	4
-|        .globl	___fpc_brk_addr
-|___fpc_brk_addr:
-|       .long	0
-
-
-|
-| $Log: gprt21.as,v $
-| Revision 1.1.2.2  2001/08/01 13:26:17  pierre
-|  * syntax adapted to GNU as
-|
-| Revision 1.1.2.1  2001/07/13 15:45:40  pierre
-|  simple copies of cprt0 and gprt0 added
-|
-| Revision 1.1.2.2  2001/07/13 15:43:22  pierre
-|  assembler error corrected
-|
-| Revision 1.1.2.1  2001/07/13 15:38:54  pierre
-|  first version of gprt0.as file
-|
-|
-|
-
+|
+|   $Id: gprt21.as,v 1.1.2.2 2001/08/01 13:26:17 pierre Exp $
+|   This file is part of the Free Pascal run time library.
+|   Copyright (c) 2001 by Free Pascal Core 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 m68k ELF startup code with profiling support for Free Pascal
+| Note: Needs linking with -lgmon and -lc
+|
+        .file   "gprt0.as"
+	.text
+        .globl   _start
+        .type    _start,@function
+_start:
+        .globl   __entry
+        .type    __entry,@function
+__entry:
+        move.l   8(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ENVP
+        move.l   %d0,__environ
+        move.l   4(%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGV
+        move.l   (%sp),%d0
+        move.l   %d0,U_SYSLINUX_ARGC
+|       Initialize gmon
+|       Should this be done before or after __libc_init call ??
+|
+        move.l   _etext,-(%sp)                 /* Initialize gmon */
+        move.l   _start,-(%sp)
+        jsr      monstartup
+        addq.l   #8,%sp
+        move.l   _mcleanup,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+
+
+|       The arguments should be in correct order for
+|       calling __libc_init
+|       This code is untested for now PM
+        jsr      __libc_init
+|       insert _fini in atexit chain
+        move.l   _fini,-(%sp)
+        jsr      atexit
+        addq.l   #4,%sp
+|       call _init function
+        jsr      _init
+
+        jsr      PASCALMAIN
+
+|       Used by System_exit procedure
+        .globl  _haltproc
+_haltproc:
+|       Call C exit function
+        move.w   U_SYSLINUX_EXITCODE,%d1
+        move.l   %d1,-(%sp)
+        jsr      exit
+        moveq.l  #1,%d0
+        move.l   (%sp)+,%d1
+        trap     #0
+        bra      _haltproc
+
+
+|       Is this still needed ??
+|        .data
+|        .align	4
+|        .globl	___fpc_brk_addr
+|___fpc_brk_addr:
+|       .long	0
+
+
+|
+| $Log: gprt21.as,v $
+| Revision 1.1.2.2  2001/08/01 13:26:17  pierre
+|  * syntax adapted to GNU as
+|
+| Revision 1.1.2.1  2001/07/13 15:45:40  pierre
+|  simple copies of cprt0 and gprt0 added
+|
+| Revision 1.1.2.2  2001/07/13 15:43:22  pierre
+|  assembler error corrected
+|
+| Revision 1.1.2.1  2001/07/13 15:38:54  pierre
+|  first version of gprt0.as file
+|
+|
+|
+

+ 119 - 119
rtl/linux/powerpc/cprt0.as

@@ -1,119 +1,119 @@
-/*
- * Startup code for programs linked with GNU libc, PowerPC
- * version.
- *
- * Adapted from the glibc-sources (2.3.5) in the file
- *
- *     sysdeps/powerpc/powerpc32/elf/start.S
- *
- * Original header follows.
- */
-
-/* Startup code for programs linked with GNU libc.
-   Copyright (C) 1998,1999,2000,2001,2002,2003 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.
-
-   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.
-*/
-
-/* These are the various addresses we require.  */
-    .section ".rodata"
-    .align    2
-start_addresses:
-    .long     _SDA_BASE_
-    .long     main_stub
-    .long     __libc_csu_init
-    .long     __libc_csu_fini
-    .size   start_adresses, .-start_addresses
-
-    .section ".text"
-    .globl  _start
-_start:
-    /* save stack pointer for later use */
-    mr     9, 1
- /* Set up an initial stack frame, and clear the LR.  */
-    clrrwi 1, 1, 4
-    li     0, 0
-    stwu   1, -16(1)
-    mtlr   0
-    stw    0, 0(1)
- /* Set r13 to point at the 'small data area', and put the address of
-    start_addresses in r8...  */
-    lis    8,  start_addresses@ha
-    lwzu   13, start_addresses@l(8)
- /* and continue in libc-start, in glibc.  */
-    b      __libc_start_main
-
-    .globl  main_stub
-    .type   main_stub, @function
-main_stub:
- /* save link register and setup stack frame */
-    mflr    0
-    stw     0, 0(1)
-    stwu    1, -16(1)
-
-    lis     11, operatingsystem_parameter_argc@ha
-    stw      3, operatingsystem_parameter_argc@l(11);
-
-    lis     11, operatingsystem_parameter_argv@ha
-    stw      4, operatingsystem_parameter_argv@l(11);
-
-    lis     11, operatingsystem_parameter_envp@ha
-    stw      5, operatingsystem_parameter_envp@l(11);
-
-    lis 	11,__stkptr@ha
-	stw 	1,__stkptr@l(11);
-
-    lis     11, ___fpc_ret@ha
-    stw     1, ___fpc_ret@l(11)
-
-    lis     11, __stkptr@ha
-    stw     1, __stkptr@l(11)
-
-    bl      PASCALMAIN
-
-    .globl  _haltproc
-    .type   _haltproc, @function
-_haltproc:
-    lis     11, ___fpc_ret@ha
-    lwz     1, ___fpc_ret@l(11)
-    addi    1, 1, 16
-    lwz     0, 0(1)
-    mtlr    0
-    blr
-
-#    li      0, 1       /* exit call */
-#    lis     3, operatingsystem_result@h
-#    stw     3, operatingsystem_result@l(3)
-#    sc
-#    b       _haltproc
-
- /* Define a symbol for the first piece of initialized data.  */
-    .section ".data"
-    .globl   __data_start
-__data_start:
-data_start:
-
-___fpc_ret:                            /* return address to libc */
-    .long   0
-
-.text
-    .comm __stkptr, 4
-
-    .comm operatingsystem_parameter_envp, 4
-    .comm operatingsystem_parameter_argc, 4
-    .comm operatingsystem_parameter_argv, 4
-
+/*
+ * Startup code for programs linked with GNU libc, PowerPC
+ * version.
+ *
+ * Adapted from the glibc-sources (2.3.5) in the file
+ *
+ *     sysdeps/powerpc/powerpc32/elf/start.S
+ *
+ * Original header follows.
+ */
+
+/* Startup code for programs linked with GNU libc.
+   Copyright (C) 1998,1999,2000,2001,2002,2003 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.
+
+   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.
+*/
+
+/* These are the various addresses we require.  */
+    .section ".rodata"
+    .align    2
+start_addresses:
+    .long     _SDA_BASE_
+    .long     main_stub
+    .long     __libc_csu_init
+    .long     __libc_csu_fini
+    .size   start_adresses, .-start_addresses
+
+    .section ".text"
+    .globl  _start
+_start:
+    /* save stack pointer for later use */
+    mr     9, 1
+ /* Set up an initial stack frame, and clear the LR.  */
+    clrrwi 1, 1, 4
+    li     0, 0
+    stwu   1, -16(1)
+    mtlr   0
+    stw    0, 0(1)
+ /* Set r13 to point at the 'small data area', and put the address of
+    start_addresses in r8...  */
+    lis    8,  start_addresses@ha
+    lwzu   13, start_addresses@l(8)
+ /* and continue in libc-start, in glibc.  */
+    b      __libc_start_main
+
+    .globl  main_stub
+    .type   main_stub, @function
+main_stub:
+ /* save link register and setup stack frame */
+    mflr    0
+    stw     0, 0(1)
+    stwu    1, -16(1)
+
+    lis     11, operatingsystem_parameter_argc@ha
+    stw      3, operatingsystem_parameter_argc@l(11);
+
+    lis     11, operatingsystem_parameter_argv@ha
+    stw      4, operatingsystem_parameter_argv@l(11);
+
+    lis     11, operatingsystem_parameter_envp@ha
+    stw      5, operatingsystem_parameter_envp@l(11);
+
+    lis 	11,__stkptr@ha
+	stw 	1,__stkptr@l(11);
+
+    lis     11, ___fpc_ret@ha
+    stw     1, ___fpc_ret@l(11)
+
+    lis     11, __stkptr@ha
+    stw     1, __stkptr@l(11)
+
+    bl      PASCALMAIN
+
+    .globl  _haltproc
+    .type   _haltproc, @function
+_haltproc:
+    lis     11, ___fpc_ret@ha
+    lwz     1, ___fpc_ret@l(11)
+    addi    1, 1, 16
+    lwz     0, 0(1)
+    mtlr    0
+    blr
+
+#    li      0, 1       /* exit call */
+#    lis     3, operatingsystem_result@h
+#    stw     3, operatingsystem_result@l(3)
+#    sc
+#    b       _haltproc
+
+ /* Define a symbol for the first piece of initialized data.  */
+    .section ".data"
+    .globl   __data_start
+__data_start:
+data_start:
+
+___fpc_ret:                            /* return address to libc */
+    .long   0
+
+.text
+    .comm __stkptr, 4
+
+    .comm operatingsystem_parameter_envp, 4
+    .comm operatingsystem_parameter_argc, 4
+    .comm operatingsystem_parameter_argv, 4
+

+ 435 - 435
rtl/linux/powerpc64/cprt0.as

@@ -1,435 +1,435 @@
-/*
- * Startup code for programs linked with GNU libc, PowerPC64
- * version.
- *
- * Adapted from the glibc-sources (2.3.5) in the file
- *
- *     sysdeps/powerpc/powerpc64/elf/start.S
- *
- * Original header follows.
- */
-
-/* Startup code for programs linked with GNU libc.  PowerPC64 version.
-   Copyright (C) 1998,1999,2000,2001,2002,2003 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.
-
-   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.  */
-
-/* some macros which simplify the startup code */
-
-/* load the 64 bit value "value" into register ra */
-.macro LOAD_64BIT_VAL ra, value
-    lis       \ra,\value@highest
-    ori       \ra,\ra,\value@higher
-    sldi      \ra,\ra,32
-    oris      \ra,\ra,\value@h
-    ori       \ra,\ra,\value@l
-.endm
-
-/* create function prolog for symbol "fn" */
-.macro FUNCTION_PROLOG fn
-    .section  ".text"
-    .align    2
-    .globl    \fn
-    .section  ".opd", "aw"
-    .align    3
-\fn:
-    .quad     .\fn, .TOC.@tocbase, 0
-    .previous
-    .size     \fn, 24
-    .type     \fn, @function
-    .globl    .\fn
-.\fn:
-.endm
-
-/*
- * "ptrgl" glue code for calls via pointer. This function
- * sequence loads the data from the function descriptor
- * referenced by R11 into the CTR register (function address),
- * R2 (GOT/TOC pointer), and R11 (the outer frame pointer).
- *
- * On entry, R11 must be set to point to the function descriptor.
- *
- * See also the 64-bit PowerPC ABI specification for more
- * information, chapter 3.5.11 (in v1.7).
- */
-.section ".text"
-.align 3
-.globl .ptrgl
-.ptrgl:
-    ld	    0, 0(11)
-    std     2, 40(1)
-    mtctr   0
-    ld      2, 8(11)
-    ld      11, 8(11)
-    bctr
-.long 0
-.byte 0, 12, 128, 0, 0, 0, 0, 0
-.type .ptrgl, @function
-.size .ptrgl, . - .ptrgl
-
-/*
- * Function prolog/epilog helpers, which are part of the 64-bit
- * PowerPC ABI.
- *
- * See also the 64-bit PowerPC ABI specification for more
- * information, chapter 3.5.5, "Register saving and restoring
- * function" (in v1.7).
- */
-
-/* Each _savegpr0_N routine saves the general registers from rN to r31,
- * inclusive. When the routine is called, r1 must point to the start
- * of the general register save area. R0 must contain the old LR on
- * entry.
- */
-_savegpr0_14: std 14,-144(1)
-_savegpr0_15: std 15,-136(1)
-_savegpr0_16: std 16,-128(1)
-_savegpr0_17: std 17,-120(1)
-_savegpr0_18: std 18,-112(1)
-_savegpr0_19: std 19,-104(1)
-_savegpr0_20: std 20,-96(1)
-_savegpr0_21: std 21,-88(1)
-_savegpr0_22: std 22,-80(1)
-_savegpr0_23: std 23,-72(1)
-_savegpr0_24: std 24,-64(1)
-_savegpr0_25: std 25,-56(1)
-_savegpr0_26: std 26,-48(1)
-_savegpr0_27: std 27,-40(1)
-_savegpr0_28: std 28,-32(1)
-_savegpr0_29: std 29,-24(1)
-_savegpr0_30: std 30,-16(1)
-_savegpr0_31:
-    std 31,-8(1)
-    std 0, 16(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _restgpr0_N routine restores the general registers from rN to r31,
- * inclusive. When the routine is called, r1 must point to the start
- * of the general register save area.
- */
-_restgpr0_14: ld 14,-144(1)
-_restgpr0_15: ld 15,-136(1)
-_restgpr0_16: ld 16,-128(1)
-_restgpr0_17: ld 17,-120(1)
-_restgpr0_18: ld 18,-112(1)
-_restgpr0_19: ld 19,-104(1)
-_restgpr0_20: ld 20,-96(1)
-_restgpr0_21: ld 21,-88(1)
-_restgpr0_22: ld 22,-80(1)
-_restgpr0_23: ld 23,-72(1)
-_restgpr0_24: ld 24,-64(1)
-_restgpr0_25: ld 25,-56(1)
-_restgpr0_26: ld 26,-48(1)
-_restgpr0_27: ld 27,-40(1)
-_restgpr0_28: ld 28,-32(1)
-_restgpr0_29:
-    ld 0, 16(1)
-    ld 29,-24(1)
-    mtlr 0
-    ld 30,-16(1)
-    ld 31,-8(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-_restgpr0_30: ld 30,-16(1)
-_restgpr0_31: ld 0, 16(1)
-    ld 31,-8(1)
-    mtlr 0
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _savegpr1_N routine saves the general registers from rN to r31,
- * inclusive. When the routine is called, r12
- * must point to the start of the general register save area.
- */
-_savegpr1_14: std 14,-144(12)
-_savegpr1_15: std 15,-136(12)
-_savegpr1_16: std 16,-128(12)
-_savegpr1_17: std 17,-120(12)
-_savegpr1_18: std 18,-112(12)
-_savegpr1_19: std 19,-104(12)
-_savegpr1_20: std 20,-96(12)
-_savegpr1_21: std 21,-88(12)
-_savegpr1_22: std 22,-80(12)
-_savegpr1_23: std 23,-72(12)
-_savegpr1_24: std 24,-64(12)
-_savegpr1_25: std 25,-56(12)
-_savegpr1_26: std 26,-48(12)
-_savegpr1_27: std 27,-40(12)
-_savegpr1_28: std 28,-32(12)
-_savegpr1_29: std 29,-24(12)
-_savegpr1_30: std 30,-16(12)
-_savegpr1_31: std 31,-8(12)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* The _restgpr1_N routines restore the general registers from rN to r31.
- * When the routine is called, r12 must point to the start of the general
- * register save area.
- */
-_restgpr1_14: ld 14,-144(12)
-_restgpr1_15: ld 15,-136(12)
-_restgpr1_16: ld 16,-128(12)
-_restgpr1_17: ld 17,-120(12)
-_restgpr1_18: ld 18,-112(12)
-_restgpr1_19: ld 19,-104(12)
-_restgpr1_20: ld 20,-96(12)
-_restgpr1_21: ld 21,-88(12)
-_restgpr1_22: ld 22,-80(12)
-_restgpr1_23: ld 23,-72(12)
-_restgpr1_24: ld 24,-64(12)
-_restgpr1_25: ld 25,-56(12)
-_restgpr1_26: ld 26,-48(12)
-_restgpr1_27: ld 27,-40(12)
-_restgpr1_28: ld 28,-32(12)
-_restgpr1_29: ld 29,-24(12)
-_restgpr1_30: ld 30,-16(12)
-_restgpr1_31: ld 31,-8(12)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-/* Each _savefpr_M routine saves the floating point registers from fM to f31,
- * inclusive. When the routine is called, r1 must point to the start of the
- * floating point register save area, and r0 must contain the value of LR on
- * function entry.
- */
-_savefpr_14: stfd 14,-144(1)
-_savefpr_15: stfd 15,-136(1)
-_savefpr_16: stfd 16,-128(1)
-_savefpr_17: stfd 17,-120(1)
-_savefpr_18: stfd 18,-112(1)
-_savefpr_19: stfd 19,-104(1)
-_savefpr_20: stfd 20,-96(1)
-_savefpr_21: stfd 21,-88(1)
-_savefpr_22: stfd 22,-80(1)
-_savefpr_23: stfd 23,-72(1)
-_savefpr_24: stfd 24,-64(1)
-_savefpr_25: stfd 25,-56(1)
-_savefpr_26: stfd 26,-48(1)
-_savefpr_27: stfd 27,-40(1)
-_savefpr_28: stfd 28,-32(1)
-_savefpr_29: stfd 29,-24(1)
-_savefpr_30: stfd 30,-16(1)
-_savefpr_31: stfd 31,-8(1)
-    std 0, 16(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* The _restfpr_M routines restore the floating point registers from fM to f31.
- * When the routine is called, r1 must point to the start of the floating point
- * register save area.
- */
-_restfpr_14: lfd 14,-144(1)
-_restfpr_15: lfd 15,-136(1)
-_restfpr_16: lfd 16,-128(1)
-_restfpr_17: lfd 17,-120(1)
-_restfpr_18: lfd 18,-112(1)
-_restfpr_19: lfd 19,-104(1)
-_restfpr_20: lfd 20,-96(1)
-_restfpr_21: lfd 21,-88(1)
-_restfpr_22: lfd 22,-80(1)
-_restfpr_23: lfd 23,-72(1)
-_restfpr_24: lfd 24,-64(1)
-_restfpr_25: lfd 25,-56(1)
-_restfpr_26: lfd 26,-48(1)
-_restfpr_27: lfd 27,-40(1)
-_restfpr_28: lfd 28,-32(1)
-_restfpr_29:
-    ld 0, 16(1)
-    lfd 29,-24(1)
-    mtlr 0
-    lfd 30,-16(1)
-    lfd 31,-8(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-_restfpr_30: lfd 30,-16(1)
-_restfpr_31:
-    ld 0, 16(1)
-    lfd 31,-8(1)
-    mtlr 0
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _savevr_M routine saves the vector registers from vM to v31, inclusive.
- * When the routine is called, r0 must point to the word just beyound the end
- * of the vector register save area. On return the value of r0 is unchanged
- * while r12 may be modified.
- */
-/* commented out for now, unused
-_savevr_20: addi r12,r0,-192
-    stvx v20,r12,r0
-_savevr_21: addi r12,r0,-176
-    stvx v21,r12,r0
-_savevr_22: addi r12,r0,-160
-    stvx v22,r12,r0
-_savevr_23: addi r12,r0,-144
-    stvx v23,r12,r0
-_savevr_24: addi r12,r0,-128
-    stvx v24,r12,r0
-_savevr_25: addi r12,r0,-112
-    stvx v25,r12,r0
-_savevr_26: addi r12,r0,-96
-    stvx v26,r12,r0
-_savevr_27: addi r12,r0,-80
-    stvx v27,r12,r0
-_savevr_28: addi r12,r0,-64
-    stvx v28,r12,r0
-_savevr_29: addi r12,r0,-48
-    stvx v29,r12,r0
-_savevr_30: addi r12,r0,-32
-    stvx v30,r12,r0
-_savevr_31: addi r12,r0,-16
-    stvx v31,r12,r0
-    blr
-*/
-/* The _restvr_M routines restore the vector registers from vM to v31. When the
- * routine is called, r0 must point to the word just beyound the end of the
- * vector register save area. On return the value of r0 is unchanged while r12
- * may be modified.
- */
-/* commented out for now, unused
-_restvr_20: addi r12,r0,-192
-    lvx v20,r12,r0
-_restvr_21: addi r12,r0,-176
-    lvx v21,r12,r0
-_restvr_22: addi r12,r0,-160
-    lvx v22,r12,r0
-_restvr_23: addi r12,r0,-144
-    lvx v23,r12,r0
-_restvr_24: addi r12,r0,-128
-    lvx v24,r12,r0
-_restvr_25: addi r12,r0,-112
-    lvx v25,r12,r0
-_restvr_26: addi r12,r0,-96
-    lvx v26,r12,r0
-_restvr_27: addi r12,r0,-80
-    lvx v27,r12,r0
-_restvr_28: addi r12,r0,-64
-    lvx v28,r12,r0
-_restvr_29: addi r12,r0,-48
-    lvx v29,r12,r0
-_restvr_30: addi r12,r0,-32
-    lvx v30,r12,r0
-_restvr_31: addi r12,r0,-16
-    lvx v31,r12,r0
-    blr
-*/
-
-/*
- * start_addresses is a structure containing the real
- * entry point (next to other things not interesting to
- * us here).
- *
- * All references in the struct are function descriptors
- *
- */
-    .section ".rodata"
-    .align  3
-start_addresses:
-    .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
-    .quad   main_stub
-    .quad   __libc_csu_init
-    .quad   __libc_csu_fini
-    .size   start_adresses, .-start_addresses
-
-/*
- * the real entry point for the program
- */
-FUNCTION_PROLOG _start
-    mr  9,1                   /* save the stack pointer */
-
-    /* Set up an initial stack frame, and clear the LR.  */
-
-    clrrdi  1,1,4
-    li      0,0
-    stdu    1,-128(1)
-    mtlr    0
-    std     0,0(1)
-
-    /* put the address of start_addresses in r8...  */
-    /* PPC64 ABI uses R13 for thread local, so we leave it alone */
-    LOAD_64BIT_VAL 8, start_addresses
-
-    b   .__libc_start_main
-    nop                      /* a NOP for the linker */
-
-/*
- * This is our FreePascal main procedure which is called by
- * libc after initializing.
- */
-
-FUNCTION_PROLOG main_stub
-    mflr    0
-    std     0,16(1)
-    stdu    1,-128(1)
-
-    LOAD_64BIT_VAL 8, operatingsystem_parameter_argc
-    stw     3,0(8)
-
-    LOAD_64BIT_VAL 8, operatingsystem_parameter_argv
-    std     4,0(8)
-
-    LOAD_64BIT_VAL 8, operatingsystem_parameter_envp
-    std     5,0(8)
-
-    LOAD_64BIT_VAL 8, __stkptr
-    std     1,0(8)
-
-    LOAD_64BIT_VAL 8, ___fpc_ret
-    std     1,0(8)
-
-    bl  .PASCALMAIN
-    nop
-
-    b   ._haltproc
-
-FUNCTION_PROLOG _haltproc
-    LOAD_64BIT_VAL 8, ___fpc_ret
-    ld      1, 0(8)
-    addi    1, 1, 128
-    ld      0, 16(1)
-    mtlr    0
-    blr
-
-#    li      0,1          /* exit call */
-#    sc
-#    b  ._haltproc
-
-    /* Define a symbol for the first piece of initialized data.  */
-    .section ".data"
-    .globl  __data_start
-__data_start:
-data_start:
-
-___fpc_ret:                            /* return address to libc */
-    .quad   0
-
-.text
-    .comm __stkptr, 8
-
-    .comm operatingsystem_parameter_argc, 4
-    .comm operatingsystem_parameter_argv, 8
-    .comm operatingsystem_parameter_envp, 8
+/*
+ * Startup code for programs linked with GNU libc, PowerPC64
+ * version.
+ *
+ * Adapted from the glibc-sources (2.3.5) in the file
+ *
+ *     sysdeps/powerpc/powerpc64/elf/start.S
+ *
+ * Original header follows.
+ */
+
+/* Startup code for programs linked with GNU libc.  PowerPC64 version.
+   Copyright (C) 1998,1999,2000,2001,2002,2003 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.
+
+   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.  */
+
+/* some macros which simplify the startup code */
+
+/* load the 64 bit value "value" into register ra */
+.macro LOAD_64BIT_VAL ra, value
+    lis       \ra,\value@highest
+    ori       \ra,\ra,\value@higher
+    sldi      \ra,\ra,32
+    oris      \ra,\ra,\value@h
+    ori       \ra,\ra,\value@l
+.endm
+
+/* create function prolog for symbol "fn" */
+.macro FUNCTION_PROLOG fn
+    .section  ".text"
+    .align    2
+    .globl    \fn
+    .section  ".opd", "aw"
+    .align    3
+\fn:
+    .quad     .\fn, .TOC.@tocbase, 0
+    .previous
+    .size     \fn, 24
+    .type     \fn, @function
+    .globl    .\fn
+.\fn:
+.endm
+
+/*
+ * "ptrgl" glue code for calls via pointer. This function
+ * sequence loads the data from the function descriptor
+ * referenced by R11 into the CTR register (function address),
+ * R2 (GOT/TOC pointer), and R11 (the outer frame pointer).
+ *
+ * On entry, R11 must be set to point to the function descriptor.
+ *
+ * See also the 64-bit PowerPC ABI specification for more
+ * information, chapter 3.5.11 (in v1.7).
+ */
+.section ".text"
+.align 3
+.globl .ptrgl
+.ptrgl:
+    ld	    0, 0(11)
+    std     2, 40(1)
+    mtctr   0
+    ld      2, 8(11)
+    ld      11, 8(11)
+    bctr
+.long 0
+.byte 0, 12, 128, 0, 0, 0, 0, 0
+.type .ptrgl, @function
+.size .ptrgl, . - .ptrgl
+
+/*
+ * Function prolog/epilog helpers, which are part of the 64-bit
+ * PowerPC ABI.
+ *
+ * See also the 64-bit PowerPC ABI specification for more
+ * information, chapter 3.5.5, "Register saving and restoring
+ * function" (in v1.7).
+ */
+
+/* Each _savegpr0_N routine saves the general registers from rN to r31,
+ * inclusive. When the routine is called, r1 must point to the start
+ * of the general register save area. R0 must contain the old LR on
+ * entry.
+ */
+_savegpr0_14: std 14,-144(1)
+_savegpr0_15: std 15,-136(1)
+_savegpr0_16: std 16,-128(1)
+_savegpr0_17: std 17,-120(1)
+_savegpr0_18: std 18,-112(1)
+_savegpr0_19: std 19,-104(1)
+_savegpr0_20: std 20,-96(1)
+_savegpr0_21: std 21,-88(1)
+_savegpr0_22: std 22,-80(1)
+_savegpr0_23: std 23,-72(1)
+_savegpr0_24: std 24,-64(1)
+_savegpr0_25: std 25,-56(1)
+_savegpr0_26: std 26,-48(1)
+_savegpr0_27: std 27,-40(1)
+_savegpr0_28: std 28,-32(1)
+_savegpr0_29: std 29,-24(1)
+_savegpr0_30: std 30,-16(1)
+_savegpr0_31:
+    std 31,-8(1)
+    std 0, 16(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _restgpr0_N routine restores the general registers from rN to r31,
+ * inclusive. When the routine is called, r1 must point to the start
+ * of the general register save area.
+ */
+_restgpr0_14: ld 14,-144(1)
+_restgpr0_15: ld 15,-136(1)
+_restgpr0_16: ld 16,-128(1)
+_restgpr0_17: ld 17,-120(1)
+_restgpr0_18: ld 18,-112(1)
+_restgpr0_19: ld 19,-104(1)
+_restgpr0_20: ld 20,-96(1)
+_restgpr0_21: ld 21,-88(1)
+_restgpr0_22: ld 22,-80(1)
+_restgpr0_23: ld 23,-72(1)
+_restgpr0_24: ld 24,-64(1)
+_restgpr0_25: ld 25,-56(1)
+_restgpr0_26: ld 26,-48(1)
+_restgpr0_27: ld 27,-40(1)
+_restgpr0_28: ld 28,-32(1)
+_restgpr0_29:
+    ld 0, 16(1)
+    ld 29,-24(1)
+    mtlr 0
+    ld 30,-16(1)
+    ld 31,-8(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+_restgpr0_30: ld 30,-16(1)
+_restgpr0_31: ld 0, 16(1)
+    ld 31,-8(1)
+    mtlr 0
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _savegpr1_N routine saves the general registers from rN to r31,
+ * inclusive. When the routine is called, r12
+ * must point to the start of the general register save area.
+ */
+_savegpr1_14: std 14,-144(12)
+_savegpr1_15: std 15,-136(12)
+_savegpr1_16: std 16,-128(12)
+_savegpr1_17: std 17,-120(12)
+_savegpr1_18: std 18,-112(12)
+_savegpr1_19: std 19,-104(12)
+_savegpr1_20: std 20,-96(12)
+_savegpr1_21: std 21,-88(12)
+_savegpr1_22: std 22,-80(12)
+_savegpr1_23: std 23,-72(12)
+_savegpr1_24: std 24,-64(12)
+_savegpr1_25: std 25,-56(12)
+_savegpr1_26: std 26,-48(12)
+_savegpr1_27: std 27,-40(12)
+_savegpr1_28: std 28,-32(12)
+_savegpr1_29: std 29,-24(12)
+_savegpr1_30: std 30,-16(12)
+_savegpr1_31: std 31,-8(12)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* The _restgpr1_N routines restore the general registers from rN to r31.
+ * When the routine is called, r12 must point to the start of the general
+ * register save area.
+ */
+_restgpr1_14: ld 14,-144(12)
+_restgpr1_15: ld 15,-136(12)
+_restgpr1_16: ld 16,-128(12)
+_restgpr1_17: ld 17,-120(12)
+_restgpr1_18: ld 18,-112(12)
+_restgpr1_19: ld 19,-104(12)
+_restgpr1_20: ld 20,-96(12)
+_restgpr1_21: ld 21,-88(12)
+_restgpr1_22: ld 22,-80(12)
+_restgpr1_23: ld 23,-72(12)
+_restgpr1_24: ld 24,-64(12)
+_restgpr1_25: ld 25,-56(12)
+_restgpr1_26: ld 26,-48(12)
+_restgpr1_27: ld 27,-40(12)
+_restgpr1_28: ld 28,-32(12)
+_restgpr1_29: ld 29,-24(12)
+_restgpr1_30: ld 30,-16(12)
+_restgpr1_31: ld 31,-8(12)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+/* Each _savefpr_M routine saves the floating point registers from fM to f31,
+ * inclusive. When the routine is called, r1 must point to the start of the
+ * floating point register save area, and r0 must contain the value of LR on
+ * function entry.
+ */
+_savefpr_14: stfd 14,-144(1)
+_savefpr_15: stfd 15,-136(1)
+_savefpr_16: stfd 16,-128(1)
+_savefpr_17: stfd 17,-120(1)
+_savefpr_18: stfd 18,-112(1)
+_savefpr_19: stfd 19,-104(1)
+_savefpr_20: stfd 20,-96(1)
+_savefpr_21: stfd 21,-88(1)
+_savefpr_22: stfd 22,-80(1)
+_savefpr_23: stfd 23,-72(1)
+_savefpr_24: stfd 24,-64(1)
+_savefpr_25: stfd 25,-56(1)
+_savefpr_26: stfd 26,-48(1)
+_savefpr_27: stfd 27,-40(1)
+_savefpr_28: stfd 28,-32(1)
+_savefpr_29: stfd 29,-24(1)
+_savefpr_30: stfd 30,-16(1)
+_savefpr_31: stfd 31,-8(1)
+    std 0, 16(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* The _restfpr_M routines restore the floating point registers from fM to f31.
+ * When the routine is called, r1 must point to the start of the floating point
+ * register save area.
+ */
+_restfpr_14: lfd 14,-144(1)
+_restfpr_15: lfd 15,-136(1)
+_restfpr_16: lfd 16,-128(1)
+_restfpr_17: lfd 17,-120(1)
+_restfpr_18: lfd 18,-112(1)
+_restfpr_19: lfd 19,-104(1)
+_restfpr_20: lfd 20,-96(1)
+_restfpr_21: lfd 21,-88(1)
+_restfpr_22: lfd 22,-80(1)
+_restfpr_23: lfd 23,-72(1)
+_restfpr_24: lfd 24,-64(1)
+_restfpr_25: lfd 25,-56(1)
+_restfpr_26: lfd 26,-48(1)
+_restfpr_27: lfd 27,-40(1)
+_restfpr_28: lfd 28,-32(1)
+_restfpr_29:
+    ld 0, 16(1)
+    lfd 29,-24(1)
+    mtlr 0
+    lfd 30,-16(1)
+    lfd 31,-8(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+_restfpr_30: lfd 30,-16(1)
+_restfpr_31:
+    ld 0, 16(1)
+    lfd 31,-8(1)
+    mtlr 0
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _savevr_M routine saves the vector registers from vM to v31, inclusive.
+ * When the routine is called, r0 must point to the word just beyound the end
+ * of the vector register save area. On return the value of r0 is unchanged
+ * while r12 may be modified.
+ */
+/* commented out for now, unused
+_savevr_20: addi r12,r0,-192
+    stvx v20,r12,r0
+_savevr_21: addi r12,r0,-176
+    stvx v21,r12,r0
+_savevr_22: addi r12,r0,-160
+    stvx v22,r12,r0
+_savevr_23: addi r12,r0,-144
+    stvx v23,r12,r0
+_savevr_24: addi r12,r0,-128
+    stvx v24,r12,r0
+_savevr_25: addi r12,r0,-112
+    stvx v25,r12,r0
+_savevr_26: addi r12,r0,-96
+    stvx v26,r12,r0
+_savevr_27: addi r12,r0,-80
+    stvx v27,r12,r0
+_savevr_28: addi r12,r0,-64
+    stvx v28,r12,r0
+_savevr_29: addi r12,r0,-48
+    stvx v29,r12,r0
+_savevr_30: addi r12,r0,-32
+    stvx v30,r12,r0
+_savevr_31: addi r12,r0,-16
+    stvx v31,r12,r0
+    blr
+*/
+/* The _restvr_M routines restore the vector registers from vM to v31. When the
+ * routine is called, r0 must point to the word just beyound the end of the
+ * vector register save area. On return the value of r0 is unchanged while r12
+ * may be modified.
+ */
+/* commented out for now, unused
+_restvr_20: addi r12,r0,-192
+    lvx v20,r12,r0
+_restvr_21: addi r12,r0,-176
+    lvx v21,r12,r0
+_restvr_22: addi r12,r0,-160
+    lvx v22,r12,r0
+_restvr_23: addi r12,r0,-144
+    lvx v23,r12,r0
+_restvr_24: addi r12,r0,-128
+    lvx v24,r12,r0
+_restvr_25: addi r12,r0,-112
+    lvx v25,r12,r0
+_restvr_26: addi r12,r0,-96
+    lvx v26,r12,r0
+_restvr_27: addi r12,r0,-80
+    lvx v27,r12,r0
+_restvr_28: addi r12,r0,-64
+    lvx v28,r12,r0
+_restvr_29: addi r12,r0,-48
+    lvx v29,r12,r0
+_restvr_30: addi r12,r0,-32
+    lvx v30,r12,r0
+_restvr_31: addi r12,r0,-16
+    lvx v31,r12,r0
+    blr
+*/
+
+/*
+ * start_addresses is a structure containing the real
+ * entry point (next to other things not interesting to
+ * us here).
+ *
+ * All references in the struct are function descriptors
+ *
+ */
+    .section ".rodata"
+    .align  3
+start_addresses:
+    .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
+    .quad   main_stub
+    .quad   __libc_csu_init
+    .quad   __libc_csu_fini
+    .size   start_adresses, .-start_addresses
+
+/*
+ * the real entry point for the program
+ */
+FUNCTION_PROLOG _start
+    mr  9,1                   /* save the stack pointer */
+
+    /* Set up an initial stack frame, and clear the LR.  */
+
+    clrrdi  1,1,4
+    li      0,0
+    stdu    1,-128(1)
+    mtlr    0
+    std     0,0(1)
+
+    /* put the address of start_addresses in r8...  */
+    /* PPC64 ABI uses R13 for thread local, so we leave it alone */
+    LOAD_64BIT_VAL 8, start_addresses
+
+    b   .__libc_start_main
+    nop                      /* a NOP for the linker */
+
+/*
+ * This is our FreePascal main procedure which is called by
+ * libc after initializing.
+ */
+
+FUNCTION_PROLOG main_stub
+    mflr    0
+    std     0,16(1)
+    stdu    1,-128(1)
+
+    LOAD_64BIT_VAL 8, operatingsystem_parameter_argc
+    stw     3,0(8)
+
+    LOAD_64BIT_VAL 8, operatingsystem_parameter_argv
+    std     4,0(8)
+
+    LOAD_64BIT_VAL 8, operatingsystem_parameter_envp
+    std     5,0(8)
+
+    LOAD_64BIT_VAL 8, __stkptr
+    std     1,0(8)
+
+    LOAD_64BIT_VAL 8, ___fpc_ret
+    std     1,0(8)
+
+    bl  .PASCALMAIN
+    nop
+
+    b   ._haltproc
+
+FUNCTION_PROLOG _haltproc
+    LOAD_64BIT_VAL 8, ___fpc_ret
+    ld      1, 0(8)
+    addi    1, 1, 128
+    ld      0, 16(1)
+    mtlr    0
+    blr
+
+#    li      0,1          /* exit call */
+#    sc
+#    b  ._haltproc
+
+    /* Define a symbol for the first piece of initialized data.  */
+    .section ".data"
+    .globl  __data_start
+__data_start:
+data_start:
+
+___fpc_ret:                            /* return address to libc */
+    .quad   0
+
+.text
+    .comm __stkptr, 8
+
+    .comm operatingsystem_parameter_argc, 4
+    .comm operatingsystem_parameter_argv, 8
+    .comm operatingsystem_parameter_envp, 8

+ 441 - 441
rtl/linux/powerpc64/gprt0.as

@@ -1,441 +1,441 @@
-/*
- * Startup code for programs linked with GNU libc, PowerPC64
- * version.
- *
- * Adapted from the glibc-sources (2.3.5) in the file
- *
- *     sysdeps/powerpc/powerpc64/elf/start.S
- *
- * Original header follows.
- */
-
-/* Startup code for programs linked with GNU libc.  PowerPC64 version.
-   Copyright (C) 1998,1999,2000,2001,2002,2003 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.
-
-   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.  */
-
-/* some macros which simplify the startup code */
-
-/* load the 64 bit value "value" into register ra */
-.macro LOAD_64BIT_VAL ra, value
-    lis       \ra,\value@highest
-    ori       \ra,\ra,\value@higher
-    sldi      \ra,\ra,32
-    oris      \ra,\ra,\value@h
-    ori       \ra,\ra,\value@l
-.endm
-
-/* create function prolog for symbol "fn" */
-.macro FUNCTION_PROLOG fn
-    .section  ".text"
-    .align    2
-    .globl    \fn
-    .section  ".opd", "aw"
-    .align    3
-\fn:
-    .quad     .\fn, .TOC.@tocbase, 0
-    .previous
-    .size     \fn, 24
-    .type     \fn, @function
-    .globl    .\fn
-.\fn:
-.endm
-
-/*
- * "ptrgl" glue code for calls via pointer. This function
- * sequence loads the data from the function descriptor
- * referenced by R11 into the CTR register (function address),
- * R2 (GOT/TOC pointer), and R11 (the outer frame pointer).
- *
- * On entry, R11 must be set to point to the function descriptor.
- *
- * See also the 64-bit PowerPC ABI specification for more
- * information, chapter 3.5.11 (in v1.7).
- */
-.section ".text"
-.align 3
-.globl .ptrgl
-.ptrgl:
-    ld	    0, 0(11)
-    std     2, 40(1)
-    mtctr   0
-    ld      2, 8(11)
-    ld      11, 8(11)
-    bctr
-.long 0
-.byte 0, 12, 128, 0, 0, 0, 0, 0
-.type .ptrgl, @function
-.size .ptrgl, . - .ptrgl
-
-/*
- * Function prolog/epilog helpers, which are part of the 64-bit
- * PowerPC ABI.
- *
- * See also the 64-bit PowerPC ABI specification for more
- * information, chapter 3.5.5, "Register saving and restoring
- * function" (in v1.7).
- */
-
-/* Each _savegpr0_N routine saves the general registers from rN to r31,
- * inclusive. When the routine is called, r1 must point to the start
- * of the general register save area. R0 must contain the old LR on
- * entry.
- */
-_savegpr0_14: std 14,-144(1)
-_savegpr0_15: std 15,-136(1)
-_savegpr0_16: std 16,-128(1)
-_savegpr0_17: std 17,-120(1)
-_savegpr0_18: std 18,-112(1)
-_savegpr0_19: std 19,-104(1)
-_savegpr0_20: std 20,-96(1)
-_savegpr0_21: std 21,-88(1)
-_savegpr0_22: std 22,-80(1)
-_savegpr0_23: std 23,-72(1)
-_savegpr0_24: std 24,-64(1)
-_savegpr0_25: std 25,-56(1)
-_savegpr0_26: std 26,-48(1)
-_savegpr0_27: std 27,-40(1)
-_savegpr0_28: std 28,-32(1)
-_savegpr0_29: std 29,-24(1)
-_savegpr0_30: std 30,-16(1)
-_savegpr0_31:
-    std 31,-8(1)
-    std 0, 16(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _restgpr0_N routine restores the general registers from rN to r31,
- * inclusive. When the routine is called, r1 must point to the start
- * of the general register save area.
- */
-_restgpr0_14: ld 14,-144(1)
-_restgpr0_15: ld 15,-136(1)
-_restgpr0_16: ld 16,-128(1)
-_restgpr0_17: ld 17,-120(1)
-_restgpr0_18: ld 18,-112(1)
-_restgpr0_19: ld 19,-104(1)
-_restgpr0_20: ld 20,-96(1)
-_restgpr0_21: ld 21,-88(1)
-_restgpr0_22: ld 22,-80(1)
-_restgpr0_23: ld 23,-72(1)
-_restgpr0_24: ld 24,-64(1)
-_restgpr0_25: ld 25,-56(1)
-_restgpr0_26: ld 26,-48(1)
-_restgpr0_27: ld 27,-40(1)
-_restgpr0_28: ld 28,-32(1)
-_restgpr0_29:
-    ld 0, 16(1)
-    ld 29,-24(1)
-    mtlr 0
-    ld 30,-16(1)
-    ld 31,-8(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-_restgpr0_30: ld 30,-16(1)
-_restgpr0_31: ld 0, 16(1)
-    ld 31,-8(1)
-    mtlr 0
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _savegpr1_N routine saves the general registers from rN to r31,
- * inclusive. When the routine is called, r12
- * must point to the start of the general register save area.
- */
-_savegpr1_14: std 14,-144(12)
-_savegpr1_15: std 15,-136(12)
-_savegpr1_16: std 16,-128(12)
-_savegpr1_17: std 17,-120(12)
-_savegpr1_18: std 18,-112(12)
-_savegpr1_19: std 19,-104(12)
-_savegpr1_20: std 20,-96(12)
-_savegpr1_21: std 21,-88(12)
-_savegpr1_22: std 22,-80(12)
-_savegpr1_23: std 23,-72(12)
-_savegpr1_24: std 24,-64(12)
-_savegpr1_25: std 25,-56(12)
-_savegpr1_26: std 26,-48(12)
-_savegpr1_27: std 27,-40(12)
-_savegpr1_28: std 28,-32(12)
-_savegpr1_29: std 29,-24(12)
-_savegpr1_30: std 30,-16(12)
-_savegpr1_31: std 31,-8(12)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* The _restgpr1_N routines restore the general registers from rN to r31.
- * When the routine is called, r12 must point to the start of the general
- * register save area.
- */
-_restgpr1_14: ld 14,-144(12)
-_restgpr1_15: ld 15,-136(12)
-_restgpr1_16: ld 16,-128(12)
-_restgpr1_17: ld 17,-120(12)
-_restgpr1_18: ld 18,-112(12)
-_restgpr1_19: ld 19,-104(12)
-_restgpr1_20: ld 20,-96(12)
-_restgpr1_21: ld 21,-88(12)
-_restgpr1_22: ld 22,-80(12)
-_restgpr1_23: ld 23,-72(12)
-_restgpr1_24: ld 24,-64(12)
-_restgpr1_25: ld 25,-56(12)
-_restgpr1_26: ld 26,-48(12)
-_restgpr1_27: ld 27,-40(12)
-_restgpr1_28: ld 28,-32(12)
-_restgpr1_29: ld 29,-24(12)
-_restgpr1_30: ld 30,-16(12)
-_restgpr1_31: ld 31,-8(12)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-/* Each _savefpr_M routine saves the floating point registers from fM to f31,
- * inclusive. When the routine is called, r1 must point to the start of the
- * floating point register save area, and r0 must contain the value of LR on
- * function entry.
- */
-_savefpr_14: stfd 14,-144(1)
-_savefpr_15: stfd 15,-136(1)
-_savefpr_16: stfd 16,-128(1)
-_savefpr_17: stfd 17,-120(1)
-_savefpr_18: stfd 18,-112(1)
-_savefpr_19: stfd 19,-104(1)
-_savefpr_20: stfd 20,-96(1)
-_savefpr_21: stfd 21,-88(1)
-_savefpr_22: stfd 22,-80(1)
-_savefpr_23: stfd 23,-72(1)
-_savefpr_24: stfd 24,-64(1)
-_savefpr_25: stfd 25,-56(1)
-_savefpr_26: stfd 26,-48(1)
-_savefpr_27: stfd 27,-40(1)
-_savefpr_28: stfd 28,-32(1)
-_savefpr_29: stfd 29,-24(1)
-_savefpr_30: stfd 30,-16(1)
-_savefpr_31: stfd 31,-8(1)
-    std 0, 16(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* The _restfpr_M routines restore the floating point registers from fM to f31.
- * When the routine is called, r1 must point to the start of the floating point
- * register save area.
- */
-_restfpr_14: lfd 14,-144(1)
-_restfpr_15: lfd 15,-136(1)
-_restfpr_16: lfd 16,-128(1)
-_restfpr_17: lfd 17,-120(1)
-_restfpr_18: lfd 18,-112(1)
-_restfpr_19: lfd 19,-104(1)
-_restfpr_20: lfd 20,-96(1)
-_restfpr_21: lfd 21,-88(1)
-_restfpr_22: lfd 22,-80(1)
-_restfpr_23: lfd 23,-72(1)
-_restfpr_24: lfd 24,-64(1)
-_restfpr_25: lfd 25,-56(1)
-_restfpr_26: lfd 26,-48(1)
-_restfpr_27: lfd 27,-40(1)
-_restfpr_28: lfd 28,-32(1)
-_restfpr_29:
-    ld 0, 16(1)
-    lfd 29,-24(1)
-    mtlr 0
-    lfd 30,-16(1)
-    lfd 31,-8(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-_restfpr_30: lfd 30,-16(1)
-_restfpr_31:
-    ld 0, 16(1)
-    lfd 31,-8(1)
-    mtlr 0
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _savevr_M routine saves the vector registers from vM to v31, inclusive.
- * When the routine is called, r0 must point to the word just beyound the end
- * of the vector register save area. On return the value of r0 is unchanged
- * while r12 may be modified.
- */
-/* commented out for now, unused
-_savevr_20: addi r12,r0,-192
-    stvx v20,r12,r0
-_savevr_21: addi r12,r0,-176
-    stvx v21,r12,r0
-_savevr_22: addi r12,r0,-160
-    stvx v22,r12,r0
-_savevr_23: addi r12,r0,-144
-    stvx v23,r12,r0
-_savevr_24: addi r12,r0,-128
-    stvx v24,r12,r0
-_savevr_25: addi r12,r0,-112
-    stvx v25,r12,r0
-_savevr_26: addi r12,r0,-96
-    stvx v26,r12,r0
-_savevr_27: addi r12,r0,-80
-    stvx v27,r12,r0
-_savevr_28: addi r12,r0,-64
-    stvx v28,r12,r0
-_savevr_29: addi r12,r0,-48
-    stvx v29,r12,r0
-_savevr_30: addi r12,r0,-32
-    stvx v30,r12,r0
-_savevr_31: addi r12,r0,-16
-    stvx v31,r12,r0
-    blr
-*/
-/* The _restvr_M routines restore the vector registers from vM to v31. When the
- * routine is called, r0 must point to the word just beyound the end of the
- * vector register save area. On return the value of r0 is unchanged while r12
- * may be modified.
- */
-/* commented out for now, unused
-_restvr_20: addi r12,r0,-192
-    lvx v20,r12,r0
-_restvr_21: addi r12,r0,-176
-    lvx v21,r12,r0
-_restvr_22: addi r12,r0,-160
-    lvx v22,r12,r0
-_restvr_23: addi r12,r0,-144
-    lvx v23,r12,r0
-_restvr_24: addi r12,r0,-128
-    lvx v24,r12,r0
-_restvr_25: addi r12,r0,-112
-    lvx v25,r12,r0
-_restvr_26: addi r12,r0,-96
-    lvx v26,r12,r0
-_restvr_27: addi r12,r0,-80
-    lvx v27,r12,r0
-_restvr_28: addi r12,r0,-64
-    lvx v28,r12,r0
-_restvr_29: addi r12,r0,-48
-    lvx v29,r12,r0
-_restvr_30: addi r12,r0,-32
-    lvx v30,r12,r0
-_restvr_31: addi r12,r0,-16
-    lvx v31,r12,r0
-    blr
-*/
-
-/*
- * start_addresses is a structure containing the real
- * entry point (next to other things not interesting to
- * us here).
- *
- * All references in the struct are function descriptors
- *
- */
-    .section ".rodata"
-    .align  3
-start_addresses:
-    .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
-    .quad   main_stub
-    .quad   __libc_csu_init
-    .quad   __libc_csu_fini
-    .size   start_adresses, .-start_addresses
-
-/*
- * the real entry point for the program
- */
-FUNCTION_PROLOG _start
-    mr  9,1                   /* save the stack pointer */
-
-    /* Set up an initial stack frame, and clear the LR.  */
-
-    clrrdi  1,1,4
-    li      0,0
-    stdu    1,-128(1)
-    mtlr    0
-    std     0,0(1)
-
-    /* put the address of start_addresses in r8...  */
-    /* PPC64 ABI uses R13 for thread local, so we leave it alone */
-    LOAD_64BIT_VAL 8, start_addresses
-
-    b   .__libc_start_main
-    nop                      /* a NOP for the linker */
-
-/*
- * This is our FreePascal main procedure which is called by
- * libc after initializing.
- */
-
-FUNCTION_PROLOG main_stub
-    mflr    0
-    std     0,16(1)
-    stdu    1,-128(1)
-
-    LOAD_64BIT_VAL 8, operatingsystem_parameter_argc
-    stw     3,0(8)
-
-    LOAD_64BIT_VAL 8, operatingsystem_parameter_argv
-    std     4,0(8)
-
-    LOAD_64BIT_VAL 8, operatingsystem_parameter_envp
-    std     5,0(8)
-
-    LOAD_64BIT_VAL 8, __stkptr
-    std     1,0(8)
-
-    LOAD_64BIT_VAL 8, ___fpc_ret
-    std     1,0(8)
-
-    LOAD_64BIT_VAL 3, _start
-    ld 3, 0(3)
-    LOAD_64BIT_VAL 4, etext
-    bl  .__monstartup
-    nop
-
-    LOAD_64BIT_VAL 3, _mcleanup
-    bl .atexit
-    nop
-
-    bl  .PASCALMAIN
-    nop
-
-    b   ._haltproc
-
-FUNCTION_PROLOG _haltproc
-    LOAD_64BIT_VAL 8, ___fpc_ret
-    ld      1, 0(8)
-    addi    1, 1, 128
-    ld      0, 16(1)
-    mtlr    0
-    blr
-
-    /* Define a symbol for the first piece of initialized data.  */
-    .section ".data"
-    .globl  __data_start
-__data_start:
-data_start:
-
-___fpc_ret:                            /* return address to libc */
-    .quad   0
-
-.text
-    .comm __stkptr, 8
-
-    .comm operatingsystem_parameter_argc, 4
-    .comm operatingsystem_parameter_argv, 8
-    .comm operatingsystem_parameter_envp, 8
+/*
+ * Startup code for programs linked with GNU libc, PowerPC64
+ * version.
+ *
+ * Adapted from the glibc-sources (2.3.5) in the file
+ *
+ *     sysdeps/powerpc/powerpc64/elf/start.S
+ *
+ * Original header follows.
+ */
+
+/* Startup code for programs linked with GNU libc.  PowerPC64 version.
+   Copyright (C) 1998,1999,2000,2001,2002,2003 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.
+
+   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.  */
+
+/* some macros which simplify the startup code */
+
+/* load the 64 bit value "value" into register ra */
+.macro LOAD_64BIT_VAL ra, value
+    lis       \ra,\value@highest
+    ori       \ra,\ra,\value@higher
+    sldi      \ra,\ra,32
+    oris      \ra,\ra,\value@h
+    ori       \ra,\ra,\value@l
+.endm
+
+/* create function prolog for symbol "fn" */
+.macro FUNCTION_PROLOG fn
+    .section  ".text"
+    .align    2
+    .globl    \fn
+    .section  ".opd", "aw"
+    .align    3
+\fn:
+    .quad     .\fn, .TOC.@tocbase, 0
+    .previous
+    .size     \fn, 24
+    .type     \fn, @function
+    .globl    .\fn
+.\fn:
+.endm
+
+/*
+ * "ptrgl" glue code for calls via pointer. This function
+ * sequence loads the data from the function descriptor
+ * referenced by R11 into the CTR register (function address),
+ * R2 (GOT/TOC pointer), and R11 (the outer frame pointer).
+ *
+ * On entry, R11 must be set to point to the function descriptor.
+ *
+ * See also the 64-bit PowerPC ABI specification for more
+ * information, chapter 3.5.11 (in v1.7).
+ */
+.section ".text"
+.align 3
+.globl .ptrgl
+.ptrgl:
+    ld	    0, 0(11)
+    std     2, 40(1)
+    mtctr   0
+    ld      2, 8(11)
+    ld      11, 8(11)
+    bctr
+.long 0
+.byte 0, 12, 128, 0, 0, 0, 0, 0
+.type .ptrgl, @function
+.size .ptrgl, . - .ptrgl
+
+/*
+ * Function prolog/epilog helpers, which are part of the 64-bit
+ * PowerPC ABI.
+ *
+ * See also the 64-bit PowerPC ABI specification for more
+ * information, chapter 3.5.5, "Register saving and restoring
+ * function" (in v1.7).
+ */
+
+/* Each _savegpr0_N routine saves the general registers from rN to r31,
+ * inclusive. When the routine is called, r1 must point to the start
+ * of the general register save area. R0 must contain the old LR on
+ * entry.
+ */
+_savegpr0_14: std 14,-144(1)
+_savegpr0_15: std 15,-136(1)
+_savegpr0_16: std 16,-128(1)
+_savegpr0_17: std 17,-120(1)
+_savegpr0_18: std 18,-112(1)
+_savegpr0_19: std 19,-104(1)
+_savegpr0_20: std 20,-96(1)
+_savegpr0_21: std 21,-88(1)
+_savegpr0_22: std 22,-80(1)
+_savegpr0_23: std 23,-72(1)
+_savegpr0_24: std 24,-64(1)
+_savegpr0_25: std 25,-56(1)
+_savegpr0_26: std 26,-48(1)
+_savegpr0_27: std 27,-40(1)
+_savegpr0_28: std 28,-32(1)
+_savegpr0_29: std 29,-24(1)
+_savegpr0_30: std 30,-16(1)
+_savegpr0_31:
+    std 31,-8(1)
+    std 0, 16(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _restgpr0_N routine restores the general registers from rN to r31,
+ * inclusive. When the routine is called, r1 must point to the start
+ * of the general register save area.
+ */
+_restgpr0_14: ld 14,-144(1)
+_restgpr0_15: ld 15,-136(1)
+_restgpr0_16: ld 16,-128(1)
+_restgpr0_17: ld 17,-120(1)
+_restgpr0_18: ld 18,-112(1)
+_restgpr0_19: ld 19,-104(1)
+_restgpr0_20: ld 20,-96(1)
+_restgpr0_21: ld 21,-88(1)
+_restgpr0_22: ld 22,-80(1)
+_restgpr0_23: ld 23,-72(1)
+_restgpr0_24: ld 24,-64(1)
+_restgpr0_25: ld 25,-56(1)
+_restgpr0_26: ld 26,-48(1)
+_restgpr0_27: ld 27,-40(1)
+_restgpr0_28: ld 28,-32(1)
+_restgpr0_29:
+    ld 0, 16(1)
+    ld 29,-24(1)
+    mtlr 0
+    ld 30,-16(1)
+    ld 31,-8(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+_restgpr0_30: ld 30,-16(1)
+_restgpr0_31: ld 0, 16(1)
+    ld 31,-8(1)
+    mtlr 0
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _savegpr1_N routine saves the general registers from rN to r31,
+ * inclusive. When the routine is called, r12
+ * must point to the start of the general register save area.
+ */
+_savegpr1_14: std 14,-144(12)
+_savegpr1_15: std 15,-136(12)
+_savegpr1_16: std 16,-128(12)
+_savegpr1_17: std 17,-120(12)
+_savegpr1_18: std 18,-112(12)
+_savegpr1_19: std 19,-104(12)
+_savegpr1_20: std 20,-96(12)
+_savegpr1_21: std 21,-88(12)
+_savegpr1_22: std 22,-80(12)
+_savegpr1_23: std 23,-72(12)
+_savegpr1_24: std 24,-64(12)
+_savegpr1_25: std 25,-56(12)
+_savegpr1_26: std 26,-48(12)
+_savegpr1_27: std 27,-40(12)
+_savegpr1_28: std 28,-32(12)
+_savegpr1_29: std 29,-24(12)
+_savegpr1_30: std 30,-16(12)
+_savegpr1_31: std 31,-8(12)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* The _restgpr1_N routines restore the general registers from rN to r31.
+ * When the routine is called, r12 must point to the start of the general
+ * register save area.
+ */
+_restgpr1_14: ld 14,-144(12)
+_restgpr1_15: ld 15,-136(12)
+_restgpr1_16: ld 16,-128(12)
+_restgpr1_17: ld 17,-120(12)
+_restgpr1_18: ld 18,-112(12)
+_restgpr1_19: ld 19,-104(12)
+_restgpr1_20: ld 20,-96(12)
+_restgpr1_21: ld 21,-88(12)
+_restgpr1_22: ld 22,-80(12)
+_restgpr1_23: ld 23,-72(12)
+_restgpr1_24: ld 24,-64(12)
+_restgpr1_25: ld 25,-56(12)
+_restgpr1_26: ld 26,-48(12)
+_restgpr1_27: ld 27,-40(12)
+_restgpr1_28: ld 28,-32(12)
+_restgpr1_29: ld 29,-24(12)
+_restgpr1_30: ld 30,-16(12)
+_restgpr1_31: ld 31,-8(12)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+/* Each _savefpr_M routine saves the floating point registers from fM to f31,
+ * inclusive. When the routine is called, r1 must point to the start of the
+ * floating point register save area, and r0 must contain the value of LR on
+ * function entry.
+ */
+_savefpr_14: stfd 14,-144(1)
+_savefpr_15: stfd 15,-136(1)
+_savefpr_16: stfd 16,-128(1)
+_savefpr_17: stfd 17,-120(1)
+_savefpr_18: stfd 18,-112(1)
+_savefpr_19: stfd 19,-104(1)
+_savefpr_20: stfd 20,-96(1)
+_savefpr_21: stfd 21,-88(1)
+_savefpr_22: stfd 22,-80(1)
+_savefpr_23: stfd 23,-72(1)
+_savefpr_24: stfd 24,-64(1)
+_savefpr_25: stfd 25,-56(1)
+_savefpr_26: stfd 26,-48(1)
+_savefpr_27: stfd 27,-40(1)
+_savefpr_28: stfd 28,-32(1)
+_savefpr_29: stfd 29,-24(1)
+_savefpr_30: stfd 30,-16(1)
+_savefpr_31: stfd 31,-8(1)
+    std 0, 16(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* The _restfpr_M routines restore the floating point registers from fM to f31.
+ * When the routine is called, r1 must point to the start of the floating point
+ * register save area.
+ */
+_restfpr_14: lfd 14,-144(1)
+_restfpr_15: lfd 15,-136(1)
+_restfpr_16: lfd 16,-128(1)
+_restfpr_17: lfd 17,-120(1)
+_restfpr_18: lfd 18,-112(1)
+_restfpr_19: lfd 19,-104(1)
+_restfpr_20: lfd 20,-96(1)
+_restfpr_21: lfd 21,-88(1)
+_restfpr_22: lfd 22,-80(1)
+_restfpr_23: lfd 23,-72(1)
+_restfpr_24: lfd 24,-64(1)
+_restfpr_25: lfd 25,-56(1)
+_restfpr_26: lfd 26,-48(1)
+_restfpr_27: lfd 27,-40(1)
+_restfpr_28: lfd 28,-32(1)
+_restfpr_29:
+    ld 0, 16(1)
+    lfd 29,-24(1)
+    mtlr 0
+    lfd 30,-16(1)
+    lfd 31,-8(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+_restfpr_30: lfd 30,-16(1)
+_restfpr_31:
+    ld 0, 16(1)
+    lfd 31,-8(1)
+    mtlr 0
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _savevr_M routine saves the vector registers from vM to v31, inclusive.
+ * When the routine is called, r0 must point to the word just beyound the end
+ * of the vector register save area. On return the value of r0 is unchanged
+ * while r12 may be modified.
+ */
+/* commented out for now, unused
+_savevr_20: addi r12,r0,-192
+    stvx v20,r12,r0
+_savevr_21: addi r12,r0,-176
+    stvx v21,r12,r0
+_savevr_22: addi r12,r0,-160
+    stvx v22,r12,r0
+_savevr_23: addi r12,r0,-144
+    stvx v23,r12,r0
+_savevr_24: addi r12,r0,-128
+    stvx v24,r12,r0
+_savevr_25: addi r12,r0,-112
+    stvx v25,r12,r0
+_savevr_26: addi r12,r0,-96
+    stvx v26,r12,r0
+_savevr_27: addi r12,r0,-80
+    stvx v27,r12,r0
+_savevr_28: addi r12,r0,-64
+    stvx v28,r12,r0
+_savevr_29: addi r12,r0,-48
+    stvx v29,r12,r0
+_savevr_30: addi r12,r0,-32
+    stvx v30,r12,r0
+_savevr_31: addi r12,r0,-16
+    stvx v31,r12,r0
+    blr
+*/
+/* The _restvr_M routines restore the vector registers from vM to v31. When the
+ * routine is called, r0 must point to the word just beyound the end of the
+ * vector register save area. On return the value of r0 is unchanged while r12
+ * may be modified.
+ */
+/* commented out for now, unused
+_restvr_20: addi r12,r0,-192
+    lvx v20,r12,r0
+_restvr_21: addi r12,r0,-176
+    lvx v21,r12,r0
+_restvr_22: addi r12,r0,-160
+    lvx v22,r12,r0
+_restvr_23: addi r12,r0,-144
+    lvx v23,r12,r0
+_restvr_24: addi r12,r0,-128
+    lvx v24,r12,r0
+_restvr_25: addi r12,r0,-112
+    lvx v25,r12,r0
+_restvr_26: addi r12,r0,-96
+    lvx v26,r12,r0
+_restvr_27: addi r12,r0,-80
+    lvx v27,r12,r0
+_restvr_28: addi r12,r0,-64
+    lvx v28,r12,r0
+_restvr_29: addi r12,r0,-48
+    lvx v29,r12,r0
+_restvr_30: addi r12,r0,-32
+    lvx v30,r12,r0
+_restvr_31: addi r12,r0,-16
+    lvx v31,r12,r0
+    blr
+*/
+
+/*
+ * start_addresses is a structure containing the real
+ * entry point (next to other things not interesting to
+ * us here).
+ *
+ * All references in the struct are function descriptors
+ *
+ */
+    .section ".rodata"
+    .align  3
+start_addresses:
+    .quad   0 /* was _SDA_BASE_  but not in 64-bit ABI*/
+    .quad   main_stub
+    .quad   __libc_csu_init
+    .quad   __libc_csu_fini
+    .size   start_adresses, .-start_addresses
+
+/*
+ * the real entry point for the program
+ */
+FUNCTION_PROLOG _start
+    mr  9,1                   /* save the stack pointer */
+
+    /* Set up an initial stack frame, and clear the LR.  */
+
+    clrrdi  1,1,4
+    li      0,0
+    stdu    1,-128(1)
+    mtlr    0
+    std     0,0(1)
+
+    /* put the address of start_addresses in r8...  */
+    /* PPC64 ABI uses R13 for thread local, so we leave it alone */
+    LOAD_64BIT_VAL 8, start_addresses
+
+    b   .__libc_start_main
+    nop                      /* a NOP for the linker */
+
+/*
+ * This is our FreePascal main procedure which is called by
+ * libc after initializing.
+ */
+
+FUNCTION_PROLOG main_stub
+    mflr    0
+    std     0,16(1)
+    stdu    1,-128(1)
+
+    LOAD_64BIT_VAL 8, operatingsystem_parameter_argc
+    stw     3,0(8)
+
+    LOAD_64BIT_VAL 8, operatingsystem_parameter_argv
+    std     4,0(8)
+
+    LOAD_64BIT_VAL 8, operatingsystem_parameter_envp
+    std     5,0(8)
+
+    LOAD_64BIT_VAL 8, __stkptr
+    std     1,0(8)
+
+    LOAD_64BIT_VAL 8, ___fpc_ret
+    std     1,0(8)
+
+    LOAD_64BIT_VAL 3, _start
+    ld 3, 0(3)
+    LOAD_64BIT_VAL 4, etext
+    bl  .__monstartup
+    nop
+
+    LOAD_64BIT_VAL 3, _mcleanup
+    bl .atexit
+    nop
+
+    bl  .PASCALMAIN
+    nop
+
+    b   ._haltproc
+
+FUNCTION_PROLOG _haltproc
+    LOAD_64BIT_VAL 8, ___fpc_ret
+    ld      1, 0(8)
+    addi    1, 1, 128
+    ld      0, 16(1)
+    mtlr    0
+    blr
+
+    /* Define a symbol for the first piece of initialized data.  */
+    .section ".data"
+    .globl  __data_start
+__data_start:
+data_start:
+
+___fpc_ret:                            /* return address to libc */
+    .quad   0
+
+.text
+    .comm __stkptr, 8
+
+    .comm operatingsystem_parameter_argc, 4
+    .comm operatingsystem_parameter_argv, 8
+    .comm operatingsystem_parameter_envp, 8

+ 378 - 378
rtl/linux/powerpc64/prt0.as

@@ -1,378 +1,378 @@
-/*
- * This file is part of the Free Pascal run time library.
- * Copyright (c) 2005 by Thomas Schatzl,
- * member of the Free Pascal development team.
- *
- * Startup code for normal programs, PowerPC64 version.
- *
- * 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.
- */
-
-.macro LOAD_64BIT_VAL ra, value
-    lis       \ra,\value@highest
-    ori       \ra,\ra,\value@higher
-    sldi      \ra,\ra,32
-    oris      \ra,\ra,\value@h
-    ori       \ra,\ra,\value@l
-.endm
-
-/* create function prolog for symbol "fn" */
-.macro FUNCTION_PROLOG fn
-    .section  ".text"
-    .align    2
-    .globl    \fn
-    .section  ".opd", "aw"
-    .align    3
-\fn:
-    .quad     .\fn, .TOC.@tocbase, 0
-    .previous
-    .size     \fn, 24
-    .type     \fn, @function
-    .globl    .\fn
-.\fn:
-.endm
-
-/*
- * "ptrgl" glue code for calls via pointer. This function
- * sequence loads the data from the function descriptor
- * referenced by R11 into the CTR register (function address),
- * R2 (GOT/TOC pointer), and R11 (the outer frame pointer).
- *
- * On entry, R11 must be set to point to the function descriptor.
- *
- * See also the 64-bit PowerPC ABI specification for more
- * information, chapter 3.5.11 (in v1.7).
- */
-.section ".text"
-.align 3
-.globl .ptrgl
-.ptrgl:
-    ld	    0, 0(11)
-    std     2, 40(1)
-    mtctr   0
-    ld      2, 8(11)
-    ld      11, 8(11)
-    bctr
-.long 0
-.byte 0, 12, 128, 0, 0, 0, 0, 0
-.type .ptrgl, @function
-.size .ptrgl, . - .ptrgl
-
-/*
- * Function prolog/epilog helpers, which are part of the 64-bit
- * PowerPC ABI.
- *
- * See also the 64-bit PowerPC ABI specification for more
- * information, chapter 3.5.5, "Register saving and restoring
- * function" (in v1.7).
- */
-
-/* Each _savegpr0_N routine saves the general registers from rN to r31,
- * inclusive. When the routine is called, r1 must point to the start
- * of the general register save area. R0 must contain the old LR on
- * entry.
- */
-_savegpr0_14: std 14,-144(1)
-_savegpr0_15: std 15,-136(1)
-_savegpr0_16: std 16,-128(1)
-_savegpr0_17: std 17,-120(1)
-_savegpr0_18: std 18,-112(1)
-_savegpr0_19: std 19,-104(1)
-_savegpr0_20: std 20,-96(1)
-_savegpr0_21: std 21,-88(1)
-_savegpr0_22: std 22,-80(1)
-_savegpr0_23: std 23,-72(1)
-_savegpr0_24: std 24,-64(1)
-_savegpr0_25: std 25,-56(1)
-_savegpr0_26: std 26,-48(1)
-_savegpr0_27: std 27,-40(1)
-_savegpr0_28: std 28,-32(1)
-_savegpr0_29: std 29,-24(1)
-_savegpr0_30: std 30,-16(1)
-_savegpr0_31:
-    std 31,-8(1)
-    std 0, 16(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _restgpr0_N routine restores the general registers from rN to r31,
- * inclusive. When the routine is called, r1 must point to the start
- * of the general register save area.
- */
-_restgpr0_14: ld 14,-144(1)
-_restgpr0_15: ld 15,-136(1)
-_restgpr0_16: ld 16,-128(1)
-_restgpr0_17: ld 17,-120(1)
-_restgpr0_18: ld 18,-112(1)
-_restgpr0_19: ld 19,-104(1)
-_restgpr0_20: ld 20,-96(1)
-_restgpr0_21: ld 21,-88(1)
-_restgpr0_22: ld 22,-80(1)
-_restgpr0_23: ld 23,-72(1)
-_restgpr0_24: ld 24,-64(1)
-_restgpr0_25: ld 25,-56(1)
-_restgpr0_26: ld 26,-48(1)
-_restgpr0_27: ld 27,-40(1)
-_restgpr0_28: ld 28,-32(1)
-_restgpr0_29:
-    ld 0, 16(1)
-    ld 29,-24(1)
-    mtlr 0
-    ld 30,-16(1)
-    ld 31,-8(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-_restgpr0_30: ld 30,-16(1)
-_restgpr0_31: ld 0, 16(1)
-    ld 31,-8(1)
-    mtlr 0
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _savegpr1_N routine saves the general registers from rN to r31,
- * inclusive. When the routine is called, r12
- * must point to the start of the general register save area.
- */
-_savegpr1_14: std 14,-144(12)
-_savegpr1_15: std 15,-136(12)
-_savegpr1_16: std 16,-128(12)
-_savegpr1_17: std 17,-120(12)
-_savegpr1_18: std 18,-112(12)
-_savegpr1_19: std 19,-104(12)
-_savegpr1_20: std 20,-96(12)
-_savegpr1_21: std 21,-88(12)
-_savegpr1_22: std 22,-80(12)
-_savegpr1_23: std 23,-72(12)
-_savegpr1_24: std 24,-64(12)
-_savegpr1_25: std 25,-56(12)
-_savegpr1_26: std 26,-48(12)
-_savegpr1_27: std 27,-40(12)
-_savegpr1_28: std 28,-32(12)
-_savegpr1_29: std 29,-24(12)
-_savegpr1_30: std 30,-16(12)
-_savegpr1_31: std 31,-8(12)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* The _restgpr1_N routines restore the general registers from rN to r31.
- * When the routine is called, r12 must point to the start of the general
- * register save area.
- */
-_restgpr1_14: ld 14,-144(12)
-_restgpr1_15: ld 15,-136(12)
-_restgpr1_16: ld 16,-128(12)
-_restgpr1_17: ld 17,-120(12)
-_restgpr1_18: ld 18,-112(12)
-_restgpr1_19: ld 19,-104(12)
-_restgpr1_20: ld 20,-96(12)
-_restgpr1_21: ld 21,-88(12)
-_restgpr1_22: ld 22,-80(12)
-_restgpr1_23: ld 23,-72(12)
-_restgpr1_24: ld 24,-64(12)
-_restgpr1_25: ld 25,-56(12)
-_restgpr1_26: ld 26,-48(12)
-_restgpr1_27: ld 27,-40(12)
-_restgpr1_28: ld 28,-32(12)
-_restgpr1_29: ld 29,-24(12)
-_restgpr1_30: ld 30,-16(12)
-_restgpr1_31: ld 31,-8(12)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-/* Each _savefpr_M routine saves the floating point registers from fM to f31,
- * inclusive. When the routine is called, r1 must point to the start of the
- * floating point register save area, and r0 must contain the value of LR on
- * function entry.
- */
-_savefpr_14: stfd 14,-144(1)
-_savefpr_15: stfd 15,-136(1)
-_savefpr_16: stfd 16,-128(1)
-_savefpr_17: stfd 17,-120(1)
-_savefpr_18: stfd 18,-112(1)
-_savefpr_19: stfd 19,-104(1)
-_savefpr_20: stfd 20,-96(1)
-_savefpr_21: stfd 21,-88(1)
-_savefpr_22: stfd 22,-80(1)
-_savefpr_23: stfd 23,-72(1)
-_savefpr_24: stfd 24,-64(1)
-_savefpr_25: stfd 25,-56(1)
-_savefpr_26: stfd 26,-48(1)
-_savefpr_27: stfd 27,-40(1)
-_savefpr_28: stfd 28,-32(1)
-_savefpr_29: stfd 29,-24(1)
-_savefpr_30: stfd 30,-16(1)
-_savefpr_31: stfd 31,-8(1)
-    std 0, 16(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* The _restfpr_M routines restore the floating point registers from fM to f31.
- * When the routine is called, r1 must point to the start of the floating point
- * register save area.
- */
-_restfpr_14: lfd 14,-144(1)
-_restfpr_15: lfd 15,-136(1)
-_restfpr_16: lfd 16,-128(1)
-_restfpr_17: lfd 17,-120(1)
-_restfpr_18: lfd 18,-112(1)
-_restfpr_19: lfd 19,-104(1)
-_restfpr_20: lfd 20,-96(1)
-_restfpr_21: lfd 21,-88(1)
-_restfpr_22: lfd 22,-80(1)
-_restfpr_23: lfd 23,-72(1)
-_restfpr_24: lfd 24,-64(1)
-_restfpr_25: lfd 25,-56(1)
-_restfpr_26: lfd 26,-48(1)
-_restfpr_27: lfd 27,-40(1)
-_restfpr_28: lfd 28,-32(1)
-_restfpr_29:
-    ld 0, 16(1)
-    lfd 29,-24(1)
-    mtlr 0
-    lfd 30,-16(1)
-    lfd 31,-8(1)
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-_restfpr_30: lfd 30,-16(1)
-_restfpr_31:
-    ld 0, 16(1)
-    lfd 31,-8(1)
-    mtlr 0
-    blr
-.long 0
-.byte 0, 12, 64, 0, 0, 0, 0, 0
-
-/* Each _savevr_M routine saves the vector registers from vM to v31, inclusive.
- * When the routine is called, r0 must point to the word just beyound the end
- * of the vector register save area. On return the value of r0 is unchanged
- * while r12 may be modified.
- */
-/* commented out for now, unused
-_savevr_20: addi r12,r0,-192
-    stvx v20,r12,r0
-_savevr_21: addi r12,r0,-176
-    stvx v21,r12,r0
-_savevr_22: addi r12,r0,-160
-    stvx v22,r12,r0
-_savevr_23: addi r12,r0,-144
-    stvx v23,r12,r0
-_savevr_24: addi r12,r0,-128
-    stvx v24,r12,r0
-_savevr_25: addi r12,r0,-112
-    stvx v25,r12,r0
-_savevr_26: addi r12,r0,-96
-    stvx v26,r12,r0
-_savevr_27: addi r12,r0,-80
-    stvx v27,r12,r0
-_savevr_28: addi r12,r0,-64
-    stvx v28,r12,r0
-_savevr_29: addi r12,r0,-48
-    stvx v29,r12,r0
-_savevr_30: addi r12,r0,-32
-    stvx v30,r12,r0
-_savevr_31: addi r12,r0,-16
-    stvx v31,r12,r0
-    blr
-*/
-/* The _restvr_M routines restore the vector registers from vM to v31. When the
- * routine is called, r0 must point to the word just beyound the end of the
- * vector register save area. On return the value of r0 is unchanged while r12
- * may be modified.
- */
-/* commented out for now, unused
-_restvr_20: addi r12,r0,-192
-    lvx v20,r12,r0
-_restvr_21: addi r12,r0,-176
-    lvx v21,r12,r0
-_restvr_22: addi r12,r0,-160
-    lvx v22,r12,r0
-_restvr_23: addi r12,r0,-144
-    lvx v23,r12,r0
-_restvr_24: addi r12,r0,-128
-    lvx v24,r12,r0
-_restvr_25: addi r12,r0,-112
-    lvx v25,r12,r0
-_restvr_26: addi r12,r0,-96
-    lvx v26,r12,r0
-_restvr_27: addi r12,r0,-80
-    lvx v27,r12,r0
-_restvr_28: addi r12,r0,-64
-    lvx v28,r12,r0
-_restvr_29: addi r12,r0,-48
-    lvx v29,r12,r0
-_restvr_30: addi r12,r0,-32
-    lvx v30,r12,r0
-_restvr_31: addi r12,r0,-16
-    lvx v31,r12,r0
-    blr
-*/
-
-/*
- * Main program entry point label (function), called by the loader
- */
-FUNCTION_PROLOG _start
-
-    mr   26, 1            /* save stack pointer */
-    /* Set up an initial stack frame, and clear the LR */
-    clrrdi  1, 1, 5       /* align r1 */
-    li      0, 0
-    stdu    1,-128(1)
-    mtlr    0
-    std     0, 0(1)       /* r1 = pointer to NULL value */
-
-    /* store argument count (= 0(r1) )*/
-    ld      3, 0(26)
-    LOAD_64BIT_VAL 10, operatingsystem_parameter_argc
-    stw     3, 0(10)
-    /* calculate argument vector address and store (= 8(r1) + 8 ) */
-    addi    4, 26, 8
-    LOAD_64BIT_VAL 10, operatingsystem_parameter_argv
-    std     4, 0(10)
-    /* store environment pointer (= argv + (argc+1)* 8 ) */
-    addi    5, 3, 1
-    sldi    5, 5, 3
-    add     5, 4, 5
-    LOAD_64BIT_VAL 10, operatingsystem_parameter_envp
-    std     5, 0(10)
-
-    LOAD_64BIT_VAL 8, __stkptr
-    std     1,0(8)
-
-    bl      .PASCALMAIN
-    nop
-
-    /* directly jump to exit procedure, not via the function pointer */
-    b       ._haltproc
-
-FUNCTION_PROLOG _haltproc
-    /* exit call */
-    li      0, 1
-    sc
-    b       ._haltproc
-
-    /* Define a symbol for the first piece of initialized data.  */
-    .section ".data"
-    .globl  __data_start
-__data_start:
-data_start:
-
-.text
-    .comm __stkptr, 8
-
-    .comm operatingsystem_parameter_argc, 4
-    .comm operatingsystem_parameter_argv, 8
-    .comm operatingsystem_parameter_envp, 8
-
+/*
+ * This file is part of the Free Pascal run time library.
+ * Copyright (c) 2005 by Thomas Schatzl,
+ * member of the Free Pascal development team.
+ *
+ * Startup code for normal programs, PowerPC64 version.
+ *
+ * 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.
+ */
+
+.macro LOAD_64BIT_VAL ra, value
+    lis       \ra,\value@highest
+    ori       \ra,\ra,\value@higher
+    sldi      \ra,\ra,32
+    oris      \ra,\ra,\value@h
+    ori       \ra,\ra,\value@l
+.endm
+
+/* create function prolog for symbol "fn" */
+.macro FUNCTION_PROLOG fn
+    .section  ".text"
+    .align    2
+    .globl    \fn
+    .section  ".opd", "aw"
+    .align    3
+\fn:
+    .quad     .\fn, .TOC.@tocbase, 0
+    .previous
+    .size     \fn, 24
+    .type     \fn, @function
+    .globl    .\fn
+.\fn:
+.endm
+
+/*
+ * "ptrgl" glue code for calls via pointer. This function
+ * sequence loads the data from the function descriptor
+ * referenced by R11 into the CTR register (function address),
+ * R2 (GOT/TOC pointer), and R11 (the outer frame pointer).
+ *
+ * On entry, R11 must be set to point to the function descriptor.
+ *
+ * See also the 64-bit PowerPC ABI specification for more
+ * information, chapter 3.5.11 (in v1.7).
+ */
+.section ".text"
+.align 3
+.globl .ptrgl
+.ptrgl:
+    ld	    0, 0(11)
+    std     2, 40(1)
+    mtctr   0
+    ld      2, 8(11)
+    ld      11, 8(11)
+    bctr
+.long 0
+.byte 0, 12, 128, 0, 0, 0, 0, 0
+.type .ptrgl, @function
+.size .ptrgl, . - .ptrgl
+
+/*
+ * Function prolog/epilog helpers, which are part of the 64-bit
+ * PowerPC ABI.
+ *
+ * See also the 64-bit PowerPC ABI specification for more
+ * information, chapter 3.5.5, "Register saving and restoring
+ * function" (in v1.7).
+ */
+
+/* Each _savegpr0_N routine saves the general registers from rN to r31,
+ * inclusive. When the routine is called, r1 must point to the start
+ * of the general register save area. R0 must contain the old LR on
+ * entry.
+ */
+_savegpr0_14: std 14,-144(1)
+_savegpr0_15: std 15,-136(1)
+_savegpr0_16: std 16,-128(1)
+_savegpr0_17: std 17,-120(1)
+_savegpr0_18: std 18,-112(1)
+_savegpr0_19: std 19,-104(1)
+_savegpr0_20: std 20,-96(1)
+_savegpr0_21: std 21,-88(1)
+_savegpr0_22: std 22,-80(1)
+_savegpr0_23: std 23,-72(1)
+_savegpr0_24: std 24,-64(1)
+_savegpr0_25: std 25,-56(1)
+_savegpr0_26: std 26,-48(1)
+_savegpr0_27: std 27,-40(1)
+_savegpr0_28: std 28,-32(1)
+_savegpr0_29: std 29,-24(1)
+_savegpr0_30: std 30,-16(1)
+_savegpr0_31:
+    std 31,-8(1)
+    std 0, 16(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _restgpr0_N routine restores the general registers from rN to r31,
+ * inclusive. When the routine is called, r1 must point to the start
+ * of the general register save area.
+ */
+_restgpr0_14: ld 14,-144(1)
+_restgpr0_15: ld 15,-136(1)
+_restgpr0_16: ld 16,-128(1)
+_restgpr0_17: ld 17,-120(1)
+_restgpr0_18: ld 18,-112(1)
+_restgpr0_19: ld 19,-104(1)
+_restgpr0_20: ld 20,-96(1)
+_restgpr0_21: ld 21,-88(1)
+_restgpr0_22: ld 22,-80(1)
+_restgpr0_23: ld 23,-72(1)
+_restgpr0_24: ld 24,-64(1)
+_restgpr0_25: ld 25,-56(1)
+_restgpr0_26: ld 26,-48(1)
+_restgpr0_27: ld 27,-40(1)
+_restgpr0_28: ld 28,-32(1)
+_restgpr0_29:
+    ld 0, 16(1)
+    ld 29,-24(1)
+    mtlr 0
+    ld 30,-16(1)
+    ld 31,-8(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+_restgpr0_30: ld 30,-16(1)
+_restgpr0_31: ld 0, 16(1)
+    ld 31,-8(1)
+    mtlr 0
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _savegpr1_N routine saves the general registers from rN to r31,
+ * inclusive. When the routine is called, r12
+ * must point to the start of the general register save area.
+ */
+_savegpr1_14: std 14,-144(12)
+_savegpr1_15: std 15,-136(12)
+_savegpr1_16: std 16,-128(12)
+_savegpr1_17: std 17,-120(12)
+_savegpr1_18: std 18,-112(12)
+_savegpr1_19: std 19,-104(12)
+_savegpr1_20: std 20,-96(12)
+_savegpr1_21: std 21,-88(12)
+_savegpr1_22: std 22,-80(12)
+_savegpr1_23: std 23,-72(12)
+_savegpr1_24: std 24,-64(12)
+_savegpr1_25: std 25,-56(12)
+_savegpr1_26: std 26,-48(12)
+_savegpr1_27: std 27,-40(12)
+_savegpr1_28: std 28,-32(12)
+_savegpr1_29: std 29,-24(12)
+_savegpr1_30: std 30,-16(12)
+_savegpr1_31: std 31,-8(12)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* The _restgpr1_N routines restore the general registers from rN to r31.
+ * When the routine is called, r12 must point to the start of the general
+ * register save area.
+ */
+_restgpr1_14: ld 14,-144(12)
+_restgpr1_15: ld 15,-136(12)
+_restgpr1_16: ld 16,-128(12)
+_restgpr1_17: ld 17,-120(12)
+_restgpr1_18: ld 18,-112(12)
+_restgpr1_19: ld 19,-104(12)
+_restgpr1_20: ld 20,-96(12)
+_restgpr1_21: ld 21,-88(12)
+_restgpr1_22: ld 22,-80(12)
+_restgpr1_23: ld 23,-72(12)
+_restgpr1_24: ld 24,-64(12)
+_restgpr1_25: ld 25,-56(12)
+_restgpr1_26: ld 26,-48(12)
+_restgpr1_27: ld 27,-40(12)
+_restgpr1_28: ld 28,-32(12)
+_restgpr1_29: ld 29,-24(12)
+_restgpr1_30: ld 30,-16(12)
+_restgpr1_31: ld 31,-8(12)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+/* Each _savefpr_M routine saves the floating point registers from fM to f31,
+ * inclusive. When the routine is called, r1 must point to the start of the
+ * floating point register save area, and r0 must contain the value of LR on
+ * function entry.
+ */
+_savefpr_14: stfd 14,-144(1)
+_savefpr_15: stfd 15,-136(1)
+_savefpr_16: stfd 16,-128(1)
+_savefpr_17: stfd 17,-120(1)
+_savefpr_18: stfd 18,-112(1)
+_savefpr_19: stfd 19,-104(1)
+_savefpr_20: stfd 20,-96(1)
+_savefpr_21: stfd 21,-88(1)
+_savefpr_22: stfd 22,-80(1)
+_savefpr_23: stfd 23,-72(1)
+_savefpr_24: stfd 24,-64(1)
+_savefpr_25: stfd 25,-56(1)
+_savefpr_26: stfd 26,-48(1)
+_savefpr_27: stfd 27,-40(1)
+_savefpr_28: stfd 28,-32(1)
+_savefpr_29: stfd 29,-24(1)
+_savefpr_30: stfd 30,-16(1)
+_savefpr_31: stfd 31,-8(1)
+    std 0, 16(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* The _restfpr_M routines restore the floating point registers from fM to f31.
+ * When the routine is called, r1 must point to the start of the floating point
+ * register save area.
+ */
+_restfpr_14: lfd 14,-144(1)
+_restfpr_15: lfd 15,-136(1)
+_restfpr_16: lfd 16,-128(1)
+_restfpr_17: lfd 17,-120(1)
+_restfpr_18: lfd 18,-112(1)
+_restfpr_19: lfd 19,-104(1)
+_restfpr_20: lfd 20,-96(1)
+_restfpr_21: lfd 21,-88(1)
+_restfpr_22: lfd 22,-80(1)
+_restfpr_23: lfd 23,-72(1)
+_restfpr_24: lfd 24,-64(1)
+_restfpr_25: lfd 25,-56(1)
+_restfpr_26: lfd 26,-48(1)
+_restfpr_27: lfd 27,-40(1)
+_restfpr_28: lfd 28,-32(1)
+_restfpr_29:
+    ld 0, 16(1)
+    lfd 29,-24(1)
+    mtlr 0
+    lfd 30,-16(1)
+    lfd 31,-8(1)
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+_restfpr_30: lfd 30,-16(1)
+_restfpr_31:
+    ld 0, 16(1)
+    lfd 31,-8(1)
+    mtlr 0
+    blr
+.long 0
+.byte 0, 12, 64, 0, 0, 0, 0, 0
+
+/* Each _savevr_M routine saves the vector registers from vM to v31, inclusive.
+ * When the routine is called, r0 must point to the word just beyound the end
+ * of the vector register save area. On return the value of r0 is unchanged
+ * while r12 may be modified.
+ */
+/* commented out for now, unused
+_savevr_20: addi r12,r0,-192
+    stvx v20,r12,r0
+_savevr_21: addi r12,r0,-176
+    stvx v21,r12,r0
+_savevr_22: addi r12,r0,-160
+    stvx v22,r12,r0
+_savevr_23: addi r12,r0,-144
+    stvx v23,r12,r0
+_savevr_24: addi r12,r0,-128
+    stvx v24,r12,r0
+_savevr_25: addi r12,r0,-112
+    stvx v25,r12,r0
+_savevr_26: addi r12,r0,-96
+    stvx v26,r12,r0
+_savevr_27: addi r12,r0,-80
+    stvx v27,r12,r0
+_savevr_28: addi r12,r0,-64
+    stvx v28,r12,r0
+_savevr_29: addi r12,r0,-48
+    stvx v29,r12,r0
+_savevr_30: addi r12,r0,-32
+    stvx v30,r12,r0
+_savevr_31: addi r12,r0,-16
+    stvx v31,r12,r0
+    blr
+*/
+/* The _restvr_M routines restore the vector registers from vM to v31. When the
+ * routine is called, r0 must point to the word just beyound the end of the
+ * vector register save area. On return the value of r0 is unchanged while r12
+ * may be modified.
+ */
+/* commented out for now, unused
+_restvr_20: addi r12,r0,-192
+    lvx v20,r12,r0
+_restvr_21: addi r12,r0,-176
+    lvx v21,r12,r0
+_restvr_22: addi r12,r0,-160
+    lvx v22,r12,r0
+_restvr_23: addi r12,r0,-144
+    lvx v23,r12,r0
+_restvr_24: addi r12,r0,-128
+    lvx v24,r12,r0
+_restvr_25: addi r12,r0,-112
+    lvx v25,r12,r0
+_restvr_26: addi r12,r0,-96
+    lvx v26,r12,r0
+_restvr_27: addi r12,r0,-80
+    lvx v27,r12,r0
+_restvr_28: addi r12,r0,-64
+    lvx v28,r12,r0
+_restvr_29: addi r12,r0,-48
+    lvx v29,r12,r0
+_restvr_30: addi r12,r0,-32
+    lvx v30,r12,r0
+_restvr_31: addi r12,r0,-16
+    lvx v31,r12,r0
+    blr
+*/
+
+/*
+ * Main program entry point label (function), called by the loader
+ */
+FUNCTION_PROLOG _start
+
+    mr   26, 1            /* save stack pointer */
+    /* Set up an initial stack frame, and clear the LR */
+    clrrdi  1, 1, 5       /* align r1 */
+    li      0, 0
+    stdu    1,-128(1)
+    mtlr    0
+    std     0, 0(1)       /* r1 = pointer to NULL value */
+
+    /* store argument count (= 0(r1) )*/
+    ld      3, 0(26)
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_argc
+    stw     3, 0(10)
+    /* calculate argument vector address and store (= 8(r1) + 8 ) */
+    addi    4, 26, 8
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_argv
+    std     4, 0(10)
+    /* store environment pointer (= argv + (argc+1)* 8 ) */
+    addi    5, 3, 1
+    sldi    5, 5, 3
+    add     5, 4, 5
+    LOAD_64BIT_VAL 10, operatingsystem_parameter_envp
+    std     5, 0(10)
+
+    LOAD_64BIT_VAL 8, __stkptr
+    std     1,0(8)
+
+    bl      .PASCALMAIN
+    nop
+
+    /* directly jump to exit procedure, not via the function pointer */
+    b       ._haltproc
+
+FUNCTION_PROLOG _haltproc
+    /* exit call */
+    li      0, 1
+    sc
+    b       ._haltproc
+
+    /* Define a symbol for the first piece of initialized data.  */
+    .section ".data"
+    .globl  __data_start
+__data_start:
+data_start:
+
+.text
+    .comm __stkptr, 8
+
+    .comm operatingsystem_parameter_argc, 4
+    .comm operatingsystem_parameter_argv, 8
+    .comm operatingsystem_parameter_envp, 8
+

+ 108 - 108
rtl/linux/x86_64/dllprt0.as

@@ -1,108 +1,108 @@
-#
-#   This file is part of the Free Pascal run time library.
-#   Copyright (c) 2006 by Florian Klaempfl
-#   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
-#
-
-/* This is the canonical entry point, usually the first thing in the text
-   segment.  The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
-   point runs, most registers' values are unspecified, except for:
-
-   %rdx		Contains a function pointer to be registered with `atexit'.
-		This is how the dynamic linker arranges to have DT_FINI
-		functions called for shared libraries that have been loaded
-		before this code runs.
-
-   %rsp		The stack contains the arguments and environment:
-		0(%rsp)			argc
-		8(%rsp)			argv[0]
-		...
-		(8*argc)(%rsp)		NULL
-		(8*(argc+1))(%rsp)	envp[0]
-		...
-					NULL
-*/
-.section .init
-	.align 16
-	.globl FPC_LIB_START
-	.type FPC_LIB_START,@function
-FPC_LIB_START:
-	jmp	_startlib@PLT
-
-        .text
-	.globl _start
-	.type _start,@function
-_startlib:
-#       movq %rdx,%r9                 /* Address of the shared library termination
-#               	                 function.  */
-	pushq	 %rbx
-        movq     operatingsystem_parameter_argc@GOTPCREL(%rip),%rbx
-        movq     %rdi,(%rbx)
-        movq     operatingsystem_parameter_argv@GOTPCREL(%rip),%rbx
-	movq     %rsi,(%rbx)          /* argv starts just at the current stack top.  */
-        movq     operatingsystem_parameter_envp@GOTPCREL(%rip),%rbx
-        movq     %rdx,(%rbx)
-
-        movq    TC_SYSTEM_ISLIBRARY@GOTPCREL(%rip),%rbx
-        movb    $1,(%rbx)
-
-        /* Save initial stackpointer */
-        movq    __stkptr@GOTPCREL(%rip),%rbx
-        movq    %rsp,(%rbx)
-
-        call    PASCALMAIN@PLT
-	popq	%rbx
-	ret
-
-        .globl  _haltproc
-        .type   _haltproc,@function
-_haltproc:
-        movl    $231,%eax                 /* exit_group call */
-        movq    operatingsystem_result@GOTPCREL(%rip),%rbx
-        movzwl  (%rbx),%edi
-        syscall
-        jmp     _haltproc@PLT
-
-/* Define a symbol for the first piece of initialized data.  */
-	.data
-	.globl __data_start
-__data_start:
-	.long 0
-	.weak data_start
-        data_start = __data_start
-
-.bss
-        .comm __stkptr,8
-
-        .comm operatingsystem_parameter_envp,8
-        .comm operatingsystem_parameter_argc,8
-        .comm operatingsystem_parameter_argv,8
-
-
-/* We need this stuff to make gdb behave itself, otherwise
-   gdb will chokes with SIGILL when trying to debug apps.
-
-Makes ld choke:
-        .section ".note.ABI-tag", "a"
-        .align 4
-        .long 1f - 0f
-        .long 3f - 2f
-        .long  1
-0:      .asciz "GNU"
-1:      .align 4
-2:      .long 0
-        .long 2,4,0
-3:      .align 4
-*/
-	.section	.note.GNU-stack,"",@progbits
+#
+#   This file is part of the Free Pascal run time library.
+#   Copyright (c) 2006 by Florian Klaempfl
+#   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
+#
+
+/* This is the canonical entry point, usually the first thing in the text
+   segment.  The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
+   point runs, most registers' values are unspecified, except for:
+
+   %rdx		Contains a function pointer to be registered with `atexit'.
+		This is how the dynamic linker arranges to have DT_FINI
+		functions called for shared libraries that have been loaded
+		before this code runs.
+
+   %rsp		The stack contains the arguments and environment:
+		0(%rsp)			argc
+		8(%rsp)			argv[0]
+		...
+		(8*argc)(%rsp)		NULL
+		(8*(argc+1))(%rsp)	envp[0]
+		...
+					NULL
+*/
+.section .init
+	.align 16
+	.globl FPC_LIB_START
+	.type FPC_LIB_START,@function
+FPC_LIB_START:
+	jmp	_startlib@PLT
+
+        .text
+	.globl _start
+	.type _start,@function
+_startlib:
+#       movq %rdx,%r9                 /* Address of the shared library termination
+#               	                 function.  */
+	pushq	 %rbx
+        movq     operatingsystem_parameter_argc@GOTPCREL(%rip),%rbx
+        movq     %rdi,(%rbx)
+        movq     operatingsystem_parameter_argv@GOTPCREL(%rip),%rbx
+	movq     %rsi,(%rbx)          /* argv starts just at the current stack top.  */
+        movq     operatingsystem_parameter_envp@GOTPCREL(%rip),%rbx
+        movq     %rdx,(%rbx)
+
+        movq    TC_SYSTEM_ISLIBRARY@GOTPCREL(%rip),%rbx
+        movb    $1,(%rbx)
+
+        /* Save initial stackpointer */
+        movq    __stkptr@GOTPCREL(%rip),%rbx
+        movq    %rsp,(%rbx)
+
+        call    PASCALMAIN@PLT
+	popq	%rbx
+	ret
+
+        .globl  _haltproc
+        .type   _haltproc,@function
+_haltproc:
+        movl    $231,%eax                 /* exit_group call */
+        movq    operatingsystem_result@GOTPCREL(%rip),%rbx
+        movzwl  (%rbx),%edi
+        syscall
+        jmp     _haltproc@PLT
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+        data_start = __data_start
+
+.bss
+        .comm __stkptr,8
+
+        .comm operatingsystem_parameter_envp,8
+        .comm operatingsystem_parameter_argc,8
+        .comm operatingsystem_parameter_argv,8
+
+
+/* We need this stuff to make gdb behave itself, otherwise
+   gdb will chokes with SIGILL when trying to debug apps.
+
+Makes ld choke:
+        .section ".note.ABI-tag", "a"
+        .align 4
+        .long 1f - 0f
+        .long 3f - 2f
+        .long  1
+0:      .asciz "GNU"
+1:      .align 4
+2:      .long 0
+        .long 2,4,0
+3:      .align 4
+*/
+	.section	.note.GNU-stack,"",@progbits