summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-08-28 17:15:53 +0000
committerEric Andersen <andersen@codepoet.org>2001-08-28 17:15:53 +0000
commit1220fd70ca9b9534a2b831bd9f937436968b5d07 (patch)
tree68fe1509bf46f230a610c8f9d3631ea94026dc8b /libc/sysdeps
parent22e8adca0dc97c39af187d1ce1ba1cd962b6ca0a (diff)
This will hopefully make global constructors and destructors work
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/arm/crt0.S12
-rw-r--r--libc/sysdeps/linux/i386/crt0.S14
-rw-r--r--libc/sysdeps/linux/i386/crt0.c7
-rw-r--r--libc/sysdeps/linux/powerpc/crt0.S12
-rw-r--r--libc/sysdeps/linux/powerpc/crt0.c18
5 files changed, 62 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/arm/crt0.S b/libc/sysdeps/linux/arm/crt0.S
index 243977b7f..01bcb321f 100644
--- a/libc/sysdeps/linux/arm/crt0.S
+++ b/libc/sysdeps/linux/arm/crt0.S
@@ -62,3 +62,15 @@ _start:
/* Ok, now run uClibc's main() -- shouldn't return */
bl __uClibc_main
+/* a little bit of stuff to support C++ */
+ .section .ctors,"aw"
+ .align 4
+ .global __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
+
+ .section .dtors,"aw"
+ .align 4
+ .global __DTOR_LIST__
+__DTOR_LIST__:
+ .long -1
diff --git a/libc/sysdeps/linux/i386/crt0.S b/libc/sysdeps/linux/i386/crt0.S
index 79e0a6748..0095e6c67 100644
--- a/libc/sysdeps/linux/i386/crt0.S
+++ b/libc/sysdeps/linux/i386/crt0.S
@@ -71,3 +71,17 @@ _start:
/* Ok, now run uClibc's main() -- shouldn't return */
call __uClibc_main
+
+/* a little bit of stuff to support C++ */
+ .section .ctors,"aw"
+ .align 4
+ .global __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
+
+ .section .dtors,"aw"
+ .align 4
+ .global __DTOR_LIST__
+__DTOR_LIST__:
+ .long -1
+
diff --git a/libc/sysdeps/linux/i386/crt0.c b/libc/sysdeps/linux/i386/crt0.c
index c40224ca6..0498d06e1 100644
--- a/libc/sysdeps/linux/i386/crt0.c
+++ b/libc/sysdeps/linux/i386/crt0.c
@@ -24,6 +24,13 @@
extern void __uClibc_main(int argc,void *argv,void *envp);
+/* a little bit of stuff to support C++ */
+__asm__(".section .ctors,\"aw\"\n.align 4\n.global __CTOR_LIST__\n"
+ "__CTOR_LIST__:\n.long -1\n");
+
+__asm__(".section .dtors,\"aw\"\n.align 4\n.global __DTOR_LIST__\n"
+ "__DTOR_LIST__:\n.long -1\n");
+
void _start(unsigned int first_arg)
{
unsigned int argc;
diff --git a/libc/sysdeps/linux/powerpc/crt0.S b/libc/sysdeps/linux/powerpc/crt0.S
index 9eed91ebf..9866b20e9 100644
--- a/libc/sysdeps/linux/powerpc/crt0.S
+++ b/libc/sysdeps/linux/powerpc/crt0.S
@@ -55,4 +55,16 @@ _start:
bl __uClibc_main
+/* a little bit of stuff to support C++ */
+ .section .ctors,"aw"
+ .align 4
+ .global __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
+
+ .section .dtors,"aw"
+ .align 4
+ .global __DTOR_LIST__
+__DTOR_LIST__:
+ .long -1
diff --git a/libc/sysdeps/linux/powerpc/crt0.c b/libc/sysdeps/linux/powerpc/crt0.c
index b7e7f9b15..2460e910c 100644
--- a/libc/sysdeps/linux/powerpc/crt0.c
+++ b/libc/sysdeps/linux/powerpc/crt0.c
@@ -30,7 +30,23 @@ asm(
"\tstwu 1,-32(1)\n"
"\tmtlr 0\n"
//"\tstw 0,0(1)\n"
- "\tb _start2\n");
+ "\tb _start2\n
+
+ ");
+
+/* a little bit of stuff to support C++ */
+asm(
+ "\t.section .ctors,\"aw\"\n"
+ "\t.align 4\n"
+ "\t.global __CTOR_LIST__\n"
+ "__CTOR_LIST__:\n"
+ "\t.long -1\n"
+ "\t.section .dtors,\"aw\"\n"
+ "\t.align 4\n"
+ "\t.global __DTOR_LIST__\n"
+ "__DTOR_LIST__:\n"
+ "\t.long -1\n"
+ );
void __uClibc_main(int argc,void *argv,void *envp);