summaryrefslogtreecommitdiff
path: root/crt
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-05-02 21:01:55 -0400
committerRich Felker <dalias@aerifal.cx>2012-05-02 21:01:55 -0400
commit83023d1b50297cd2aa0fe4cbd2a0539462bb7c48 (patch)
tree899f0e3f0a7e759bdec1a0a657a4780179d8c9f3 /crt
parentc9dea48f84cd772ac250c091356dd6ef956ea3f6 (diff)
downloadmusl-83023d1b50297cd2aa0fe4cbd2a0539462bb7c48.tar.gz
musl-83023d1b50297cd2aa0fe4cbd2a0539462bb7c48.tar.bz2
musl-83023d1b50297cd2aa0fe4cbd2a0539462bb7c48.tar.xz
musl-83023d1b50297cd2aa0fe4cbd2a0539462bb7c48.zip
PIE support for i386
Diffstat (limited to 'crt')
-rw-r--r--crt/Scrt1.c0
-rw-r--r--crt/i386/Scrt1.s24
2 files changed, 24 insertions, 0 deletions
diff --git a/crt/Scrt1.c b/crt/Scrt1.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/crt/Scrt1.c
diff --git a/crt/i386/Scrt1.s b/crt/i386/Scrt1.s
new file mode 100644
index 00000000..b0fbe104
--- /dev/null
+++ b/crt/i386/Scrt1.s
@@ -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