xref: /freebsd/lib/csu/riscv/crti.S (revision 1d386b48a555f61cb7325543adbbb5c3f3407a66)
11fdcc5e5SRuslan Bukin/*-
2*af19cc59SRuslan Bukin * Copyright (c) 2015-2017 Ruslan Bukin <br@bsdpad.com>
31fdcc5e5SRuslan Bukin * All rights reserved.
41fdcc5e5SRuslan Bukin *
51fdcc5e5SRuslan Bukin * Portions of this software were developed by SRI International and the
61fdcc5e5SRuslan Bukin * University of Cambridge Computer Laboratory under DARPA/AFRL contract
71fdcc5e5SRuslan Bukin * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
81fdcc5e5SRuslan Bukin *
91fdcc5e5SRuslan Bukin * Portions of this software were developed by the University of Cambridge
101fdcc5e5SRuslan Bukin * Computer Laboratory as part of the CTSRD Project, with support from the
111fdcc5e5SRuslan Bukin * UK Higher Education Innovation Fund (HEIF).
121fdcc5e5SRuslan Bukin *
131fdcc5e5SRuslan Bukin * Redistribution and use in source and binary forms, with or without
141fdcc5e5SRuslan Bukin * modification, are permitted provided that the following conditions
151fdcc5e5SRuslan Bukin * are met:
161fdcc5e5SRuslan Bukin * 1. Redistributions of source code must retain the above copyright
171fdcc5e5SRuslan Bukin *    notice, this list of conditions and the following disclaimer.
181fdcc5e5SRuslan Bukin * 2. Redistributions in binary form must reproduce the above copyright
191fdcc5e5SRuslan Bukin *    notice, this list of conditions and the following disclaimer in the
201fdcc5e5SRuslan Bukin *    documentation and/or other materials provided with the distribution.
211fdcc5e5SRuslan Bukin *
221fdcc5e5SRuslan Bukin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
231fdcc5e5SRuslan Bukin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241fdcc5e5SRuslan Bukin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251fdcc5e5SRuslan Bukin * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
261fdcc5e5SRuslan Bukin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271fdcc5e5SRuslan Bukin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281fdcc5e5SRuslan Bukin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291fdcc5e5SRuslan Bukin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301fdcc5e5SRuslan Bukin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311fdcc5e5SRuslan Bukin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321fdcc5e5SRuslan Bukin * SUCH DAMAGE.
331fdcc5e5SRuslan Bukin */
341fdcc5e5SRuslan Bukin
351fdcc5e5SRuslan Bukin#include <machine/asm.h>
36*af19cc59SRuslan Bukin# this puts __global_pointer$ into .dynsym, so symlook_obj can now find that
37*af19cc59SRuslan Bukin# (see reloc.c)
38*af19cc59SRuslan Bukin	.weak	__global_pointer$
39*af19cc59SRuslan Bukin__global_pointer$:
401fdcc5e5SRuslan Bukin
411fdcc5e5SRuslan Bukin	.section .init,"ax",@progbits
42*af19cc59SRuslan Bukin	.align	0
431fdcc5e5SRuslan Bukin	.globl	_init
441fdcc5e5SRuslan Bukin	.type	_init,@function
451fdcc5e5SRuslan Bukin_init:
461fdcc5e5SRuslan Bukin	addi	sp, sp, -16
471fdcc5e5SRuslan Bukin	sd	ra, 0(sp)
481fdcc5e5SRuslan Bukin
491fdcc5e5SRuslan Bukin	.section .fini,"ax",@progbits
50*af19cc59SRuslan Bukin	.align	0
511fdcc5e5SRuslan Bukin	.globl	_fini
521fdcc5e5SRuslan Bukin	.type	_fini,@function
531fdcc5e5SRuslan Bukin_fini:
541fdcc5e5SRuslan Bukin	addi	sp, sp, -16
551fdcc5e5SRuslan Bukin	sd	ra, 0(sp)
561fdcc5e5SRuslan Bukin
571fdcc5e5SRuslan Bukin	.section .note.GNU-stack,"",%progbits
58