This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add -fsection-anchors (4.2 project)
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Richard Sandiford <richard at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 7 Feb 2006 13:47:06 -0500 (EST)
- Subject: Re: Add -fsection-anchors (4.2 project)
- References: <87irrxvj5h.fsf@talisman.home>
On Thu, 2 Feb 2006, Richard Sandiford wrote:
> This is the main part for the 4.2 section anchor project:
>
> http://gcc.gnu.org/wiki/Section%20Anchor%20Optimisations
>
> The idea is to introduce anchor symbols that can be used to access
> several nearby objects. For example, if we have:
>
> static int a, b, c;
> int foo (void) { return a + b + c; }
>
> gcc will normally perform separate symbolic address calculations for
> "a", "b" and "c". The idea of this patch is to introduce a new anchor
> symbol and access "a", "b" and "c" relative to that anchor.
Yay, goodness!
> The main motivation is to reduce GOT size,
How can this change affect GOT sizes, *generally*?
Variables a, b, c do not need separate GOT entries when static.
Is there a wart in the ppc port?
If you actually apply this transformation for non-static
non-hidden variables too, then I think it isn't safe for
-fpic/-fPIC: non-hidden variables and functions must be
individually overridable. A quick grep in your patch shows that
it doesn't test flag_pic. Dunno if that's covered by other
means.
brgds, H-P