* elf32-hppa.c (group_sections): Don't share a stub section if
authorAlan Modra <amodra@gmail.com>
Sat, 8 Feb 2003 08:18:41 +0000 (08:18 +0000)
committerAlan Modra <amodra@gmail.com>
Sat, 8 Feb 2003 08:18:41 +0000 (08:18 +0000)
stubs are for a large section.

bfd/ChangeLog
bfd/elf32-hppa.c

index 02cebf4858211e909d119a0eb09d1f48e6304eb7..2033f639575040c20e0c07dffbb968b9a72be6ac 100644 (file)
@@ -1,5 +1,8 @@
 2003-02-08  Alan Modra  <amodra@bigpond.net.au>
 
+       * elf32-hppa.c (group_sections): Don't share a stub section if
+       stubs are for a large section.
+
        * elf32-hppa.c (elf32_hppa_size_stubs): Double the size left for
        stubs if !stubs_always_before_branch.
 
index 69ead0dbf45931586abeb07503ea63e5cf662fe1..80e8b1861c1b222371aa3d3bf5208e0b44bd98a8 100644 (file)
@@ -2686,12 +2686,15 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
          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, stubs_always_before_branch)
          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