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 Wed, Sep 10, 2003 at 05:42:30PM +0200, Andreas Schwab wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > + || (hdr->sh_flags | SHF_ALLOC) == 0)
>
> This can never be true.
You are right. I only need to check SHT_PROGBITS and SHT_NOBITS.
>
> > + if (hdr->sh_flags | SHF_IA_64_SHORT)
>
> This is always true.
>
I don't think so. You have to use .sbss/.sdata or 's' to make a section
SHF_IA_64_SHORT. But there is a bug in elfNN_ia64_special_sections.
Sections started with ".sbss" or ".sdata" should be marked as
SHF_IA_64_SHORT.
H.J.
---
2003-09-10 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_choose_gp): Skip non-program
sections when choosing gp.
(elfNN_ia64_special_sections): Mark all sections started
with ".sbss" or ".sdata" as SHF_IA_64_SHORT.
--- bfd/elfxx-ia64.c.gp 2003-09-08 14:19:42.000000000 -0700
+++ bfd/elfxx-ia64.c 2003-09-10 09:52:30.000000000 -0700
@@ -3607,8 +3607,12 @@ 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 sections. */
+ if (hdr->sh_type != SHT_PROGBITS && hdr->sh_type != SHT_NOBITS)
continue;
lo = os->vma;
@@ -3620,7 +3624,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;
@@ -4784,9 +4788,9 @@ elfNN_ia64_reloc_type_class (rela)
static struct bfd_elf_special_section const elfNN_ia64_special_sections[]=
{
- { ".sbss", 0, NULL, 0,
+ { ".sbss", 5, NULL, 0,
SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
- { ".sdata", 0, NULL, 0,
+ { ".sdata", 6, NULL, 0,
SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
{ NULL, 0, NULL, 0,
0, 0 }