source: scripts/patch/binutils/2.19.1/20-relaxed_ld_powerpc.patch@ 5ae576c8

clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5ae576c8 was b2d50f5, checked in by Jim Gifford <clfs@…>, 15 years ago

Added: Binutils Patch to Fix PPC

  • Property mode set to 100644
File size: 1.5 KB
  • ld/emultempl/ppc32elf.em

    This aims to make life a little easier for people building large
    PowerPC binaries where the PLT is out of reach for 24-bit branches.
    
    	* emultempl/ppc32elf.em (ppc_before_allocation): Turn on
    	linker relaxation if it might be necessary.
    
    diff -Naur binutils-2.19.1.orig/ld/emultempl/ppc32elf.em binutils-2.19.1/ld/emultempl/ppc32elf.em
    old new  
    112112            }
    113113        }
    114114    }
     115
    115116  gld${EMULATION_NAME}_before_allocation ();
     117
     118  /* Turn on relaxation if executable sections have addresses that
     119     might make branches overflow.  */
     120  if (!command_line.relax)
     121    {
     122      bfd_vma low = (bfd_vma) -1;
     123      bfd_vma high = 0;
     124      asection *o;
     125
     126      /* Run lang_size_sections (if not already done).  */
     127      if (expld.phase != lang_mark_phase_enum)
     128        {
     129          expld.phase = lang_mark_phase_enum;
     130          expld.dataseg.phase = exp_dataseg_none;
     131          one_lang_size_sections_pass (NULL, FALSE);
     132          lang_reset_memory_regions ();
     133        }
     134
     135      for (o = link_info.output_bfd->sections; o != NULL; o = o->next)
     136        {
     137          if ((o->flags & (SEC_ALLOC | SEC_CODE)) != (SEC_ALLOC | SEC_CODE))
     138            continue;
     139          if (o->size == 0)
     140            continue;
     141          if (low > o->vma)
     142            low = o->vma;
     143          if (high < o->vma + o->size - 1)
     144            high = o->vma + o->size - 1;
     145        }
     146      if (high > low && high - low > (1 << 25) - 1)
     147        command_line.relax = TRUE;
     148    }
    116149}
    117150
    118151EOF
Note: See TracBrowser for help on using the repository browser.