PATCH: IA64 linker sets DT_TEXTREL incorrectly
H. J. Lu
hjl@lucon.org
Thu Feb 26 00:23:00 GMT 2004
Subject: [Bug target/14280] Cpp is marked with DT_TEXTREL
Looks like a linker bug. The only relocations I see are against .got
and .IA_64.pltoff, which are writable.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14280
It is a linker bug. Linker assumes relocations in read only sections
will never be resolved locally, which is false. This patch fixes
the problem.
H.J.
-------------- next part --------------
2004-01-25 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_dyn_reloc_entry): Add the reltext.
field to track if a relocation is against readonly section.
(count_dyn_reloc): Take a new argument for rent->reltext.
(elfNN_ia64_check_relocs): Adjust call to count_dyn_reloc.
(get_reloc_section): Don't set ia64_info->reltext here.
(allocate_dynrel_entries): Set ia64_info->reltext here.
--- bfd/elfxx-ia64.c.reltext 2004-02-24 09:33:22.000000000 -0800
+++ bfd/elfxx-ia64.c 2004-02-25 16:14:43.000000000 -0800
@@ -102,6 +102,9 @@ struct elfNN_ia64_dyn_sym_info
asection *srel;
int type;
int count;
+
+ /* Is this reloc against readonly section? */
+ bfd_boolean reltext;
} *reloc_entries;
/* TRUE when the section contents have been updated. */
@@ -253,9 +256,6 @@ static asection *get_pltoff
static asection *get_reloc_section
PARAMS ((bfd *abfd, struct elfNN_ia64_link_hash_table *ia64_info,
asection *sec, bfd_boolean create));
-static bfd_boolean count_dyn_reloc
- PARAMS ((bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
- asection *srel, int type));
static bfd_boolean elfNN_ia64_check_relocs
PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec,
const Elf_Internal_Rela *relocs));
@@ -2187,18 +2187,12 @@ get_reloc_section (abfd, ia64_info, sec,
return NULL;
}
- if (sec->flags & SEC_READONLY)
- ia64_info->reltext = 1;
-
return srel;
}
static bfd_boolean
-count_dyn_reloc (abfd, dyn_i, srel, type)
- bfd *abfd;
- struct elfNN_ia64_dyn_sym_info *dyn_i;
- asection *srel;
- int type;
+count_dyn_reloc (bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
+ asection *srel, int type, bfd_boolean reltext)
{
struct elfNN_ia64_dyn_reloc_entry *rent;
@@ -2219,6 +2213,7 @@ count_dyn_reloc (abfd, dyn_i, srel, type
rent->count = 0;
dyn_i->reloc_entries = rent;
}
+ rent->reltext = reltext;
rent->count++;
return TRUE;
@@ -2505,7 +2500,8 @@ elfNN_ia64_check_relocs (abfd, info, sec
if (!srel)
return FALSE;
}
- if (!count_dyn_reloc (abfd, dyn_i, srel, dynrel_type))
+ if (!count_dyn_reloc (abfd, dyn_i, srel, dynrel_type,
+ (sec->flags & SEC_READONLY)))
return FALSE;
}
}
@@ -2816,6 +2812,8 @@ allocate_dynrel_entries (dyn_i, data)
default:
abort ();
}
+ if (rent->reltext)
+ ia64_info->reltext = 1;
rent->srel->_raw_size += sizeof (ElfNN_External_Rela) * count;
}
More information about the Binutils
mailing list