Changeset View
Changeset View
Standalone View
Standalone View
head/lib/csu/common/ignore_init.c
/*- | /*- | ||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD | * SPDX-License-Identifier: BSD-2-Clause-FreeBSD | ||||
* | * | ||||
* Copyright 2012 Konstantin Belousov <kib@FreeBSD.org> | * 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 | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice, this list of conditions and the following disclaimer. | * notice, this list of conditions and the following disclaimer. | ||||
* 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
* notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the | ||||
* documentation and/or other materials provided with the distribution. | * documentation and/or other materials provided with the distribution. | ||||
Show All 9 Lines | |||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/elf.h> | |||||
#include <sys/elf_common.h> | #include <sys/elf_common.h> | ||||
#include "notes.h" | #include "notes.h" | ||||
extern int main(int, char **, char **); | extern int main(int, char **, char **); | ||||
extern void (*__preinit_array_start[])(int, char **, char **) __hidden; | extern void (*__preinit_array_start[])(int, char **, char **) __hidden; | ||||
extern void (*__preinit_array_end[])(int, char **, char **) __hidden; | extern void (*__preinit_array_end[])(int, char **, char **) __hidden; | ||||
extern void (*__init_array_start[])(int, char **, char **) __hidden; | extern void (*__init_array_start[])(int, char **, char **) __hidden; | ||||
extern void (*__init_array_end[])(int, char **, char **) __hidden; | extern void (*__init_array_end[])(int, char **, char **) __hidden; | ||||
extern void (*__fini_array_start[])(void) __hidden; | extern void (*__fini_array_start[])(void) __hidden; | ||||
extern void (*__fini_array_end[])(void) __hidden; | extern void (*__fini_array_end[])(void) __hidden; | ||||
extern void _fini(void) __hidden; | extern void _fini(void) __hidden; | ||||
extern void _init(void) __hidden; | extern void _init(void) __hidden; | ||||
extern int _DYNAMIC; | extern int _DYNAMIC; | ||||
#pragma weak _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; | char **environ; | ||||
const char *__progname = ""; | const char *__progname = ""; | ||||
static void | static void | ||||
finalizer(void) | finalizer(void) | ||||
{ | { | ||||
void (*fn)(void); | void (*fn)(void); | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |