Don't use prefix_symbols for host bionic linker wrapper
The only symbol that actually needs a prefix to avoid a collision is
_start, and that can be handled with a copy of begin.S that uses a
"#define" to rename _start to __dlwrap__start. Removing the prefixed
symbols will also allow simplifying the host bionic build process by
letting it directly reference the real _start.
Test: build and run host bionic binary
Change-Id: I50be786c16fe04b7f05c14ebfb74f710c7446ed9
diff --git a/linker/linker_wrapper.cpp b/linker/linker_wrapper.cpp
index fc673aa..d037186 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 @@
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 @@
}
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;
}
}