Rework the linker_wrapper to work with lld
This is use by Host Bionic to bootstrap into an embedded copy of the linker by tweaking the AT_* values before calling in to the linker entry. Similarly to 9729f359, get the base address from AT_PHDR, so that we're not relying on the relative offset before relocation, which doesn't work with lld (at least with the standard flags). To find the offset to the linker code, we can still use an absolute symbol created by extract_linker (which is currently hardcoded to 0x1000). Instead of relying on something similar for the linker entry point, we're now just reading the entry point from the linker's ELF header. Then we get the address to the real _start function using host_bionic_inject, which injects the value into a global variable after the link step is finished. It also uses that opportunity to verify that the linker is embedded as we expect it to be. Bug: 31559095 Test: build with host bionic Change-Id: I9d81ea77c51c079de06905da1ebe421fead1dc3b
Loading
Please sign in to comment