aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-05-22 15:06:23 +0000
committerDaniel Jacobowitz <drow@false.org>2006-05-22 15:06:23 +0000
commit943284cc7c29a74a1bd1c7d90ea6dbd03bc8b17c (patch)
treec89202785fa39aafbab7e55264d799e88cabd30a /bfd/elflink.c
parenta47212510fe70b26a950753d506b1a68708e0e26 (diff)
downloadgdb-943284cc7c29a74a1bd1c7d90ea6dbd03bc8b17c.zip
gdb-943284cc7c29a74a1bd1c7d90ea6dbd03bc8b17c.tar.gz
gdb-943284cc7c29a74a1bd1c7d90ea6dbd03bc8b17c.tar.bz2
bfd/
* elflink.c (_bfd_elf_add_dynamic_entry): Remove DT_TEXTREL check. (bfd_elf_final_link): Add a late DT_TEXTREL check. * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): Define. (mips_elf_create_dynamic_relocation): Set DF_TEXTREL. (_bfd_mips_elf_check_relocs): Delete MIPS_READONLY_SECTION. Use MIPS_ELF_READONLY_SECTION. (_bfd_mips_elf_size_dynamic_sections): Clear DF_TEXTREL after creating DT_TEXTREL. (_bfd_mips_elf_finish_dynamic_sections): Clear textrel markers if no text relocations were generated. ld/testsuite/ * ld-mips-elf/textrel-1.d: Relax some patterns.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 338ee06..ff401f2 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2810,10 +2810,6 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
if (! is_elf_hash_table (hash_table))
return FALSE;
- if (info->warn_shared_textrel && info->shared && tag == DT_TEXTREL)
- _bfd_error_handler
- (_("warning: creating a DT_TEXTREL in a shared object."));
-
bed = get_elf_backend_data (hash_table->dynobj);
s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
BFD_ASSERT (s != NULL);
@@ -8655,6 +8651,32 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info))
goto error_return;
+ /* Check for DT_TEXTREL (late, in case the backend removes it). */
+ if (info->warn_shared_textrel && info->shared)
+ {
+ bfd_byte *dyncon, *dynconend;
+
+ /* Fix up .dynamic entries. */
+ o = bfd_get_section_by_name (dynobj, ".dynamic");
+ BFD_ASSERT (o != NULL);
+
+ dyncon = o->contents;
+ dynconend = o->contents + o->size;
+ for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
+ {
+ Elf_Internal_Dyn dyn;
+
+ bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
+
+ if (dyn.d_tag == DT_TEXTREL)
+ {
+ _bfd_error_handler
+ (_("warning: creating a DT_TEXTREL in a shared object."));
+ break;
+ }
+ }
+ }
+
for (o = dynobj->sections; o != NULL; o = o->next)
{
if ((o->flags & SEC_HAS_CONTENTS) == 0