summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-11-03 15:04:19 +0000
committerEric Andersen <andersen@codepoet.org>2002-11-03 15:04:19 +0000
commitc6e5fdc8e91b19133840abd5ee53673945719070 (patch)
tree4aa81e0d6618f6e58dff2ea0af35c83b617df12a /libc
parent0287134396b5750243972e382db3f9e9e2138aad (diff)
Another update to initfini.awk and initfini.c from Stefan Allius
to hopefully address SH wierdness. Now works on other architecture properly as well.
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/common/initfini.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/initfini.c b/libc/sysdeps/linux/common/initfini.c
index 4ff7c8218..64fdf6eb4 100644
--- a/libc/sysdeps/linux/common/initfini.c
+++ b/libc/sysdeps/linux/common/initfini.c
@@ -52,6 +52,23 @@
# define HIDDEN(func)
#endif
+#if defined(__sh__)
+ /* The macro insert this sh specific stuff:
+ @_SH_GLB_BEGINS
+ bra 1f
+ nop
+ ALIGN
+ @func_SH_GLB_LABEL
+ 1:
+ @_SH_GLB_ENDS
+ */
+#define GLB_STUFF(func) asm ("\n/*@_SH_GLB_BEGINS*/"); \
+ asm ("\n\tbra\t1f\n\tnop\n\tALIGN\n/*@" #func"_SH_GLB_LABEL*/\n1:"); \
+ asm ("\n/*@_SH_GLB_ENDS*/");
+#else
+#define GLB_STUFF(func)
+#endif
+
/* The initial common code ends here. */
asm ("\n/*@HEADER_ENDS*/");
@@ -107,6 +124,7 @@ void _init (void)
asm ("\n/*@_init_PROLOG_UNPAUSES*/");
#endif
+ GLB_STUFF(_init)
asm ("ALIGN");
asm("END_INIT");
/* Now the epilog. */
@@ -127,6 +145,7 @@ void _fini (void)
{
/* End of the _fini prolog. */
+ GLB_STUFF(_fini)
asm ("ALIGN");
asm ("END_FINI");
asm ("\n/*@_fini_PROLOG_ENDS*/");