From c6e5fdc8e91b19133840abd5ee53673945719070 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sun, 3 Nov 2002 15:04:19 +0000 Subject: Another update to initfini.awk and initfini.c from Stefan Allius to hopefully address SH wierdness. Now works on other architecture properly as well. --- libc/sysdeps/linux/common/initfini.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'libc') 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*/"); -- cgit v1.2.3