[Bug middle-end/12769] -mlongcall doesn't convert all calls to long calls for builtin functions
grehan at freebsd dot org
gcc-bugzilla@gcc.gnu.org
Thu Aug 12 05:19:00 GMT 2004
------- Additional Comments From grehan at freebsd dot org 2004-08-12 05:19 -------
I've run across this bug when doing loadable module support for FreeBSD/PPC.
Loadable modules run above 3Gb but have to call back to the kernel which is
loaded at 0.
Using GNU C version 3.4.2 [FreeBSD] 20040728 (powerpc-undermydesk-freebsd)
and compiling the program with "cc -c -v -S -mlongcall test.c"
extern int extfunc(void);
long long
testfunc(long long a, long long b)
{
extfunc();
return (a / b);
}
The assembler output shows that the extfunc() call uses the correct longcall
sequence, but the builtin __divdi3 for the 64-bit division still uses the
"bl" shortcall sequence.
The bug appears to be in rs6000.c:init_cumulative_args(). A libcall routine
has a NULL fntype parameter, so the test for the longcall/shortcall attribute
fails. The fix I'm using is:
--- rs6000.c Wed Aug 11 22:20:04 2004
+++ rs6000.c.longcall Thu Jul 29 19:18:38 2004
@@ -3946,6 +3946,9 @@
&& lookup_attribute ("longcall", TYPE_ATTRIBUTES (fntype))
&& !lookup_attribute ("shortcall", TYPE_ATTRIBUTES (fntype)))
cum->call_cookie = CALL_LONG;
+ else if (!fntype)
+ if (rs6000_default_long_calls)
+ cum->call_cookie = CALL_LONG;
... which should certainly be done in a cleaner fashion.
later,
Peter.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |grehan at freebsd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12769
More information about the Gcc-bugs
mailing list