{
default:
/* xgettext:c-format */
- _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, (int) code);
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd,
+ (int) code);
bfd_set_error (bfd_error_bad_value);
return NULL;
&& strcasecmp (ppc64_elf_howto_raw[i].name, r_name) == 0)
return &ppc64_elf_howto_raw[i];
-
return NULL;
}
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
-
+
return TRUE;
}
/* Reference count until size_dynamic_sections, GOT offset thereafter. */
union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- struct got_entry *ent;
- } got;
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ struct got_entry *ent;
+ } got;
};
/* The same for PLT. */
bfd_vma addend;
union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } plt;
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } plt;
};
struct ppc64_elf_obj_tdata
sections means we potentially need one of these for each input bfd. */
struct got_entry tlsld_got;
- union {
+ union
+ {
/* A copy of relocs before they are modified for --emit-relocs. */
Elf_Internal_Rela *relocs;
/* Add extra PPC sections. */
-static const struct bfd_elf_special_section ppc64_elf_special_sections[]=
+static const struct bfd_elf_special_section ppc64_elf_special_sections[] =
{
{ STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, 0 },
{ STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
static int
compare_symbols (const void *ap, const void *bp)
{
- const asymbol *a = * (const asymbol **) ap;
- const asymbol *b = * (const asymbol **) bp;
+ const asymbol *a = *(const asymbol **) ap;
+ const asymbol *b = *(const asymbol **) bp;
/* Section symbols first. */
if ((a->flags & BSF_SECTION_SYM) && !(b->flags & BSF_SECTION_SYM))
}
/* then other code symbols. */
- if ((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
- == (SEC_CODE | SEC_ALLOC)
- && (b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
- != (SEC_CODE | SEC_ALLOC))
+ if (((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ == (SEC_CODE | SEC_ALLOC))
+ && ((b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ != (SEC_CODE | SEC_ALLOC)))
return -1;
- if ((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
- != (SEC_CODE | SEC_ALLOC)
- && (b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
- == (SEC_CODE | SEC_ALLOC))
+ if (((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ != (SEC_CODE | SEC_ALLOC))
+ && ((b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ == (SEC_CODE | SEC_ALLOC)))
return 1;
if (synthetic_relocatable)
opdsymend = i;
for (; i < symcount; ++i)
- if ((syms[i]->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL))
+ if (((syms[i]->section->flags
+ & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL)))
!= (SEC_CODE | SEC_ALLOC))
break;
symcount = i;
insn ^= B_DOT;
if ((insn & ~0x3fffffc) == 0)
{
- resolv_vma = glink_vma + off + (insn ^ 0x2000000) - 0x2000000;
+ resolv_vma
+ = glink_vma + off + (insn ^ 0x2000000) - 0x2000000;
break;
}
off += 4;
if (relplt != NULL)
{
slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
- if (! (*slurp_relocs) (abfd, relplt, dyn_syms, TRUE))
+ if (!(*slurp_relocs) (abfd, relplt, dyn_syms, TRUE))
goto free_contents_and_exit_err;
plt_count = relplt->size / sizeof (Elf64_External_Rela);
s->section = glink;
s->value = resolv_vma - glink->vma;
s->name = names;
- memcpy (names, "__glink_PLTresolve", sizeof ("__glink_PLTresolve"));
+ memcpy (names, "__glink_PLTresolve",
+ sizeof ("__glink_PLTresolve"));
names += sizeof ("__glink_PLTresolve");
s++;
count++;
. 1:
. mflr %r11
. mtlr %r12
- . lis %r12,xxx-1b@highest
- . ori %r12,xxx-1b@higher
- . sldi %r12,%r12,32
- . oris %r12,%r12,xxx-1b@hi
- . ori %r12,%r12,xxx-1b@l
- . add %r12,%r11,%r12
+ . addis %r12,%r11,dest-1b@ha
+ . addi %r12,%r12,dest-1b@l
. b dest
ppc_stub_plt_branch_notoc:
hierarchy of long branch and plt branch stubs for local call
linkage. */
-enum ppc_stub_type {
+enum ppc_stub_type
+{
ppc_stub_none,
ppc_stub_long_branch,
ppc_stub_long_branch_r2off,
unsigned int eh_base;
};
-struct ppc_stub_hash_entry {
-
+struct ppc_stub_hash_entry
+{
/* Base hash table entry structure. */
struct bfd_hash_entry root;
unsigned char other;
};
-struct ppc_branch_hash_entry {
-
+struct ppc_branch_hash_entry
+{
/* Base hash table entry structure. */
struct bfd_hash_entry root;
{
struct elf_link_hash_entry elf;
- union {
+ union
+ {
/* A pointer to the most recently used stub hash entry against this
symbol. */
struct ppc_stub_hash_entry *stub_cache;
return entry;
}
-struct tocsave_entry {
+struct tocsave_entry
+{
asection *sec;
bfd_vma offset;
};
htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr",
flags);
if (htab->sfpr == NULL
- || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2))
+ || !bfd_set_section_alignment (dynobj, htab->sfpr, 2))
return FALSE;
}
htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink",
flags);
if (htab->glink == NULL
- || ! bfd_set_section_alignment (dynobj, htab->glink, 3))
+ || !bfd_set_section_alignment (dynobj, htab->glink, 3))
return FALSE;
/* The part of .glink used by global entry stubs, separate so that
htab->global_entry = bfd_make_section_anyway_with_flags (dynobj, ".glink",
flags);
if (htab->global_entry == NULL
- || ! bfd_set_section_alignment (dynobj, htab->global_entry, 2))
+ || !bfd_set_section_alignment (dynobj, htab->global_entry, 2))
return FALSE;
if (!info->no_ld_generated_unwind_info)
flags = SEC_ALLOC | SEC_LINKER_CREATED;
htab->elf.iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags);
if (htab->elf.iplt == NULL
- || ! bfd_set_section_alignment (dynobj, htab->elf.iplt, 3))
+ || !bfd_set_section_alignment (dynobj, htab->elf.iplt, 3))
return FALSE;
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
htab->elf.irelplt
= bfd_make_section_anyway_with_flags (dynobj, ".rela.iplt", flags);
if (htab->elf.irelplt == NULL
- || ! bfd_set_section_alignment (dynobj, htab->elf.irelplt, 3))
+ || !bfd_set_section_alignment (dynobj, htab->elf.irelplt, 3))
return FALSE;
/* Create branch lookup table for plt_branch stubs. */
htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
flags);
if (htab->brlt == NULL
- || ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
+ || !bfd_set_section_alignment (dynobj, htab->brlt, 3))
return FALSE;
/* Local plt entries, put in .branch_lt but a separate section for
htab->pltlocal = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
flags);
if (htab->pltlocal == NULL
- || ! bfd_set_section_alignment (dynobj, htab->pltlocal, 3))
+ || !bfd_set_section_alignment (dynobj, htab->pltlocal, 3))
return FALSE;
if (!bfd_link_pic (info))
htab->relbrlt
= bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags);
if (htab->relbrlt == NULL
- || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
+ || !bfd_set_section_alignment (dynobj, htab->relbrlt, 3))
return FALSE;
htab->relpltlocal
= bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags);
if (htab->relpltlocal == NULL
- || ! bfd_set_section_alignment (dynobj, htab->relpltlocal, 3))
+ || !bfd_set_section_alignment (dynobj, htab->relpltlocal, 3))
return FALSE;
return TRUE;
relgot = bfd_make_section_anyway_with_flags (abfd, ".rela.got",
flags | SEC_READONLY);
if (!relgot
- || ! bfd_set_section_alignment (abfd, relgot, 3))
+ || !bfd_set_section_alignment (abfd, relgot, 3))
return FALSE;
ppc64_elf_tdata (abfd)->got = got;
&& (eh->elf.ref_regular
|| eh->elf.def_regular))
{
- if (! bfd_elf_link_record_dynamic_symbol (info, &fdh->elf))
+ if (!bfd_elf_link_record_dynamic_symbol (info, &fdh->elf))
return FALSE;
}
}
|| info->export_dynamic
|| (eh->elf.dynamic
&& d != NULL
- && (*d->match) (&d->head, NULL, eh->elf.root.root.string)))
+ && (*d->match) (&d->head, NULL,
+ eh->elf.root.root.string)))
&& (eh->elf.versioned >= versioned
|| !bfd_hide_sym_by_version (info->version_info,
eh->elf.root.root.string)))))
{
const char name[12];
unsigned char lo, hi;
- bfd_byte * (*write_ent) (bfd *, bfd_byte *, int);
- bfd_byte * (*write_tail) (bfd *, bfd_byte *, int);
+ bfd_byte *(*write_ent) (bfd *, bfd_byte *, int);
+ bfd_byte *(*write_tail) (bfd *, bfd_byte *, int);
};
/* Auto-generate _save*, _rest* functions in .sfpr.
writing = TRUE;
if (htab->sfpr->contents == NULL)
{
- htab->sfpr->contents = bfd_alloc (htab->elf.dynobj, SFPR_MAX);
+ htab->sfpr->contents
+ = bfd_alloc (htab->elf.dynobj, SFPR_MAX);
if (htab->sfpr->contents == NULL)
return FALSE;
}
htab->elf.hgot->root.linker_def = 1;
}
htab->elf.hgot->type = STT_OBJECT;
- htab->elf.hgot->other = ((htab->elf.hgot->other & ~ELF_ST_VISIBILITY (-1))
- | STV_HIDDEN);
+ htab->elf.hgot->other
+ = (htab->elf.hgot->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
}
if (htab->need_func_desc_adj)
if (readonly_dynrelocs (&eh->elf))
return TRUE;
eh = (struct ppc_link_hash_entry *) eh->elf.u.alias;
- } while (eh != NULL && &eh->elf != h);
+ }
+ while (eh != NULL && &eh->elf != h);
return FALSE;
}
if (p == NULL)
return FALSE;
- if (! bfd_get_section_contents (need_pad->owner, need_pad,
- p, 0, need_pad->size))
+ if (!bfd_get_section_contents (need_pad->owner, need_pad,
+ p, 0, need_pad->size))
return FALSE;
need_pad->contents = p;
if (elf_section_data (sec)->relocs != relstart)
free (relstart);
if (local_syms != NULL
- && symtab_hdr->contents != (unsigned char *) local_syms)
+ && symtab_hdr->contents != (bfd_byte *) local_syms)
free (local_syms);
return FALSE;
}
if (!bfd_elf_link_record_dynamic_symbol (info, opt_fd))
return NULL;
}
- htab->tls_get_addr_fd = (struct ppc_link_hash_entry *) opt_fd;
+ htab->tls_get_addr_fd
+ = (struct ppc_link_hash_entry *) opt_fd;
tga = &htab->tls_get_addr->elf;
if (opt != NULL && tga != NULL)
{
&& is_plt_seq_reloc (ELF64_R_TYPE (rel[1].r_info)))
{
if (pass != 0
- && ELF64_R_TYPE (rel[1].r_info) != R_PPC64_PLTSEQ)
+ && (ELF64_R_TYPE (rel[1].r_info)
+ != R_PPC64_PLTSEQ))
{
r_symndx = ELF64_R_SYM (rel[1].r_info);
if (!get_sym_h (&h, NULL, NULL, NULL, &locsyms,
- r_symndx, ibfd))
+ r_symndx, ibfd))
goto err_free_rel;
if (h != NULL)
{
case of R_PPC64_TLS, and after checking for
tls_get_addr for the TOC16 relocs. */
if (toc_ref == NULL)
- toc_ref = bfd_zmalloc (toc->output_section->rawsize / 8);
+ toc_ref
+ = bfd_zmalloc (toc->output_section->rawsize / 8);
if (toc_ref == NULL)
goto err_free_rel;
struct bfd_link_info *info = (struct bfd_link_info *) inf;
info->flags |= DF_TEXTREL;
- info->callbacks->minfo
- (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"),
- sec->owner, h->root.root.string, sec);
+ info->callbacks->minfo (_("%pB: dynamic relocation against `%pT'"
+ " in read-only section `%pA'\n"),
+ sec->owner, h->root.root.string, sec);
/* Not an error, just cut short the traversal. */
return FALSE;
if (strcmp (opd->name, ".opd") != 0
|| opd->reloc_count != 0)
{
- info->callbacks->einfo (_("%P: cannot find opd entry toc for `%pT'\n"),
- stub_entry->h->elf.root.root.string);
+ info->callbacks->einfo
+ (_("%P: cannot find opd entry toc for `%pT'\n"),
+ stub_entry->h->elf.root.root.string);
bfd_set_error (bfd_error_bad_value);
return (bfd_vma) -1;
}
&& ((total += tail->output_offset - prev->output_offset)
< (ppc64_elf_section_data (prev) != NULL
&& ppc64_elf_section_data (prev)->has_14bit_branch
- ? (group_size = stub_group_size >> 10) : group_size))
+ ? (group_size = stub_group_size >> 10)
+ : group_size))
&& htab->sec_info[prev->id].toc_off == curr_toc)
{
tail = prev;
+ plt->output_offset
+ ent->plt.offset);
if (r_type == R_PPC64_PLT16_HA
- || r_type ==R_PPC64_PLT16_HI
- || r_type ==R_PPC64_PLT16_LO
- || r_type ==R_PPC64_PLT16_LO_DS)
+ || r_type == R_PPC64_PLT16_HI
+ || r_type == R_PPC64_PLT16_LO
+ || r_type == R_PPC64_PLT16_LO_DS)
{
got = (elf_gp (output_bfd)
+ htab->sec_info[input_section->id].toc_off);
be computed at runtime, so there's no need to do
anything now. However, for the sake of prelink ensure
that the section contents are a known value. */
- if (! relocate)
+ if (!relocate)
{
unresolved_reloc = FALSE;
/* The value chosen here is quite arbitrary as ld.so
htab->elf.sgot->contents);
/* Set .got entry size. */
- elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 8;
+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize
+ = 8;
}
if (htab->elf.splt != NULL && htab->elf.splt->size != 0