This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: A typo in elfNN_ia64_choose_gp?
On Mon, Sep 08, 2003 at 07:36:51PM -0700, Richard Henderson wrote:
> On Mon, Sep 08, 2003 at 05:37:21PM -0700, H. J. Lu wrote:
> > > As the result, we can't support as much short data as we should. Do
> > > we have to count text sections for min_vma and max_vma? I'd like to
> > > change them to min_data_vma and max_data_vma, and use them to pick
> > > a better gp.
> > >
> >
> > Never mind. The readonly data will be in the text segment.
>
> Certainly falling back to min_data_vma is a good idea for
> executables, but min_vma is definitely correct for libraries.
>
>
How about this patch?
H.J.
---
2003-09-09 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_choose_gp): Skip non-program and
text sections when choosing gp.
--- bfd/elfxx-ia64.c.gp 2003-09-08 14:19:42.000000000 -0700
+++ bfd/elfxx-ia64.c 2003-09-09 22:40:17.000000000 -0700
@@ -3607,8 +3607,14 @@ elfNN_ia64_choose_gp (abfd, info)
for (os = abfd->sections; os ; os = os->next)
{
bfd_vma lo, hi;
+ Elf_Internal_Shdr *hdr;
- if ((os->flags & SEC_ALLOC) == 0)
+ hdr = &elf_section_data (os)->this_hdr;
+
+ /* Skip non-program and text sections. */
+ if (hdr->sh_type != SHT_PROGBITS
+ || (hdr->sh_flags | SHF_ALLOC) == 0
+ || (hdr->sh_flags | SHF_EXECINSTR) != 0)
continue;
lo = os->vma;
@@ -3620,7 +3626,7 @@ elfNN_ia64_choose_gp (abfd, info)
min_vma = lo;
if (max_vma < hi)
max_vma = hi;
- if (os->flags & SEC_SMALL_DATA)
+ if (hdr->sh_flags | SHF_IA_64_SHORT)
{
if (min_short_vma > lo)
min_short_vma = lo;