summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2018-11-21 16:23:03 -0800
committerRyan Prichard <rprichard@google.com>2018-11-26 18:37:13 -0800
commit701bd0cc88092521fdafe6cdd88317469ad4ec1c (patch)
tree0fc8dabab1ed23365492b44637e5c412273b4359 /linker/linker_main.cpp
parent7f92fbe06484f036274952efa00fb5cdf410eb12 (diff)
Cleanup: __libc_init_AT_SECURE, auxv, sysinfo
__sanitize_environment_variables is only called when getauxval(AT_SECURE) is true. Instead of scanning __libc_auxv, reuse getauxval. If the entry is missing, getauxval will set errno to ENOENT. Reduce the number of times that __libc_sysinfo and __libc_auxv are initialized. (Previously, __libc_sysinfo was initialized 3 times for the linker's copy). The two variables are initialized in these places: - __libc_init_main_thread for libc.a (including the linker copy) - __libc_preinit_impl for libc.so - __linker_init: the linker's copy of __libc_sysinfo is still initialized twice, because __libc_init_main_thread runs after relocation. A later CL consolidates the linker's two initializations. Bug: none Test: bionic unit tests Change-Id: I196f4c9011b0d803ee85c07afb415fcb146f4d65
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index f7c496a25..66766fe56 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -28,6 +28,9 @@
#include "linker_main.h"
+#include <link.h>
+#include <sys/auxv.h>
+
#include "linker_debug.h"
#include "linker_cfi.h"
#include "linker_gdb_support.h"
@@ -35,7 +38,6 @@
#include "linker_phdr.h"
#include "linker_utils.h"
-#include "private/bionic_auxv.h"
#include "private/bionic_globals.h"
#include "private/bionic_tls.h"
#include "private/KernelArgumentBlock.h"
@@ -48,12 +50,10 @@
#endif
#include <async_safe/log.h>
+#include <bionic/libc_init_common.h>
#include <vector>
-extern void __libc_init_globals(KernelArgumentBlock&);
-extern void __libc_init_AT_SECURE(KernelArgumentBlock&);
-
__LIBC_HIDDEN__ extern "C" void _start();
static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);