Add CFI to i386 _start functions
Commit Message
As a follow up to my patch patch for RTLD_START on x86_64, this adds
cfi instructions to the _start functions in both the dynamic loader
and the application startup files.
---
sysdeps/i386/dl-machine.h | 14 ++++++++++----
sysdeps/i386/start.S | 10 ++++++----
2 files changed, 16 insertions(+), 8 deletions(-)
@@ -149,11 +149,16 @@ extern ElfW(Addr) _dl_profile_fixup (struct link_map *l,
.align 16\n\
.globl _start\n\
.globl _dl_start_user\n\
-_start:\n\
+_start:\n"\
+CFI_STARTPROC "\n"\
+CFI_UNDEFINED(%eip) "\n\
# Note that _dl_start gets the parameter in %eax.\n\
movl %esp, %eax\n\
- call _dl_start\n\
-_dl_start_user:\n\
+ call _dl_start\n"\
+CFI_ENDPROC "\n\
+_dl_start_user:\n"\
+CFI_STARTPROC "\n"\
+CFI_UNDEFINED(%eip) "\n\
# Save the user entry point address in %edi.\n\
movl %eax, %edi\n\
# Point %ebx at the GOT.\n\
@@ -195,7 +200,8 @@ _dl_start_user:\n\
# Restore %esp _start expects.\n\
movl (%esp), %esp\n\
# Jump to the user's entry point.\n\
- jmp *%edi\n\
+ jmp *%edi\n"\
+CFI_ENDPROC "\n\
.previous\n\
");
@@ -52,10 +52,11 @@
NULL
*/
- .text
- .globl _start
- .type _start,@function
-_start:
+#include <sysdep.h>
+
+ENTRY (_start)
+ /* Also use CFI to indicate outermost frame. */
+ cfi_undefined (eip)
/* Clear the frame pointer. The ABI suggests this be done, to mark
the outermost frame obviously. */
xorl %ebp, %ebp
@@ -121,6 +122,7 @@ _start:
1: movl (%esp), %ebx
ret
#endif
+END (_start)
/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so
meaningless since we don't support machines < 80386. */