Ok this is trick. avoffset.c includes getfp.c at the end. clang is used to compile avoffset.c and getfp1.c. gcc is used to compile getfp.c. diff -uN inc.orig/avoffset.c inc/avoffset.c --- inc.orig/avoffset.c 2004-05-09 13:06:08.000000000 +0200 +++ inc/avoffset.c 2009-10-20 16:00:54.000000000 +0200 @@ -36,6 +36,7 @@ #include #include #include +#include #ifdef HAVE_SCANSTACK # include @@ -154,5 +155,3 @@ } } -#define IS_AVOFFSET -#include diff -uN inc.orig/getfp.c inc/getfp.c --- inc.orig/getfp.c 2003-07-13 01:10:47.000000000 +0200 +++ inc/getfp.c 2009-10-20 16:30:36.005762000 +0200 @@ -24,6 +24,8 @@ #include #include +#define IS_AVOFFSET + #ifndef IS_AVOFFSET /* * We usually don't like to compile a getfp() that returns junk data in case @@ -54,45 +56,14 @@ # define FP_OFF 0 #endif -EXPORT void **___fpoff __PR((char *cp)); +extern void **___fpoff __PR((char *cp)); EXPORT void ** getfp() { long **dummy[1]; -#ifdef sparc - flush_reg_windows(MAXWINDOWS-2); -#endif return ((void **)((struct frame *)___fpoff((char *)&dummy[0]))->fr_savfp); } -/* - * Don't make it static to avoid inline optimization. - * - * We need this function to fool GCCs check for returning addresses - * from outside the functions local address space. - */ -EXPORT void ** -___fpoff(cp) - char *cp; -{ - long ***lp; - - lp = (long ***)(cp + FP_OFF); - lp++; - return ((void **)lp); -} - -#ifdef sparc -EXPORT int -flush_reg_windows(n) - int n; -{ - if (--n > 0) - flush_reg_windows(n); - return (0); -} -#endif - #endif /* HAVE_SCANSTACK */ diff -uN inc.orig/getfp.h inc/getfp.h --- inc.orig/getfp.h 1970-01-01 01:00:00.000000000 +0100 +++ inc/getfp.h 2009-10-20 16:30:36.005762000 +0200 @@ -0,0 +1,5 @@ +EXPORT void **___fpoff __PR((char *cp)); + +EXPORT void ** getfp(); + +EXPORT void ** ___fpoff(char *cp); diff -uN inc.orig/getfp1.c inc/getfp1.c --- inc.orig/getfp1.c 1970-01-01 01:00:00.000000000 +0100 +++ inc/getfp1.c 2009-10-20 16:30:36.005762000 +0200 @@ -0,0 +1,20 @@ +#include +#include +#include + +# define FP_OFF 0 + +EXPORT void **___fpoff __PR((char *cp)); + +EXPORT void ** +___fpoff(cp) + char *cp; +{ + long ***lp; + + lp = (long ***)(cp + FP_OFF); + lp++; + return ((void **)lp); +} + +