summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-01-06 19:51:43 -0800
committerElliott Hughes <enh@google.com>2016-01-06 20:06:08 -0800
commit42d949ff9d2956e25f84e537f43a8f93ecb37baf (patch)
tree66f1215029c3777d59393fbbbaa55ba5aed5872a /linker/linker.cpp
parent988e71b2b22117b0f7e994cbe764066630494125 (diff)
Defend against -fstack-protector in libc startup.
Exactly which functions get a stack protector is up to the compiler, so let's separate the code that sets up the environment stack protection requires and explicitly build it with -fno-stack-protector. Bug: http://b/26276517 Change-Id: I8719e23ead1f1e81715c32c1335da868f68369b5
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 130e34145..70c2ca5c5 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -4154,6 +4154,7 @@ static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf) {
return 0;
}
+extern "C" int __set_tls(void*);
extern "C" void _start();
/*
@@ -4168,6 +4169,9 @@ extern "C" void _start();
extern "C" ElfW(Addr) __linker_init(void* raw_args) {
KernelArgumentBlock args(raw_args);
+ void* tls[BIONIC_TLS_SLOTS];
+ __set_tls(tls);
+
ElfW(Addr) linker_addr = args.getauxval(AT_BASE);
ElfW(Addr) entry_point = args.getauxval(AT_ENTRY);
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr);