Force _start to be the top frame for the linker.
I noticed that sometimes the old unwinder will add an extra PC 0 frame
after this change, but the new unwinder works in all cases. I'm not going
to fix the old unwinder since I plan to remove it very soon.
Bug: 67784501
Test: Forced a crash in the linker and verified that the unwind
Test: stops in __dl_start. Tested on arm/aarch64/x86/x86_64.
Change-Id: Id6585768023256be5c1d341df7b06b786a220b40
diff --git a/linker/arch/x86/begin.c b/linker/arch/x86/begin.c
index a734f25..331b79e 100644
--- a/linker/arch/x86/begin.c
+++ b/linker/arch/x86/begin.c
@@ -32,6 +32,9 @@
extern unsigned __linker_init(void* raw_args);
__LIBC_HIDDEN__ void _start() {
+ // Force unwinds to end in this function.
+ asm volatile(".cfi_undefined \%eip");
+
void (*start)(void);
void* raw_args = (void*) ((uintptr_t) __builtin_frame_address(0) + sizeof(void*));