PIE support for i386

This commit is contained in:
Rich Felker 2012-05-02 21:01:55 -04:00
commit 83023d1b50
3 changed files with 25 additions and 1 deletions

0
crt/Scrt1.c Normal file
View file

24
crt/i386/Scrt1.s Normal file
View file

@ -0,0 +1,24 @@
.weak _init
.weak _fini
.text
.global _start
_start:
xorl %ebp,%ebp
popl %ecx
movl %esp,%eax
andl $-16,%esp
pushl %esp
pushl %esp
pushl %edx
call 1f
1: addl $_GLOBAL_OFFSET_TABLE_,(%esp)
pop %ebx
call 1f
1: addl $[_fini-.],(%esp)
call 1f
1: addl $[_init-.],(%esp)
pushl %eax
pushl %ecx
pushl main@GOT(%ebx)
call __libc_start_main@plt
1: jmp 1b