summaryrefslogtreecommitdiffstats
path: root/linker/arch/x86/begin.S
diff options
context:
space:
mode:
Diffstat (limited to 'linker/arch/x86/begin.S')
-rw-r--r--linker/arch/x86/begin.S23
1 files changed, 23 insertions, 0 deletions
diff --git a/linker/arch/x86/begin.S b/linker/arch/x86/begin.S
new file mode 100644
index 0000000..8f468e6
--- /dev/null
+++ b/linker/arch/x86/begin.S
@@ -0,0 +1,23 @@
+.text
+.align 4
+.type _start, @function
+.globl _start
+
+_start:
+ /* save the elfdata ptr to %eax, AND push it onto the stack */
+ mov %esp, %eax
+ pushl %esp
+
+ pushl %eax
+ call __linker_init
+
+ /* linker init returns (%eax) the _entry address in the main image */
+ /* entry point expects sp to point to elfdata */
+ popl %esp
+ jmp *%eax
+
+.section .ctors, "wa"
+.globl __CTOR_LIST__
+
+__CTOR_LIST__:
+ .long -1