2000-11-27 Kazu Hirata <kazu@hxi.com>

* coff64-rs6000.c: Fix formatting.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
This commit is contained in:
Kazu Hirata 2000-11-28 01:33:15 +00:00
parent 336eced2fe
commit 244148ad5c
4 changed files with 66 additions and 75 deletions

View file

@ -1,6 +1,9 @@
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>

View file

@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software
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"
@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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
@ -70,7 +69,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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));\
@ -88,8 +86,7 @@ do { \
#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)
@ -102,10 +99,10 @@ 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);
}
@ -129,7 +126,6 @@ xcoff64_swap_lineno_out (abfd, inp, outp)
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));
@ -144,10 +140,9 @@ xcoff64_swap_sym_in (abfd, ext1, in1)
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);
@ -189,7 +184,7 @@ xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
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)
@ -210,9 +205,9 @@ xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
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);
@ -260,12 +255,10 @@ xcoff64_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
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;
@ -326,10 +319,10 @@ xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
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))
@ -337,9 +330,9 @@ xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
(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);
}
@ -347,7 +340,6 @@ end:
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

View file

@ -60,7 +60,7 @@ static void coff_pointerize_aux
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 *));
@ -212,7 +212,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
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;
@ -340,7 +340,6 @@ coff_get_symtab_upper_bound (abfd)
return (bfd_get_symcount (abfd) + 1) * (sizeof (coff_symbol_type *));
}
/* Canonicalize a COFF symbol table. */
long
@ -692,7 +691,7 @@ coff_renumber_symbols (bfd_ptr, first_undef)
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;
@ -821,7 +820,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
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 */
@ -900,7 +899,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
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;
@ -1103,7 +1102,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
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
@ -1271,7 +1270,7 @@ coff_write_symbols (abfd)
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);
}
@ -1487,7 +1486,7 @@ coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent)
/* 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)
@ -1509,7 +1508,7 @@ 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. */
@ -1523,7 +1522,6 @@ build_debug_section (abfd)
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. */
@ -1611,7 +1609,7 @@ _bfd_coff_read_string_table (abfd)
+ 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)
@ -1812,7 +1810,7 @@ coff_get_normalized_symtab (abfd)
{
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);
@ -2407,7 +2405,7 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
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));
@ -2415,10 +2413,10 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
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;
@ -2437,19 +2435,19 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
+ 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;
}

View file

@ -928,7 +928,7 @@ _bfd_coff_final_link (abfd, info)
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);
@ -989,7 +989,7 @@ _bfd_coff_final_link (abfd, info)
/* 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;
@ -1161,7 +1161,7 @@ dores_com (ptr, output_bfd, heap)
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)
@ -1169,7 +1169,7 @@ dores_com (ptr, output_bfd, 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)
@ -1195,7 +1195,7 @@ char **dst;
}
/* Process any magic embedded commands in a section called .drectve */
static int
process_embedded_commands (output_bfd, info, abfd)
bfd *output_bfd;
@ -1206,19 +1206,19 @@ process_embedded_commands (output_bfd, info, abfd)
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++;
@ -1239,7 +1239,7 @@ process_embedded_commands (output_bfd, info, abfd)
s = get_name(s, &name);
s = get_name(s, &attribs);
while (loop) {
switch (*attribs++)
switch (*attribs++)
{
case 'W':
had_write = 1;
@ -1273,7 +1273,7 @@ process_embedded_commands (output_bfd, info, abfd)
{
s = dores_com (s+6, output_bfd, 0);
}
else
else
s++;
}
free (copy);
@ -1283,7 +1283,7 @@ process_embedded_commands (output_bfd, info, abfd)
/* 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
@ -1295,14 +1295,13 @@ mark_relocs (finfo, input_bfd)
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;
@ -1315,7 +1314,7 @@ mark_relocs (finfo, input_bfd)
? (finfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count)
: finfo->internal_relocs)
);
if (internal_relocs == NULL)
continue;
@ -1326,7 +1325,7 @@ mark_relocs (finfo, input_bfd)
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;
@ -1409,8 +1408,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
&& 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);
}
@ -1457,7 +1456,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
dont_skip_symbol = *indexp;
else
dont_skip_symbol = false;
*indexp = -1;
skip = false;
@ -2405,8 +2404,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* 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
@ -2430,9 +2429,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
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
@ -2572,7 +2571,7 @@ _bfd_coff_write_global_sym (h, data)
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);
@ -2664,7 +2663,7 @@ _bfd_coff_write_global_sym (h, data)
/* 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)
@ -2750,7 +2749,7 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
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);
@ -2872,7 +2871,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
return false;
}
else
{
{
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
@ -2887,7 +2886,6 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
else
addend = 0;
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
@ -2953,7 +2951,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
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
@ -2962,9 +2960,9 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
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;
@ -2976,7 +2974,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
}
}
}
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents,
rel->r_vaddr - input_section->vma,