public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "grehan at freebsd dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/12769] -mlongcall doesn't convert all calls to long calls for builtin functions
Date: Thu, 12 Aug 2004 05:19:00 -0000	[thread overview]
Message-ID: <20040812051951.10962.qmail@sourceware.org> (raw)
In-Reply-To: <20031024214052.12769.jfardo@laurelnetworks.com>


------- 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


  parent reply	other threads:[~2004-08-12  5:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-24 21:42 [Bug c++/12769] New: -mlongcall doesn't convert all calls to long calls in c++ programs jfardo at laurelnetworks dot com
2003-10-24 21:47 ` [Bug target/12769] " pinskia at gcc dot gnu dot org
2003-10-24 21:54 ` pinskia at gcc dot gnu dot org
2003-10-24 21:58 ` jfardo at laurelnetworks dot com
2003-10-24 22:13 ` [Bug middle-end/12769] " pinskia at gcc dot gnu dot org
2003-10-28 15:38 ` [Bug middle-end/12769] -mlongcall doesn't convert all calls to long calls for builtin functions pinskia at gcc dot gnu dot org
2003-11-23  7:14 ` pinskia at gcc dot gnu dot org
2004-08-12  5:19 ` grehan at freebsd dot org [this message]
2004-11-26 23:03 ` amodra at bigpond dot net dot au
2004-11-26 23:04 ` amodra at bigpond dot net dot au
2004-11-27  1:07 ` cvs-commit at gcc dot gnu dot org
2004-11-27  1:08 ` cvs-commit at gcc dot gnu dot org
2004-11-27  1:18 ` cvs-commit at gcc dot gnu dot org
2004-11-27  1:19 ` amodra at bigpond dot net dot au

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040812051951.10962.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).