1/* Copyright (C) 1999-2022 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 In addition to the permissions in the GNU Lesser General Public 10 License, the Free Software Foundation gives you unlimited 11 permission to link the compiled version of this file with other 12 programs, and to distribute those programs without any restriction 13 coming from the use of this file. (The GNU Lesser General Public 14 License restrictions do apply in other respects; for example, they 15 cover modification of the file, and distribution when not linked 16 into another program.) 17 18 Note that people who make modified versions of this file are not 19 obligated to grant this special exception for their modified 20 versions; it is their choice whether to do so. The GNU Lesser 21 General Public License gives permission to release a modified 22 version without this exception; this exception also makes it 23 possible to release a modified version which carries forward this 24 exception. 25 26 The GNU C Library is distributed in the hope that it will be useful, 27 but WITHOUT ANY WARRANTY; without even the implied warranty of 28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 Lesser General Public License for more details. 30 31 You should have received a copy of the GNU Lesser General Public 32 License along with the GNU C Library; if not, see 33 <https://www.gnu.org/licenses/>. */ 34 35#include <sysdep.h> 36 37#include <asm/fpu.h> 38 39/* 40 * Arguments for __libc_start_main: 41 * out0: main 42 * out1: argc 43 * out2: argv 44 * out3: init 45 * out4: fini 46 * out5: rtld_fini 47 * out6: stack_end 48 */ 49 50 .align 32 51 .global _start 52 53 .proc _start 54 .type _start,@function 55_start: 56 .prologue 57 .save rp, r0 58 .body 59 .prologue 60 { .mlx 61 alloc r2 = ar.pfs,0,0,7,0 62 movl r3 = FPSR_DEFAULT 63 } 64 { .mlx 65 adds out2 = 16, sp /* get address of argc value */ 66 movl gp = @gprel(0f) 67 ;; 68 } 690: { .mmi 70 ld8 out1 = [out2], 8 /* load argc and move out2 to become argv */ 71 mov.m r10 = ar.bsp /* fetch rbs base address */ 72 mov r9 = ip 73 ;; 74 } 75 { .mii 76 mov ar.fpsr = r3 77 sub gp = r9, gp /* back-compute gp value */ 78 adds out6 = 16, sp /* highest non-environment stack address */ 79 ;; 80 } 81 { 82 addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp 83 addl out0 = @ltoff(@fptr(main)), gp 84 mov out3 = r0 /* Used to be init. */ 85 ;; 86 } 87 { .mmi 88 ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */ 89 ld8 out0 = [out0] /* pointer to `main' function descriptor */ 90 mov out4 = r0 /* Used to be fini. */ 91 ;; 92 } 93 .body 94 { .mib 95 st8 [r3] = r10 96 mov out5 = ret0 /* dynamic linker destructor */ 97 br.call.sptk.few rp = __libc_start_main 98 } 99 { .mib 100 break 0 /* break miserably if we ever return */ 101 } 102 .endp _start 103 104/* Define a symbol for the first piece of initialized data. */ 105 .data 106 .globl __data_start 107__data_start: 108 .long 0 109 .weak data_start 110 data_start = __data_start 111 112 .common __libc_ia64_register_backing_store_base, 8, 8 113