diff options
Diffstat (limited to 'lib/csu/common/ignore_init.c')
-rw-r--r-- | lib/csu/common/ignore_init.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/lib/csu/common/ignore_init.c b/lib/csu/common/ignore_init.c index 184bcbdf54470..8712661b44f79 100644 --- a/lib/csu/common/ignore_init.c +++ b/lib/csu/common/ignore_init.c @@ -2,7 +2,10 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org> - * All rights reserved. + * Copyright (c) 2018 The FreeBSD Foundation + * + * Parts of this software was developed by Konstantin Belousov + * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,6 +31,10 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/param.h> +#include <sys/elf.h> +#include <sys/elf_common.h> + #include "notes.h" extern int main(int, char **, char **); @@ -44,6 +51,39 @@ extern void _init(void) __hidden; extern int _DYNAMIC; #pragma weak _DYNAMIC +#if defined(CRT_IRELOC_RELA) +extern const Elf_Rela __rela_iplt_start[] __weak_symbol __hidden; +extern const Elf_Rela __rela_iplt_end[] __weak_symbol __hidden; + +#include "reloc.c" + +static void +process_irelocs(void) +{ + const Elf_Rela *r; + + for (r = &__rela_iplt_start[0]; r < &__rela_iplt_end[0]; r++) + crt1_handle_rela(r); +} +#elif defined(CRT_IRELOC_REL) +extern const Elf_Rel __rel_iplt_start[] __weak_symbol __hidden; +extern const Elf_Rel __rel_iplt_end[] __weak_symbol __hidden; + +#include "reloc.c" + +static void +process_irelocs(void) +{ + const Elf_Rel *r; + + for (r = &__rel_iplt_start[0]; r < &__rel_iplt_end[0]; r++) + crt1_handle_rel(r); +} +#elif defined(CRT_IRELOC_SUPPRESS) +#else +#error "Define platform reloc type" +#endif + char **environ; const char *__progname = ""; @@ -114,7 +154,7 @@ static const struct { aligned(4))) __used = { .namesz = sizeof(NOTE_FREEBSD_VENDOR), .descsz = sizeof(uint32_t), - .type = CRT_NOINIT_NOTETYPE, + .type = NT_FREEBSD_NOINIT_TAG, .name = NOTE_FREEBSD_VENDOR, .desc = 0 }; |