This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Stub group default for hppa elf
On Sat, Feb 08, 2003 at 12:36:06AM -0500, John David Anglin wrote:
> The thing that's bothering me about this is the gcc branch transition
> limit is set at 240000 bytes. At that point, branches that can't
> reach the beginning of the current translation unit or function, as
> the case may be, get output as long branches and they don't need
> long branch stubs. I think changing the stub group size without
> changing the gcc value will leave a gap where a branch won't get
> a stub.
Hmm, I suppose it's true that allowing more stubs in the stub section
will make the situation worse. ld could easily detect the large
section case and not share a stub section in that case. Patch follows.
> I also need to rethink how this process works if we are
> going to collect both forward and backward branches.
Sections exceeding stub_group_size will always have their stubs before
the start of the section. See bfd/elf32-hppa.c:group_sections. I'm
not sure now whether I designed it that way or it just happened. :)
> There are also stub group issues with "ld -r".
Yeah, which is why I hacked hppa-linux ld to not merge .text on ld -r.
See ld/emultemp/hppaelf.em:hppaelf_after_parse.
* elf32-hppa.c (group_sections): Don't share a stub section if
stubs are for a large section.
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.94
diff -u -p -r1.94 elf32-hppa.c
--- bfd/elf32-hppa.c 8 Feb 2003 01:10:30 -0000 1.94
+++ bfd/elf32-hppa.c 8 Feb 2003 08:10:44 -0000
@@ -2686,12 +2686,15 @@ group_sections (htab, stub_group_size, s
asection *curr;
asection *prev;
bfd_size_type total;
+ bfd_boolean big_sec;
curr = tail;
if (tail->_cooked_size)
total = tail->_cooked_size;
else
total = tail->_raw_size;
+ big_sec = total >= stub_group_size;
+
while ((prev = PREV_SEC (curr)) != NULL
&& ((total += curr->output_offset - prev->output_offset)
< stub_group_size))
@@ -2719,8 +2722,11 @@ group_sections (htab, stub_group_size, s
while (tail != curr && (tail = prev) != NULL);
/* But wait, there's more! Input sections up to 240000
- bytes before the stub section can be handled by it too. */
- if (!stubs_always_before_branch)
+ bytes before the stub section can be handled by it too.
+ Don't do this if we have a really large section after the
+ stubs, as adding more stubs increases the chance that
+ branches may not reach into the stub section. */
+ if (!stubs_always_before_branch && !big_sec)
{
total = 0;
while (prev != NULL
--
Alan Modra
IBM OzLabs - Linux Technology Centre