if (bfd_link_relocatable (info))
return TRUE;
- /* Don't do anything special with non-loaded, non-alloced sections.
- In particular, any relocs in such sections should not affect GOT
- and PLT reference counting (ie. we don't allow them to create GOT
- or PLT entries), there's no possibility or desire to optimize TLS
- relocs, and there's not much point in propagating relocs to shared
- libs that the dynamic linker won't relocate. */
- if ((sec->flags & SEC_ALLOC) == 0)
- return TRUE;
-
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
sym_hashes_end = (sym_hashes
{
srel = elf_section_data (p->sec)->sreloc;
srel->size += p->count * sizeof (Elf32_External_Rela);
- if ((p->sec->output_section->flags & SEC_READONLY) != 0)
- info->flags |= DF_TEXTREL;
}
}
}
|| !add_dynamic_entry (DT_JMPREL, 0)))
return FALSE;
- if (relocs
- && (!add_dynamic_entry (DT_RELA, 0)
+ if (relocs)
+ {
+ if (!add_dynamic_entry (DT_RELA, 0)
|| !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))))
- return FALSE;
+ || !add_dynamic_entry (DT_RELAENT,
+ sizeof (Elf32_External_Rela)))
+ return FALSE;
- if (!bfd_link_pic (info) && !add_dynamic_entry (DT_NIOS2_GP, 0))
- return FALSE;
+ if ((info->flags & DF_TEXTREL) == 0)
+ elf_link_hash_traverse (&htab->root,
+ _bfd_elf_maybe_set_textrel, info);
- if ((info->flags & DF_TEXTREL) != 0
- && !add_dynamic_entry (DT_TEXTREL, 0))
+ if ((info->flags & DF_TEXTREL) != 0
+ && !add_dynamic_entry (DT_TEXTREL, 0))
+ return FALSE;
+ }
+
+ if (!bfd_link_pic (info) && !add_dynamic_entry (DT_NIOS2_GP, 0))
return FALSE;
}
#undef add_dynamic_entry