/* The remaining words of global linkage code. */
-static unsigned long xcoff_glink_code[] =
-{
+static unsigned long xcoff_glink_code[] = {
0x90410014, /* stw r2,20(r1) */
0x800c0000, /* lwz r0,0(r12) */
0x804c0004, /* lwz r2,4(r12) */
/* The ldhdr structure. This appears at the start of the .loader
section. */
-struct internal_ldhdr
-{
+struct internal_ldhdr {
/* The version number: currently always 1. */
unsigned long l_version;
/* The number of symbol table entries. */
bfd_size_type l_stoff;
};
-struct external_ldhdr
-{
+struct external_ldhdr {
bfd_byte l_version[4];
bfd_byte l_nsyms[4];
bfd_byte l_nreloc[4];
/* The ldsym structure. This is used to represent a symbol in the
.loader section. */
-struct internal_ldsym
-{
- union
- {
- /* The symbol name if <= SYMNMLEN characters. */
- char _l_name[SYMNMLEN];
- struct
- {
- /* Zero if the symbol name is more than SYMNMLEN characters. */
- long _l_zeroes;
- /* The offset in the string table if the symbol name is more
- than SYMNMLEN characters. */
- long _l_offset;
- } _l_l;
- } _l;
+struct internal_ldsym {
+ union {
+ /* The symbol name if <= SYMNMLEN characters. */
+ char _l_name[SYMNMLEN];
+ struct {
+ /* Zero if the symbol name is more than SYMNMLEN characters. */
+ long _l_zeroes;
+ /* The offset in the string table if the symbol name is more
+ than SYMNMLEN characters. */
+ long _l_offset;
+ } _l_l;
+ } _l;
/* The symbol value. */
bfd_vma l_value;
/* The symbol section number. */
bfd_size_type l_parm;
};
-struct external_ldsym
-{
- union
- {
- bfd_byte _l_name[SYMNMLEN];
- struct
- {
- bfd_byte _l_zeroes[4];
- bfd_byte _l_offset[4];
- } _l_l;
- } _l;
+struct external_ldsym {
+ union {
+ bfd_byte _l_name[SYMNMLEN];
+ struct {
+ bfd_byte _l_zeroes[4];
+ bfd_byte _l_offset[4];
+ } _l_l;
+ } _l;
bfd_byte l_value[4];
bfd_byte l_scnum[2];
bfd_byte l_smtype[1];
/* The ldrel structure. This is used to represent a reloc in the
.loader section. */
-struct internal_ldrel
-{
+struct internal_ldrel {
/* The reloc address. */
bfd_vma l_vaddr;
/* The symbol table index in the .loader section symbol table. */
short l_rsecnm;
};
-struct external_ldrel
-{
+struct external_ldrel {
bfd_byte l_vaddr[4];
bfd_byte l_symndx[4];
bfd_byte l_rtype[2];
/* The list of import files. */
-struct xcoff_import_file
-{
+struct xcoff_import_file {
/* The next entry in the list. */
struct xcoff_import_file *next;
/* The path. */
/* An entry in the XCOFF linker hash table. */
-struct xcoff_link_hash_entry
-{
+struct xcoff_link_hash_entry {
struct bfd_link_hash_entry root;
/* Symbol index in output file. Set to -1 initially. Set to -2 if
section which holds it. */
asection *toc_section;
- union
- {
- /* If we have created a TOC entry (the XCOFF_SET_TOC flag is
- set), this is the offset in toc_section. */
- bfd_vma toc_offset;
- /* If the TOC entry comes from an input file, this is set to the
- symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */
- long toc_indx;
- } u;
+ union {
+ /* If we have created a TOC entry (the XCOFF_SET_TOC flag is set),
+ this is the offset in toc_section. */
+ bfd_vma toc_offset;
+ /* If the TOC entry comes from an input file, this is set to the
+ symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */
+ long toc_indx;
+ } u;
/* If this symbol is a function entry point which is called, this
field holds a pointer to the function descriptor. If this symbol
/* The XCOFF linker hash table. */
-struct xcoff_link_hash_table
-{
+struct xcoff_link_hash_table {
struct bfd_link_hash_table root;
/* The .debug string hash table. We need to compute this while
boolean gc;
/* A linked list of symbols for which we have size information. */
- struct xcoff_link_size_list
- {
- struct xcoff_link_size_list *next;
- struct xcoff_link_hash_entry *h;
- bfd_size_type size;
- } *size_list;
+ struct xcoff_link_size_list {
+ struct xcoff_link_size_list *next;
+ struct xcoff_link_hash_entry *h;
+ bfd_size_type size;
+ } *size_list;
/* Magic sections: _text, _etext, _data, _edata, _end, end. */
asection *special_sections[6];
/* Information we keep for each section in the output file during the
final link phase. */
-struct xcoff_link_section_info
-{
+struct xcoff_link_section_info {
/* The relocs to be output. */
struct internal_reloc *relocs;
/* For each reloc against a global symbol whose index was not known
index of the TOC symbol is not known when the reloc was handled,
an entry is added to this linked list. This is not an array,
like rel_hashes, because this case is quite uncommon. */
- struct xcoff_toc_rel_hash
- {
- struct xcoff_toc_rel_hash *next;
- struct xcoff_link_hash_entry *h;
- struct internal_reloc *rel;
- } *toc_rel_hashes;
+ struct xcoff_toc_rel_hash {
+ struct xcoff_toc_rel_hash *next;
+ struct xcoff_link_hash_entry *h;
+ struct internal_reloc *rel;
+ } *toc_rel_hashes;
};
/* Information that we pass around while doing the final link step. */
-struct xcoff_final_link_info
-{
+struct xcoff_final_link_info {
/* General link information. */
struct bfd_link_info *info;
/* Output BFD. */
/* The typical dynamic reloc. */
static reloc_howto_type xcoff_dynamic_reloc =
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ 0, /* special_function */
+ "R_POS", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
false); /* pcrel_offset */
/* Get the dynamic relocs. */
the csect storage mapping class, so that the linker can
accumulate similar csects together. */
{
- static const char *csect_name_by_class[] =
- {
- ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
- ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
- ".td"
- };
+ static const char *csect_name_by_class[] = {
+ ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
+ ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
+ ".td"
+ };
const char *csect_name;
asection *enclosing;
else
{
(*sym_hash)->root.u.c.p->alignment_power
- = csect->alignment_power;
+ = csect->alignment_power;
}
}
/* Reset SEC_RELOC and the reloc_count, since the reloc
information is now attached to the csects. */
- o->flags &=~ SEC_RELOC;
+ o->flags &= ~SEC_RELOC;
o->reloc_count = 0;
/* If we are not keeping memory, free the reloc information. */
h->flags |= XCOFF_REF_REGULAR | XCOFF_LDREL;
++xcoff_hash_table (info)->ldrel_count;
-
+
/* Mark the symbol to avoid garbage collection. */
if (! xcoff_mark_symbol (info, h))
return false;
/* This structure is used to pass information through
xcoff_link_hash_traverse. */
-struct xcoff_loader_info
-{
+struct xcoff_loader_info {
/* Set if a problem occurred. */
boolean failed;
/* Output BFD. */
finfo.section_info[o->target_index].rel_hashes =
((struct xcoff_link_hash_entry **)
bfd_malloc (o->reloc_count
- * sizeof (struct xcoff_link_hash_entry *)));
+ * sizeof (struct xcoff_link_hash_entry *)));
if (finfo.section_info[o->target_index].relocs == NULL
|| finfo.section_info[o->target_index].rel_hashes == NULL)
goto error_return;
script. */
tocend = ((*csectpp)->output_section->vma
+ (*csectpp)->output_section->_raw_size);
- for (inp = finfo->info->input_bfds;
- inp != NULL;
+ for (inp = finfo->info->input_bfds;
+ inp != NULL;
inp = inp->link_next)
{
asection *o;
-
+
for (o = inp->sections; o != NULL; o = o->next)
if (strcmp (o->name, ".tocbss") == 0)
{
if (new_toc_end > tocend)
tocend = new_toc_end;
}
-
+
}
-
+
if (tocval + 0x10000 < tocend)
{
(*_bfd_error_handler)
addend = 0;
}
else
- {
+ {
h = obj_xcoff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
addend = - sym->n_value;