This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Stub group default for hppa elf
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: amodra at bigpond dot net dot au (Alan Modra)
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 7 Feb 2003 20:58:29 -0500 (EST)
- Subject: Re: Stub group default for hppa elf
> This change doesn't directly address the stub overflow problem, but
> changes stub section placement to always be before the branches into
> the stubs. ie. you've gone from
>
> ======
> code group A
> ======
> stubs for A + B
> ======
> code group B
> ======
>
> to
>
> ======
> stubs for A
> ======
> code group A
> ======
> stubs for B
> ======
> code group B
> ======
Yes.
> Of course, the chances are that "stubs for A + B" is roughly the size
> of "stubs for A" plus "stubs for B" (may be smaller than the sum due
> to merging of duplicate stubs). ie. a default of 1 tends to make stub
> sections twice as large as a default of -1, and that is why changing
> the default helps.
I think the problem when the default is 1 is that "stubs for A + B"
looks like
code for group A
=====
stubs for B
stubs for A
====
code for group B
Thus, each code group has to branch further than it has to. However,
this is just speculation.
> I think the following patch is more appropriate, but will leave
> reverting your patch to you. The only real reason to always place
> stubs before their associated code section is when you're doing
> conditional branches to a stub and you want to control branch
> prediction.
>
> * elf32-hppa.c (elf32_hppa_size_stubs): Double the size left for
> stubs if !stubs_always_before_branch.
I'm not convinced that it's actually necessary to do this if the
stubs are placed correctly.
> Index: bfd/elf32-hppa.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
> retrieving revision 1.93
> diff -u -p -r1.93 elf32-hppa.c
> --- bfd/elf32-hppa.c 8 Jan 2003 02:19:23 -0000 1.93
> +++ bfd/elf32-hppa.c 8 Feb 2003 00:53:20 -0000
> @@ -2901,11 +2901,22 @@ elf32_hppa_size_stubs (output_bfd, stub_
> if (stub_group_size == 1)
> {
> /* Default values. */
> - stub_group_size = 7680000;
> - if (htab->has_17bit_branch || htab->multi_subspace)
> - stub_group_size = 240000;
> - if (htab->has_12bit_branch)
> - stub_group_size = 7500;
> + if (stubs_always_before_branch)
> + {
> + stub_group_size = 7680000;
> + if (htab->has_17bit_branch || htab->multi_subspace)
> + stub_group_size = 240000;
> + if (htab->has_12bit_branch)
> + stub_group_size = 7500;
> + }
> + else
> + {
> + stub_group_size = 6971392;
> + if (htab->has_17bit_branch || htab->multi_subspace)
> + stub_group_size = 217856;
> + if (htab->has_12bit_branch)
> + stub_group_size = 6808;
> + }
> }
>
> group_sections (htab, stub_group_size, stubs_always_before_branch);
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)