/* LINTLIBRARY */1/*-2* Copyright 1996-1998 John D. Polstra.3* Copyright 2014 Andrew Turner.4* Copyright 2014-2015 The FreeBSD Foundation.5* All rights reserved.6*7* Portions of this software were developed by Andrew Turner8* under sponsorship from the FreeBSD Foundation.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice, this list of conditions and the following disclaimer.15* 2. Redistributions in binary form must reproduce the above copyright16* notice, this list of conditions and the following disclaimer in the17* documentation and/or other materials provided with the distribution.18*19* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR20* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES21* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.22* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,23* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT24* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,25* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY26* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT27* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF28* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.29*/3031#include <machine/asm.h>32#include <sys/elf_common.h>3334/*35* The program entry point36* void _start(char **ap, void (*cleanup)(void)) __dead237*/38ENTRY(_start)39.cfi_undefined x3040mov x3, x2 /* cleanup */41add x1, x0, #8 /* load argv */42ldr x0, [x0] /* load argc */43add x2, x1, x0, lsl #3 /* env is after argv */44add x2, x2, #8 /* argv is null terminated */45#ifdef PIC46adrp x4, :got:main47ldr x4, [x4, :got_lo12:main]48#else49ldr x4, =main50#endif51#ifdef GCRT52ldr x5, =eprol53ldr x6, =etext54/*55* __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext)56*/57bl __libc_start1_gcrt58eprol:59#else60/* __libc_start1(argc, argv, env, cleanup, main) */61bl __libc_start162#endif63END(_start)6465.section .note.GNU-stack,"",@progbits6667GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)686970