From: Geoff Keating <geoffk@ozemail.com.au>
To: Franz.Sirl-kernel@lauterbach.com
Cc: amylaar@cygnus.co.uk, law@cygnus.com, ghazi@caip.Rutgers.EDU,
davem@cobaltmicro.com, egcs@egcs.cygnus.com
Subject: Re: PIC register allocation by reload (Was: Re: egcs-1.2 stuff)
Date: Tue, 18 May 1999 21:33:00 -0000 [thread overview]
Message-ID: <199905190423.OAA05178@geoffk.wattle.id.au> (raw)
In-Reply-To: <4.2.0.37.19990506233202.036d7400@mail.lauterbach.com>
> Date: Thu, 06 May 1999 23:44:47 +0200
> From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
> Cc: amylaar@cygnus.co.uk, law@cygnus.com, ghazi@snafu.Rutgers.EDU,
> davem@cobaltmicro.com, egcs@egcs.cygnus.com
>
> At 23:15 06.05.99 , Geoff Keating wrote:
> >Is this testcase already in the test suite? It's stripped-down code
> >from kaffe's implementation of GNU zip.
>
> Geoff,
>
> this testcase is not in the testsuite, but it also no longer FAILs with the
> current cvs-egcs, reload got a _lot_ smarter since egcs-1.1. But there's
> one testcase in the testsuite which still shows this problem with -fpic on
> PPC, attached below.
...
The canonical example of this sort of thing is this:
extern int v;
void f(void)
{
asm ("" : : "r"(&v));
}
because until it actually parses the asm, reload can't tell that it's
not
extern int v;
void f(void)
{
asm ("" : : "i"(&v));
}
which does not need the GOT register---this is not a hypothetical
example, the first one happens in glibc somewhere, and you use the
second one to override -fpic on a section of code which you know will
be in writable memory, like (on ppc):
static const double real_params[] = { 1, 2, 3.141 };
const double * params(void) __attribute__((section(".wcode"), const));
const double * params(void)
{
const double *result;
/* Just like `return real_params', except that it is not PIC and
so will be faster under these circumstances (it saves building
a stack frame, for instance). */
asm ("lis %0,%1@ha ; addi %0,%0,%1@lo" : "=b"(result) : "i"(real_params));
return result;
}
--
Geoffrey Keating <geoffk@ozemail.com.au>
WARNING: multiple messages have this Message-ID
From: Geoff Keating <geoffk@ozemail.com.au>
To: Franz.Sirl-kernel@lauterbach.com
Cc: amylaar@cygnus.co.uk, law@cygnus.com, ghazi@caip.Rutgers.EDU,
davem@cobaltmicro.com, egcs@egcs.cygnus.com
Subject: Re: PIC register allocation by reload (Was: Re: egcs-1.2 stuff)
Date: Mon, 31 May 1999 21:36:00 -0000 [thread overview]
Message-ID: <199905190423.OAA05178@geoffk.wattle.id.au> (raw)
Message-ID: <19990531213600.afNv6VOaMI6ZtuYeKDJH5QGdFVuSYNmdYCCLBw7_8Jk@z> (raw)
In-Reply-To: <4.2.0.37.19990506233202.036d7400@mail.lauterbach.com>
> Date: Thu, 06 May 1999 23:44:47 +0200
> From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
> Cc: amylaar@cygnus.co.uk, law@cygnus.com, ghazi@snafu.Rutgers.EDU,
> davem@cobaltmicro.com, egcs@egcs.cygnus.com
>
> At 23:15 06.05.99 , Geoff Keating wrote:
> >Is this testcase already in the test suite? It's stripped-down code
> >from kaffe's implementation of GNU zip.
>
> Geoff,
>
> this testcase is not in the testsuite, but it also no longer FAILs with the
> current cvs-egcs, reload got a _lot_ smarter since egcs-1.1. But there's
> one testcase in the testsuite which still shows this problem with -fpic on
> PPC, attached below.
...
The canonical example of this sort of thing is this:
extern int v;
void f(void)
{
asm ("" : : "r"(&v));
}
because until it actually parses the asm, reload can't tell that it's
not
extern int v;
void f(void)
{
asm ("" : : "i"(&v));
}
which does not need the GOT register---this is not a hypothetical
example, the first one happens in glibc somewhere, and you use the
second one to override -fpic on a section of code which you know will
be in writable memory, like (on ppc):
static const double real_params[] = { 1, 2, 3.141 };
const double * params(void) __attribute__((section(".wcode"), const));
const double * params(void)
{
const double *result;
/* Just like `return real_params', except that it is not PIC and
so will be faster under these circumstances (it saves building
a stack frame, for instance). */
asm ("lis %0,%1@ha ; addi %0,%0,%1@lo" : "=b"(result) : "i"(real_params));
return result;
}
--
Geoffrey Keating <geoffk@ozemail.com.au>
next prev parent reply other threads:[~1999-05-18 21:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-28 6:12 egcs-1.2 stuff Kaveh R. Ghazi
1999-03-28 6:24 ` David Miller
1999-03-31 23:46 ` David Miller
1999-03-28 13:09 ` Jeffrey A Law
1999-03-28 16:06 ` David Miller
1999-03-31 23:46 ` David Miller
1999-03-31 23:46 ` Jeffrey A Law
1999-04-30 10:46 ` PIC register allocation by reload (Was: Re: egcs-1.2 stuff) Joern Rennecke
1999-04-30 23:15 ` Joern Rennecke
1999-05-06 13:36 ` Franz Sirl
1999-05-06 14:16 ` Geoff Keating
1999-05-06 14:45 ` Franz Sirl
1999-05-13 1:12 ` Jeffrey A Law
1999-05-31 21:36 ` Jeffrey A Law
1999-05-18 21:33 ` Geoff Keating [this message]
1999-05-31 21:36 ` Geoff Keating
1999-05-31 21:36 ` Franz Sirl
1999-05-31 21:36 ` Geoff Keating
1999-05-31 21:36 ` Franz Sirl
1999-03-31 23:46 ` egcs-1.2 stuff Kaveh R. Ghazi
1999-05-06 18:53 PIC register allocation by reload (Was: Re: egcs-1.2 stuff) Kaveh R. Ghazi
1999-05-31 21:36 ` Kaveh R. Ghazi
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=199905190423.OAA05178@geoffk.wattle.id.au \
--to=geoffk@ozemail.com.au \
--cc=Franz.Sirl-kernel@lauterbach.com \
--cc=amylaar@cygnus.co.uk \
--cc=davem@cobaltmicro.com \
--cc=egcs@egcs.cygnus.com \
--cc=ghazi@caip.Rutgers.EDU \
--cc=law@cygnus.com \
/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).