summaryrefslogtreecommitdiff
path: root/lib/csu/common
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2018-10-13 23:52:55 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2018-10-13 23:52:55 +0000
commitbdafb02fcb88389fd1ab684cfe734cb429d35618 (patch)
tree41db9d0835ce63a1548f9622c748cd8878fd13c2 /lib/csu/common
parentc9504239e8e891292b751f9c498dc3b03234004b (diff)
Notes
Diffstat (limited to 'lib/csu/common')
-rw-r--r--lib/csu/common/ignore_init.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/csu/common/ignore_init.c b/lib/csu/common/ignore_init.c
index 6199c778ab52..8712661b44f7 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
@@ -29,7 +32,9 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/elf.h>
#include <sys/elf_common.h>
+
#include "notes.h"
extern int main(int, char **, char **);
@@ -46,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 = "";