return FALSE;
/* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
- elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32);
+ elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32);
/* pr_reg */
offset = 112;
if (note->descsz != 136)
return FALSE;
- elf_tdata (abfd)->core_pid
+ elf_tdata (abfd)->core->pid
= bfd_get_32 (abfd, note->descdata + 24);
- elf_tdata (abfd)->core_program
+ elf_tdata (abfd)->core->program
= _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
- elf_tdata (abfd)->core_command
+ elf_tdata (abfd)->core->command
= _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
return TRUE;
slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
if (! (*slurp_relocs) (abfd, relplt, dyn_syms, TRUE))
goto free_contents_and_exit;
-
+
plt_count = relplt->size / sizeof (Elf64_External_Rela);
size += plt_count * sizeof (asymbol);
bfd_hash_table_free (&htab->branch_hash_table);
if (htab->tocsave_htab)
htab_delete (htab->tocsave_htab);
- _bfd_generic_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (hash);
}
/* Satisfy the ELF linker by filling in some fields in our fake bfd. */
const Elf_Internal_Rela *rel)
{
char *stub_name;
- bfd_size_type len;
+ ssize_t len;
/* rel->r_addend is actually 64 bit, but who uses more than +/- 2^31
offsets from a sym as a branch target? In fact, we could
if (stub_name == NULL)
return stub_name;
- sprintf (stub_name, "%08x.%s+%x",
- input_section->id & 0xffffffff,
- h->elf.root.root.string,
- (int) rel->r_addend & 0xffffffff);
+ len = sprintf (stub_name, "%08x.%s+%x",
+ input_section->id & 0xffffffff,
+ h->elf.root.root.string,
+ (int) rel->r_addend & 0xffffffff);
}
else
{
if (stub_name == NULL)
return stub_name;
- sprintf (stub_name, "%08x.%x:%x+%x",
- input_section->id & 0xffffffff,
- sym_sec->id & 0xffffffff,
- (int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
- (int) rel->r_addend & 0xffffffff);
+ len = sprintf (stub_name, "%08x.%x:%x+%x",
+ input_section->id & 0xffffffff,
+ sym_sec->id & 0xffffffff,
+ (int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
+ (int) rel->r_addend & 0xffffffff);
}
- if (stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
+ if (len > 2 && stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
stub_name[len - 2] = 0;
return stub_name;
}
/* If we were called to copy over info for a weak sym, that's all.
You might think dyn_relocs need not be copied over; After all,
both syms will be dynamic or both non-dynamic so we're just
- moving reloc accounting around. However, ELIMINATE_COPY_RELOCS
+ moving reloc accounting around. However, ELIMINATE_COPY_RELOCS
code in ppc64_elf_adjust_dynamic_symbol needs to check for
dyn_relocs in read-only sections, and it does so on what is the
DIR sym here. */
sections. Allow them to proceed, but warn that this might
break at runtime. */
info->callbacks->einfo
- (_("%P: copy reloc against `%s' requires lazy plt linking; "
+ (_("%P: copy reloc against `%T' requires lazy plt linking; "
"avoid setting LD_BIND_NOW=1 or upgrade gcc\n"),
h->root.root.string);
}
void *vpp = &elf_section_data (sec)->local_dynrel;
pp = (struct elf_dyn_relocs **) vpp;
}
-
- /* elf_gc_sweep may have already removed all dyn relocs associated
- with local syms for a given section. Don't report a dynreloc
- miscount. */
- if (*pp == NULL)
- return TRUE;
}
+ /* elf_gc_sweep may have already removed all dyn relocs associated
+ with local syms for a given section. Also, symbol flags are
+ changed by elf_gc_sweep_symbol, confusing the test above. Don't
+ report a dynreloc miscount. */
+ if (*pp == NULL && info->gc_sections)
+ return TRUE;
+
while ((p = *pp) != NULL)
{
if (p->sec == sec)
. addi ry,rx,addr@toc@l
when addr is within 2G of the toc pointer. This then means
that the word storing "addr" in the toc is no longer needed. */
-
+
if (!ppc64_elf_tdata (ibfd)->has_small_toc_reloc
&& toc->output_section->rawsize < (bfd_vma) 1 << 31
&& toc->reloc_count != 0)
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
ppc_howto_init ();
info->callbacks->einfo
- (_("%P: %H: %s relocation references "
+ (_("%P: %H: %s references "
"optimized away TOC entry\n"),
ibfd, sec, rel->r_offset,
ppc64_elf_howto_table[r_type]->name);
bfd_vma glinkoff = GLINK_CALL_STUB_SIZE + pltindex * 8;
bfd_vma to, from;
- if (pltindex > 32767)
- glinkoff += (pltindex - 32767) * 4;
+ if (pltindex > 32768)
+ glinkoff += (pltindex - 32768) * 4;
to = (glinkoff
+ htab->glink->output_offset
+ htab->glink->output_section->vma);
{
bfd_put_32 (obfd, CMPLDI_R2_0, p), p += 4;
bfd_put_32 (obfd, BNECTR_P4, p), p += 4;
- bfd_put_32 (obfd, B_DOT + cmp_branch_off, p), p += 4;
+ bfd_put_32 (obfd, B_DOT | (cmp_branch_off & 0x3fffffc), p), p += 4;
}
else
bfd_put_32 (obfd, BCTR, p), p += 4;
if (strcmp (opd->name, ".opd") != 0
|| opd->reloc_count != 0)
{
- info->callbacks->einfo (_("%P: cannot find opd entry toc for %s\n"),
+ info->callbacks->einfo (_("%P: cannot find opd entry toc for `%T'\n"),
stub_entry->h->elf.root.root.string);
bfd_set_error (bfd_error_bad_value);
return 0;
if (off + (1 << 25) >= (bfd_vma) (1 << 26))
{
- info->callbacks->einfo (_("%P: long branch stub `%s' offset overflow\n"),
- stub_entry->root.string);
+ info->callbacks->einfo
+ (_("%P: long branch stub `%s' offset overflow\n"),
+ stub_entry->root.string);
htab->stub_error = TRUE;
return FALSE;
}
if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
{
info->callbacks->einfo
- (_("%P: linkage table error against `%s'\n"),
+ (_("%P: linkage table error against `%T'\n"),
stub_entry->root.string);
bfd_set_error (bfd_error_bad_value);
htab->stub_error = TRUE;
if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
{
info->callbacks->einfo
- (_("%P: linkage table error against `%s'\n"),
+ (_("%P: linkage table error against `%T'\n"),
stub_entry->h != NULL
? stub_entry->h->elf.root.root.string
: "<local sym>");
htab->plt_static_chain = plt_static_chain;
htab->plt_stub_align = plt_stub_align;
+ if (plt_thread_safe == -1 && !info->executable)
+ plt_thread_safe = 1;
if (plt_thread_safe == -1)
{
- const char *const thread_starter[] =
+ static const char *const thread_starter[] =
{
"pthread_create",
/* libstdc++ */
"GOMP_parallel_loop_dynamic_start",
"GOMP_parallel_loop_guided_start",
"GOMP_parallel_loop_runtime_start",
- "GOMP_parallel_sections_start",
+ "GOMP_parallel_sections_start",
};
unsigned i;
bfd_vma relocation;
bfd_boolean unresolved_reloc;
bfd_boolean warned;
+ enum { DEST_NORMAL, DEST_OPD, DEST_STUB } reloc_dest;
unsigned int insn;
unsigned int mask;
struct ppc_stub_hash_entry *stub_entry;
else
info->callbacks->einfo
(!IS_PPC64_TLS_RELOC (r_type)
- ? _("%P: %H: %s used with TLS symbol %s\n")
- : _("%P: %H: %s used with non-TLS symbol %s\n"),
+ ? _("%P: %H: %s used with TLS symbol `%T'\n")
+ : _("%P: %H: %s used with non-TLS symbol `%T'\n"),
input_bfd, input_section, rel->r_offset,
ppc64_elf_howto_table[r_type]->name,
sym_name);
insn = 0;
max_br_offset = 1 << 25;
addend = rel->r_addend;
+ reloc_dest = DEST_NORMAL;
switch (r_type)
{
default:
}
else
{
- if (strcmp (input_section->output_section->name,
- ".init") == 0
- || strcmp (input_section->output_section->name,
- ".fini") == 0)
- info->callbacks->einfo
- (_("%P: %H: automatic multiple TOCs "
- "not supported using your crt files; "
- "recompile with -mminimal-toc or upgrade gcc\n"),
- input_bfd, input_section, rel->r_offset);
- else
- info->callbacks->einfo
- (_("%P: %H: sibling call optimization to `%s' "
- "does not allow automatic multiple TOCs; "
- "recompile with -mminimal-toc or "
- "-fno-optimize-sibling-calls, "
- "or make `%s' extern\n"),
- input_bfd, input_section, rel->r_offset,
- sym_name,
- sym_name);
+ info->callbacks->einfo
+ (_("%P: %H: call to `%T' lacks nop, can't restore toc; "
+ "recompile with -fPIC"),
+ input_bfd, input_section, rel->r_offset, sym_name);
+
bfd_set_error (bfd_error_bad_value);
ret = FALSE;
}
{
relocation = dest;
addend = 0;
+ reloc_dest = DEST_OPD;
}
}
+ stub_entry->stub_sec->output_offset
+ stub_entry->stub_sec->output_section->vma);
addend = 0;
+ reloc_dest = DEST_STUB;
if ((stub_entry->stub_type == ppc_stub_plt_call
|| stub_entry->stub_type == ppc_stub_plt_call_r2save)
{
default:
info->callbacks->einfo
- (_("%P: %B: unknown relocation type %d for symbol %s\n"),
+ (_("%P: %B: unknown relocation type %d for `%T'\n"),
input_bfd, (int) r_type, sym_name);
bfd_set_error (bfd_error_bad_value);
: ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
{
info->callbacks->einfo
- (_("%P: %H: relocation %s for indirect "
- "function %s unsupported\n"),
+ (_("%P: %H: %s for indirect "
+ "function `%T' unsupported\n"),
input_bfd, input_section, rel->r_offset,
ppc64_elf_howto_table[r_type]->name,
sym_name);
/* These ones haven't been implemented yet. */
info->callbacks->einfo
- (_("%P: %B: relocation %s is not supported for symbol %s\n"),
+ (_("%P: %B: %s is not supported for `%T'\n"),
input_bfd,
ppc64_elf_howto_table[r_type]->name, sym_name);
rel->r_offset) != (bfd_vma) -1)
{
info->callbacks->einfo
- (_("%P: %H: unresolvable %s relocation against symbol `%s'\n"),
+ (_("%P: %H: unresolvable %s against `%T'\n"),
input_bfd, input_section, rel->r_offset,
ppc64_elf_howto_table[(int) r_type]->name,
h->elf.root.root.string);
if (r != bfd_reloc_ok)
{
- if (sym_name == NULL)
- sym_name = "(null)";
+ char *more_info = NULL;
+ const char *reloc_name = ppc64_elf_howto_table[r_type]->name;
+
+ if (reloc_dest != DEST_NORMAL)
+ {
+ more_info = bfd_malloc (strlen (reloc_name) + 8);
+ if (more_info != NULL)
+ {
+ strcpy (more_info, reloc_name);
+ strcat (more_info, (reloc_dest == DEST_OPD
+ ? " (OPD)" : " (stub)"));
+ reloc_name = more_info;
+ }
+ }
+
if (r == bfd_reloc_overflow)
{
if (warned)
}
if (!((*info->callbacks->reloc_overflow)
- (info, (h ? &h->elf.root : NULL), sym_name,
- ppc64_elf_howto_table[r_type]->name,
- orig_rel.r_addend, input_bfd, input_section,
- rel->r_offset)))
+ (info, &h->elf.root, sym_name,
+ reloc_name, orig_rel.r_addend,
+ input_bfd, input_section, rel->r_offset)))
return FALSE;
}
else
{
info->callbacks->einfo
- (_("%P: %H: %s reloc against `%s': error %d\n"),
+ (_("%P: %H: %s against `%T': error %d\n"),
input_bfd, input_section, rel->r_offset,
- ppc64_elf_howto_table[r_type]->name,
- sym_name,
- (int) r);
+ reloc_name, sym_name, (int) r);
ret = FALSE;
}
+ if (more_info != NULL)
+ free (more_info);
}
}