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;
+
BFD_ASSERT (is_i386_elf (abfd));
htab = elf_i386_hash_table (info);
may need to keep relocations for symbols satisfied by a
dynamic library if we manage to avoid copy relocs for the
symbol. */
- if ((sec->flags & SEC_ALLOC) != 0
- && ((bfd_link_pic (info)
- && (r_type != R_386_PC32
- || (h != NULL
- && (! (bfd_link_pie (info)
- || SYMBOLIC_BIND (info, h))
- || h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
- || (ELIMINATE_COPY_RELOCS
- && !bfd_link_pic (info)
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
+ if ((bfd_link_pic (info)
+ && (r_type != R_386_PC32
+ || (h != NULL
+ && (! (bfd_link_pie (info)
+ || SYMBOLIC_BIND (info, h))
+ || h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular)))
{
struct elf_dyn_relocs *p;
struct elf_dyn_relocs **head;
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;
+
BFD_ASSERT (is_x86_64_elf (abfd));
htab = elf_x86_64_hash_table (info);
&& h != NULL
&& !h->def_regular
&& h->def_dynamic
- && (sec->flags & SEC_READONLY) == 0))
- && (sec->flags & SEC_ALLOC) != 0)
+ && (sec->flags & SEC_READONLY) == 0)))
return elf_x86_64_need_pic (abfd, sec, h, symtab_hdr, isym,
&x86_64_elf_howto_table[r_type]);
/* Fall through. */
may need to keep relocations for symbols satisfied by a
dynamic library if we manage to avoid copy relocs for the
symbol. */
- if ((sec->flags & SEC_ALLOC) != 0
- && ((bfd_link_pic (info)
- && (! IS_X86_64_PCREL_TYPE (r_type)
- || (h != NULL
- && (! (bfd_link_pie (info)
- || SYMBOLIC_BIND (info, h))
- || h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
- || (ELIMINATE_COPY_RELOCS
- && !bfd_link_pic (info)
- && h != NULL
- && (h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
+ if ((bfd_link_pic (info)
+ && (! IS_X86_64_PCREL_TYPE (r_type)
+ || (h != NULL
+ && (! (bfd_link_pie (info)
+ || SYMBOLIC_BIND (info, h))
+ || h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular)))
{
struct elf_dyn_relocs *p;
struct elf_dyn_relocs **head;