diff options
Diffstat (limited to 'lib/csu/powerpc64')
-rw-r--r-- | lib/csu/powerpc64/Makefile | 4 | ||||
-rw-r--r-- | lib/csu/powerpc64/Makefile.depend | 1 | ||||
-rw-r--r-- | lib/csu/powerpc64/crt.h | 2 | ||||
-rw-r--r-- | lib/csu/powerpc64/crt1_c.c | 63 | ||||
-rw-r--r-- | lib/csu/powerpc64/crti.S | 2 | ||||
-rw-r--r-- | lib/csu/powerpc64/crtn.S | 2 | ||||
-rw-r--r-- | lib/csu/powerpc64/reloc.c | 43 |
7 files changed, 7 insertions, 110 deletions
diff --git a/lib/csu/powerpc64/Makefile b/lib/csu/powerpc64/Makefile index 564e8dfbf288..97df3f389115 100644 --- a/lib/csu/powerpc64/Makefile +++ b/lib/csu/powerpc64/Makefile @@ -1,10 +1,8 @@ -# $FreeBSD$ - .PATH: ${.CURDIR:H}/common OBJS+= crtsavres.o CFLAGS+= -I${.CURDIR} \ - -mlongcall -DCRT_IRELOC_RELA + -mlongcall CLEANFILES+= crtsavres.S diff --git a/lib/csu/powerpc64/Makefile.depend b/lib/csu/powerpc64/Makefile.depend index 79506ce16b79..993ab0638f4a 100644 --- a/lib/csu/powerpc64/Makefile.depend +++ b/lib/csu/powerpc64/Makefile.depend @@ -1,4 +1,3 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ diff --git a/lib/csu/powerpc64/crt.h b/lib/csu/powerpc64/crt.h index 304db572c621..fd589b9adf37 100644 --- a/lib/csu/powerpc64/crt.h +++ b/lib/csu/powerpc64/crt.h @@ -19,8 +19,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _CRT_H_ diff --git a/lib/csu/powerpc64/crt1_c.c b/lib/csu/powerpc64/crt1_c.c index c9115be75fba..8d389b87a2a5 100644 --- a/lib/csu/powerpc64/crt1_c.c +++ b/lib/csu/powerpc64/crt1_c.c @@ -42,89 +42,38 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdlib.h> #include <stdint.h> #include <sys/elf.h> -static uint32_t cpu_features; -static uint32_t cpu_features2; - #include "libc_private.h" -#include "ignore_init.c" +#include "csu_common.h" struct Struct_Obj_Entry; struct ps_strings; -extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, - void (*)(void), struct ps_strings *); - -#ifdef GCRT -extern void _mcleanup(void); -extern void monstartup(void *, void *); -extern int eprol; -extern int etext; -#endif +void _start(int, char **, char **, const struct Struct_Obj_Entry *, + void (*)(void), struct ps_strings *) __dead2; struct ps_strings *__ps_strings; -static void -init_cpu_features(char **env) -{ - const Elf_Auxinfo *aux; - - /* Find the auxiliary vector on the stack. */ - while (*env++ != 0) /* Skip over environment, and NULL terminator */ - ; - aux = (const Elf_Auxinfo *)env; - - /* Digest the auxiliary vector. */ - for (; aux->a_type != AT_NULL; aux++) { - switch (aux->a_type) { - case AT_HWCAP: - cpu_features = (uint32_t)aux->a_un.a_val; - break; - case AT_HWCAP2: - cpu_features2 = (uint32_t)aux->a_un.a_val; - break; - } - } -} - - /* The entry function. */ /* * First 5 arguments are specified by the PowerPC SVR4 ABI. * The last argument, ps_strings, is a BSD extension. */ -/* ARGSUSED */ void _start(int argc, char **argv, char **env, const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void), struct ps_strings *ps_strings) { - - handle_argv(argc, argv, env); - if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; - if (&_DYNAMIC != NULL) - atexit(cleanup); - else { - init_cpu_features(env); - process_irelocs(); - _init_tls(); - } - #ifdef GCRT - atexit(_mcleanup); - monstartup(&eprol, &etext); + __libc_start1_gcrt(argc, argv, env, cleanup, main, &eprol, &etext); +#else + __libc_start1(argc, argv, env, cleanup, main); #endif - - handle_static_init(argc, argv, env); - exit(main(argc, argv, env)); } #ifdef GCRT diff --git a/lib/csu/powerpc64/crti.S b/lib/csu/powerpc64/crti.S index 00a12426cf60..33e9ca4f42ae 100644 --- a/lib/csu/powerpc64/crti.S +++ b/lib/csu/powerpc64/crti.S @@ -24,8 +24,6 @@ */ #include <machine/asm.h> -__FBSDID("$FreeBSD$"); - #ifdef _CALL_ELF .abiversion _CALL_ELF #endif diff --git a/lib/csu/powerpc64/crtn.S b/lib/csu/powerpc64/crtn.S index 39f21aee40d9..a7619f3fbf62 100644 --- a/lib/csu/powerpc64/crtn.S +++ b/lib/csu/powerpc64/crtn.S @@ -24,8 +24,6 @@ */ #include <machine/asm.h> -__FBSDID("$FreeBSD$"); - .section .init,"ax",@progbits ld %r1,0(%r1) ld 0,16(%r1) diff --git a/lib/csu/powerpc64/reloc.c b/lib/csu/powerpc64/reloc.c deleted file mode 100644 index afa3f2fbec18..000000000000 --- a/lib/csu/powerpc64/reloc.c +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 2019 Leandro Lupori - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -static void -crt1_handle_rela(const Elf_Rela *r) -{ - typedef Elf_Addr (*ifunc_resolver_t)( - uint32_t, uint32_t, uint64_t, uint64_t, - uint64_t, uint64_t, uint64_t, uint64_t); - Elf_Addr *ptr, *where, target; - - switch (ELF_R_TYPE(r->r_info)) { - case R_PPC_IRELATIVE: - ptr = (Elf_Addr *)r->r_addend; - where = (Elf_Addr *)r->r_offset; - target = ((ifunc_resolver_t)ptr)(cpu_features, cpu_features2, - 0, 0, 0, 0, 0, 0); - *where = target; - break; - } -} |