s = bfd_get_section_by_name (dynobj, ".dynbss");
BFD_ASSERT (s != NULL);
- /* If the symbol is currently defined in the .bss section of the
- dynamic object, then it is OK to simply initialize it to zero.
- If the symbol is in some other section, we must generate a
- R_PPC_COPY reloc to tell the dynamic linker to copy the initial
- value out of the dynamic object and into the runtime process
- image. We need to remember the offset into the .rela.bss section
- we are going to use. */
- if ((h->root.u.def.section->flags & SEC_LOAD) != 0)
+ /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
+ copy the initial value out of the dynamic object and into the
+ runtime process image. We need to remember the offset into the
+ .rela.bss section we are going to use. */
+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
asection *srel;
bfd_get_filename (abfd));
#endif
- /* Create the linker generated sections all the time so that the special
- symbols are created. */
- if ((got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL)
- {
- got = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_GOT);
- if (!got)
- ret = false;
- }
+ /* Create the linker generated sections all the time so that the
+ special symbols are created. The .got section is an exception,
+ so that we don't waste space allocating it when it is not needed. */
#if 0
if ((plt = elf_linker_section (abfd, LINKER_SECTION_PLT)) == NULL)
ret = false;
}
+ if ((got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL)
+ {
+ got = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_GOT);
+ if (!got)
+ ret = false;
+ }
+
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
break;
}
+ if (got == NULL
+ && (got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL)
+ {
+ got = ppc_elf_create_linker_section (abfd, info,
+ LINKER_SECTION_GOT);
+ if (!got)
+ {
+ ret = false;
+ break;
+ }
+ }
+
if (got->rel_section == NULL
&& (h != NULL || info->shared)
&& !_bfd_elf_make_linker_section_rela (dynobj, got, 2))
break;
}
+ if (got == NULL
+ && (got = elf_linker_section (abfd, LINKER_SECTION_GOT)) == NULL)
+ {
+ got = ppc_elf_create_linker_section (abfd, info,
+ LINKER_SECTION_GOT);
+ if (!got)
+ {
+ ret = false;
+ break;
+ }
+ }
+
if (got->rel_section == NULL
&& (h != NULL || info->shared)
&& !_bfd_elf_make_linker_section_rela (dynobj, got, 2))