aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2021-06-14 19:25:36 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-06-14 19:25:36 +0000
commit34fead98cbd439fd79f30cc733437b6f5d34be98 (patch)
tree6b4e4762902fa76886f628f01dec2f93bf4907a2
parenta882cb5d437eabaf018ee5563352b811bd14b783 (diff)
parenta0a591a71428758160e9d78e3d3e78dc7d91858b (diff)
downloadbionic-34fead98cbd439fd79f30cc733437b6f5d34be98.tar.gz
Merge "Don't use prefix_symbols for host bionic linker wrapper"
-rw-r--r--linker/Android.bp6
-rw-r--r--linker/arch/arm64/linker_wrapper_begin.S30
-rw-r--r--linker/arch/x86_64/linker_wrapper_begin.S30
-rw-r--r--linker/linker_wrapper.cpp8
4 files changed, 66 insertions, 8 deletions
diff --git a/linker/Android.bp b/linker/Android.bp
index 4a5bf44a6..5b06e3c4d 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -55,15 +55,13 @@ cc_object {
],
arch: {
arm64: {
- srcs: ["arch/arm64/begin.S"],
+ srcs: ["arch/arm64/linker_wrapper_begin.S"],
},
x86_64: {
- srcs: ["arch/x86_64/begin.S"],
+ srcs: ["arch/x86_64/linker_wrapper_begin.S"],
},
},
- prefix_symbols: "__dlwrap_",
-
header_libs: ["libc_headers"],
// We need to access Bionic private headers in the linker.
diff --git a/linker/arch/arm64/linker_wrapper_begin.S b/linker/arch/arm64/linker_wrapper_begin.S
new file mode 100644
index 000000000..90c53a26a
--- /dev/null
+++ b/linker/arch/arm64/linker_wrapper_begin.S
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define _start __dlwrap__start
+#include "begin.S"
diff --git a/linker/arch/x86_64/linker_wrapper_begin.S b/linker/arch/x86_64/linker_wrapper_begin.S
new file mode 100644
index 000000000..90c53a26a
--- /dev/null
+++ b/linker/arch/x86_64/linker_wrapper_begin.S
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define _start __dlwrap__start
+#include "begin.S"
diff --git a/linker/linker_wrapper.cpp b/linker/linker_wrapper.cpp
index fc673aa83..d037186cb 100644
--- a/linker/linker_wrapper.cpp
+++ b/linker/linker_wrapper.cpp
@@ -28,11 +28,11 @@
#include "private/KernelArgumentBlock.h"
-extern const char linker_offset;
+extern const char __dlwrap_linker_offset;
// This will be replaced by host_bionic_inject, but must be non-zero
// here so that it's placed in the data section.
-uintptr_t original_start = 42;
+uintptr_t __dlwrap_original_start = 42;
/* Find the load bias and base address of an executable or shared object loaded
* by the kernel. The ELF file's PHDR table must have a PT_PHDR entry.
@@ -63,7 +63,7 @@ extern "C" ElfW(Addr) __linker_init(void* raw_args) {
reinterpret_cast<ElfW(Phdr)*>(args.getauxval(AT_PHDR)), args.getauxval(AT_PHNUM),
&base_addr, &load_bias);
- ElfW(Addr) linker_addr = base_addr + reinterpret_cast<uintptr_t>(&linker_offset);
+ ElfW(Addr) linker_addr = base_addr + reinterpret_cast<uintptr_t>(&__dlwrap_linker_offset);
ElfW(Addr) linker_entry_offset = reinterpret_cast<ElfW(Ehdr)*>(linker_addr)->e_entry;
for (ElfW(auxv_t)* v = args.auxv; v->a_type != AT_NULL; ++v) {
@@ -73,7 +73,7 @@ extern "C" ElfW(Addr) __linker_init(void* raw_args) {
}
if (v->a_type == AT_ENTRY) {
// Set AT_ENTRY to the proper entry point
- v->a_un.a_val = base_addr + original_start;
+ v->a_un.a_val = base_addr + __dlwrap_original_start;
}
}