* coff64-rs6000.c: Fix formatting.
* coffgen.c: Likewise.
* cofflink.c: Likewise.
2000-11-27 Kazu Hirata <kazu@hxi.com>
* aout-adobe.c: Fix formatting.
+ * coff64-rs6000.c: Likewise.
+ * coffgen.c: Likewise.
+ * cofflink.c: Likewise.
2000-11-27 Philip Blundell <pb@futuretv.com>
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Internalcoff.h and coffcode.h modify themselves based on these flags. */
-#define XCOFF64
+#define XCOFF64
#define RS6000COFF_C 1
#include "bfd.h"
#include "coff/rs6k64.h"
#include "libcoff.h"
-
#define GET_FILEHDR_SYMPTR bfd_h_get_64
#define PUT_FILEHDR_SYMPTR bfd_h_put_64
#define GET_AOUTHDR_DATA_START bfd_h_get_64
#define COFF_FORCE_SYMBOLS_IN_STRINGS
#define COFF_DEBUG_STRING_WIDE_PREFIX
-
#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \
do { \
memset (((SCNHDR *)EXT)->s_pad, 0, sizeof (((SCNHDR *)EXT)->s_pad));\
#define GETHALF bfd_h_get_16
#define GETBYTE bfd_h_get_8
-
-/* For XCOFF64, the effective width of symndx changes depending on
+/* For XCOFF64, the effective width of symndx changes depending on
whether we are the first entry. Sigh. */
static void
xcoff64_swap_lineno_in (abfd, ext1, in1)
in->l_lnno = bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno));
if (in->l_lnno == 0)
- in->l_addr.l_symndx =
+ in->l_addr.l_symndx =
bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx);
else
- in->l_addr.l_symndx =
+ in->l_addr.l_symndx =
bfd_h_get_64(abfd, (bfd_byte *) ext->l_addr.l_symndx);
}
return bfd_coff_linesz (abfd);
}
-
static void xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR));
static unsigned int xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR));
static void xcoff64_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
SYMENT *ext = (SYMENT *)ext1;
struct internal_syment *in = (struct internal_syment *)in1;
-
in->_n._n_n._n_zeroes = 0;
in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e_offset);
- in->n_value = bfd_h_get_64(abfd, (bfd_byte *) ext->e.e_value);
+ in->n_value = bfd_h_get_64(abfd, (bfd_byte *) ext->e.e_value);
in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
case C_FILE:
if (ext->x_file.x_fname[0] == 0) {
in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset =
+ in->x_file.x_n.x_offset =
bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
} else {
if (numaux > 1)
case C_HIDEXT:
if (indx + 1 == numaux)
{
- in->x_csect.x_scnlen.l =
+ in->x_csect.x_scnlen.l =
bfd_h_get_32(abfd, ext->x_csect.x_scnlen_lo);
- /* FIXME: If we want section lengths larger than 32 bits, we need
+ /* FIXME: If we want section lengths larger than 32 bits, we need
to modify the internal coff structures to support it. */
in->x_csect.x_parmhash = bfd_h_get_32 (abfd,
ext->x_csect.x_parmhash);
end: ;
/* the semicolon is because MSVC doesn't like labels at
- end of block. */
+ end of block. */
}
-
-
static unsigned int
xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
bfd *abfd;
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
- bfd_h_put_64(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
+ bfd_h_put_64(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
PUTBYTE (abfd, _AUX_FCN, (bfd_byte *) ext->x_auxtype.x_auxtype);
- PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
+ PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
if (ISFCN (type))
(bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_fsize);
else
{
- bfd_h_put_32(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
+ bfd_h_put_32(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
(bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_lnno);
- bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
+ bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
(bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_size);
}
return bfd_coff_auxesz (abfd);
}
-
#define coff_SWAP_sym_in xcoff64_swap_sym_in
#define coff_SWAP_sym_out xcoff64_swap_sym_out
#define coff_SWAP_aux_in xcoff64_swap_aux_in
static boolean make_a_section_from_file
PARAMS ((bfd *, struct internal_scnhdr *, unsigned int));
static const bfd_target *coff_real_object_p
- PARAMS ((bfd *, unsigned, struct internal_filehdr *,
+ PARAMS ((bfd *, unsigned, struct internal_filehdr *,
struct internal_aouthdr *));
static void fixup_symbol_value
PARAMS ((bfd *, coff_symbol_type *, struct internal_syment *));
goto fail;
/* Set the arch/mach *before* swapping in sections; section header swapping
- may depend on arch/mach info. */
+ may depend on arch/mach info. */
if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
goto fail;
return (bfd_get_symcount (abfd) + 1) * (sizeof (coff_symbol_type *));
}
-
/* Canonicalize a COFF symbol table. */
long
for (symbol_index = 0; symbol_index < symbol_count; symbol_index++)
{
coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]);
- symbol_ptr_ptr[symbol_index]->udata.i = symbol_index;
+ symbol_ptr_ptr[symbol_index]->udata.i = symbol_index;
if (coff_symbol_ptr && coff_symbol_ptr->native)
{
combined_entry_type *s = coff_symbol_ptr->native;
if (bfd_coff_force_symnames_in_strings (abfd))
{
- native->u.syment._n._n_n._n_offset =
+ native->u.syment._n._n_n._n_offset =
(*string_size_p + STRING_SIZE_SIZE);
native->u.syment._n._n_n._n_zeroes = 0;
*string_size_p += 6; /* strlen(".file") + 1 */
abort ();
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
abort ();
- native->u.syment._n._n_n._n_offset =
+ native->u.syment._n._n_n._n_offset =
*debug_string_size_p + prefix_len;
native->u.syment._n._n_n._n_zeroes = 0;
*debug_string_size_p += name_length + 1 + prefix_len;
while (lineno[count].line_number != 0)
{
#if 0
- /* 13 april 92. sac
+ /* 13 april 92. sac
I've been told this, but still need proof:
> The second bug is also in `bfd/coffcode.h'. This bug
> causes the linker to screw up the pc-relocations for
else if (c_symbol->native->u.syment.n_sclass == C_FILE
&& c_symbol->native->u.syment.n_numaux > 0)
{
- if (bfd_coff_force_symnames_in_strings (abfd))
+ if (bfd_coff_force_symnames_in_strings (abfd))
bfd_write (".file", 1, 6, abfd);
maxlen = bfd_coff_filnmlen (abfd);
}
/* Allocate space for the ".debug" section, and read it.
We did not read the debug section until now, because
- we didn't want to go to the trouble until someone needed it. */
+ we didn't want to go to the trouble until someone needed it. */
static char *
build_debug_section (abfd)
if (debug_section == NULL)
return NULL;
- /* Seek to the beginning of the `.debug' section and read it.
+ /* Seek to the beginning of the `.debug' section and read it.
Save the current position first; it is needed by our caller.
Then read debug section and reset the file pointer. */
return debug_section;
}
-
/* Return a pointer to a malloc'd copy of 'name'. 'name' may not be
\0-terminated, but will not exceed 'maxlen' characters. The copy *will*
be \0-terminated. */
+ obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd)),
SEEK_SET) != 0)
return NULL;
-
+
if (bfd_read (extstrsize, sizeof extstrsize, 1, abfd) != sizeof extstrsize)
{
if (bfd_get_error () != bfd_error_file_truncated)
{
break;
} /* if end of string */
- } /* possible lengths of this string. */
+ } /* possible lengths of this string. */
if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL)
return (NULL);
We cheat here by creating a fake native entry for it and
then filling in the class. This code is based on that in
coff_write_alien_symbol(). */
-
+
combined_entry_type * native;
native = (combined_entry_type *) bfd_alloc (abfd, sizeof (* native));
return false;
memset (native, 0, sizeof (* native));
-
+
native->u.syment.n_type = T_NULL;
native->u.syment.n_sclass = class;
-
+
if (bfd_is_und_section (symbol->section))
{
native->u.syment.n_scnum = N_UNDEF;
+ symbol->section->output_offset);
if (! obj_pe (abfd))
native->u.syment.n_value += symbol->section->output_section->vma;
-
+
/* Copy the any flags from the the file header into the symbol.
FIXME: Why? */
native->u.syment.n_flags = bfd_asymbol_bfd (& csym->symbol)->flags;
}
-
+
csym->native = native;
}
else
{
csym->native->u.syment.n_sclass = class;
}
-
+
return true;
}
if (! bfd_coff_final_link_postscript (abfd, & finfo))
goto error_return;
-
+
/* Free up the buffers used by _bfd_coff_link_input_bfd. */
coff_debug_merge_hash_table_free (&finfo.debug_merge);
/* If doing task linking (ld --task-link) then make a pass through the
global symbols, writing out any that are defined, and making them
- static. */
+ static. */
if (info->task_link)
{
finfo.failed = false;
bfd *output_bfd;
int heap;
{
- if (coff_data(output_bfd)->pe)
+ if (coff_data(output_bfd)->pe)
{
int val = strtoul (ptr, &ptr, 0);
if (heap)
else
pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve =val;
- if (ptr[0] == ',')
+ if (ptr[0] == ',')
{
int val = strtoul (ptr+1, &ptr, 0);
if (heap)
}
/* Process any magic embedded commands in a section called .drectve */
-
+
static int
process_embedded_commands (output_bfd, info, abfd)
bfd *output_bfd;
char *s;
char *e;
char *copy;
- if (!sec)
+ if (!sec)
return 1;
-
+
copy = bfd_malloc ((size_t) sec->_raw_size);
- if (!copy)
+ if (!copy)
return 0;
- if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size))
+ if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size))
{
free (copy);
return 0;
}
e = copy + sec->_raw_size;
- for (s = copy; s < e ; )
+ for (s = copy; s < e ; )
{
if (s[0]!= '-') {
s++;
s = get_name(s, &name);
s = get_name(s, &attribs);
while (loop) {
- switch (*attribs++)
+ switch (*attribs++)
{
case 'W':
had_write = 1;
{
s = dores_com (s+6, output_bfd, 0);
}
- else
+ else
s++;
}
free (copy);
/* Place a marker against all symbols which are used by relocations.
This marker can be picked up by the 'do we skip this symbol ?'
loop in _bfd_coff_link_input_bfd() and used to prevent skipping
- that symbol.
+ that symbol.
*/
static void
if ((bfd_get_file_flags (input_bfd) & HAS_SYMS) == 0)
return;
-
+
for (a = input_bfd->sections; a != (asection *) NULL; a = a->next)
{
struct internal_reloc * internal_relocs;
struct internal_reloc * irel;
struct internal_reloc * irelend;
-
if ((a->flags & SEC_RELOC) == 0 || a->reloc_count < 1)
continue;
? (finfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count)
: finfo->internal_relocs)
);
-
+
if (internal_relocs == NULL)
continue;
been initialised to 0) for all of the symbols that are used
in the relocation table. This will then be picked up in the
skip/don't pass */
-
+
for (; irel < irelend; irel++)
{
finfo->sym_indices[ irel->r_symndx ] = -1;
&& finfo->info->relocateable)
{
/* mark the symbol array as 'not-used' */
- memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
-
+ memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
+
mark_relocs (finfo, input_bfd);
}
dont_skip_symbol = *indexp;
else
dont_skip_symbol = false;
-
+
*indexp = -1;
skip = false;
/* This reloc is against a symbol we are
stripping. This should have been handled
by the 'dont_skip_symbol' code in the while
- loop at the top of this function. */
-
+ loop at the top of this function. */
+
is = finfo->internal_syms + irel->r_symndx;
name = (_bfd_coff_internal_syment_name
if (secdata == NULL || secdata->stab_info == NULL)
{
if (! bfd_set_section_contents (output_bfd, o->output_section,
- contents,
- (file_ptr)
- (o->output_offset *
+ contents,
+ (file_ptr)
+ (o->output_offset *
bfd_octets_per_byte (output_bfd)),
(o->_cooked_size != 0
? o->_cooked_size
isym.n_sclass = C_EXT;
isym.n_numaux = h->numaux;
-
+
bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) finfo->outsyms);
symesz = bfd_coff_symesz (output_bfd);
/* Write out task global symbols, converting them to statics. Called
via coff_link_hash_traverse. Calls bfd_coff_write_global_sym to do
- the dirty work, if the symbol we are processing needs conversion. */
+ the dirty work, if the symbol we are processing needs conversion. */
boolean
_bfd_coff_write_task_globals (h, data)
break;
}
ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
- (file_ptr)
+ (file_ptr)
(link_order->offset *
bfd_octets_per_byte (output_bfd)), size);
free (buf);
return false;
}
else
- {
+ {
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
else
addend = 0;
-
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
if (info->base_file)
{
- /* Emit a reloc if the backend thinks it needs it. */
+ /* Emit a reloc if the backend thinks it needs it. */
if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
{
/* Relocation to a symbol in a section which isn't
reloc section. Note that the base file is not
portable between systems. We write out a long here,
and dlltool reads in a long. */
- long addr = (rel->r_vaddr
- - input_section->vma
- + input_section->output_offset
+ long addr = (rel->r_vaddr
+ - input_section->vma
+ + input_section->output_offset
+ input_section->output_section->vma);
if (coff_data (output_bfd)->pe)
addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
}
}
}
-
+
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents,
rel->r_vaddr - input_section->vma,