Remove host_bionic_inject
Now that linker_wrapper.o does not use objcopy --prefix-symbols=__dlwrap_
it can reference the _start symbol of the original binary without
colliding with its own __dlwrap__start symbol, which means
host_bionic_inject is no longer necessary.
Test: build and run host bionic binary
Change-Id: I1752efa39fa73a092fab039771bf59c99b7b5974
diff --git a/linker/linker_wrapper.cpp b/linker/linker_wrapper.cpp
index d037186..5ee2d3e 100644
--- a/linker/linker_wrapper.cpp
+++ b/linker/linker_wrapper.cpp
@@ -28,11 +28,13 @@
#include "private/KernelArgumentBlock.h"
+// The offset from the linker's original program header load addresses to
+// the load addresses when embedded into a binary. Set by the extract_linker
+// tool.
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 __dlwrap_original_start = 42;
+// The real entry point of the binary to use after linker bootstrapping.
+__LIBC_HIDDEN__ extern "C" void _start();
/* 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.
@@ -73,7 +75,7 @@
}
if (v->a_type == AT_ENTRY) {
// Set AT_ENTRY to the proper entry point
- v->a_un.a_val = base_addr + __dlwrap_original_start;
+ v->a_un.a_val = reinterpret_cast<ElfW(Addr)>(&_start);
}
}