Eliminate "int8_type", "int16_type", "int32_type", and their

variants from the BFD universe.  Leave the 64-bit types for now,
since they are in flux.

* aoutx.h, hp300hpux.c:  Eliminate needless (int32_type) casts.
* libaout.h (GET_SWORD):  Convert (int32_type) to (int).
* ieee.c:  Convert uint8e_type => unsigned char.
* oasys.c:  Extensive changes to eliminate obsolete types.
These depend on changes in ../include/oasys.h as well.
This commit is contained in:
John Gilmore 1993-06-18 10:26:55 +00:00
parent 7b490afcb4
commit 34dd8ba311
3 changed files with 153 additions and 111 deletions

View File

@ -1,3 +1,16 @@
Fri Jun 18 03:12:12 1993 John Gilmore (gnu@cygnus.com)
Eliminate "int8_type", "int16_type", "int32_type", and their
variants from the BFD universe. Leave the 64-bit types for now,
since they are in flux.
* aoutx.h, hp300hpux.c: Eliminate needless (int32_type) casts.
* libaout.h (GET_SWORD): Convert (int32_type) to (int).
* ieee.c: Convert uint8e_type => unsigned char.
* oasys.c: Extensive changes to eliminate obsolete types.
These depend on changes in ../include/oasys.h as well.
* hosts/*.h: Remove declarations of all these types.
Mon Jun 14 14:02:41 1993 Jim Kingdon (kingdon@cygnus.com)
* hosts/delta88.h: #if 0 out some declarations which conflict with

View File

@ -262,6 +262,7 @@ SYNOPSIS
struct internal_exec *execp);
*/
#ifndef NAME_swap_exec_header_in
void
DEFUN(NAME(aout,swap_exec_header_in),(abfd, raw_bytes, execp),
bfd *abfd AND
@ -285,6 +286,8 @@ DEFUN(NAME(aout,swap_exec_header_in),(abfd, raw_bytes, execp),
execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
}
#define NAME_swap_exec_header_in NAME(aout,swap_exec_header_in)
#endif
/*
FUNCTION
@ -1052,15 +1055,19 @@ DEFUN (translate_from_native_sym_flags, (sym_pointer, cache_ptr, abfd, statep),
{
case N_SETA:
into_section = &bfd_abs_section;
cache_ptr->type = N_ABS;
break;
case N_SETT:
into_section = (asection *) obj_textsec (abfd);
cache_ptr->type = N_TEXT;
break;
case N_SETD:
into_section = (asection *) obj_datasec (abfd);
cache_ptr->type = N_DATA;
break;
case N_SETB:
into_section = (asection *) obj_bsssec (abfd);
cache_ptr->type = N_BSS;
break;
default:
abort ();
@ -1091,8 +1098,11 @@ DEFUN (translate_from_native_sym_flags, (sym_pointer, cache_ptr, abfd, statep),
reloc->relent.address = section->_raw_size;
section->_raw_size += sizeof (int *);
reloc->relent.howto = howto_table_ext + CTOR_TABLE_RELOC_IDX;
cache_ptr->symbol.flags |= BSF_DEBUGGING | BSF_CONSTRUCTOR;
reloc->relent.howto
= (obj_reloc_entry_size(abfd) == RELOC_EXT_SIZE
? howto_table_ext : howto_table_std)
+ CTOR_TABLE_RELOC_IDX;
cache_ptr->symbol.flags |= BSF_CONSTRUCTOR;
}
break;
default:
@ -1275,7 +1285,18 @@ DEFUN(translate_to_native_sym_flags,(sym_pointer, cache_ptr, abfd),
sym_pointer->e_type[0] |= N_EXT;
}
if (cache_ptr->flags & BSF_DEBUGGING) {
sym_pointer->e_type [0]= ((aout_symbol_type *)cache_ptr)->type;
sym_pointer->e_type[0] = ((aout_symbol_type *)cache_ptr)->type;
}
if (cache_ptr->flags & BSF_CONSTRUCTOR) {
int type = ((aout_symbol_type *)cache_ptr)->type;
switch (type)
{
case N_ABS: type = N_SETA; break;
case N_TEXT: type = N_SETT; break;
case N_DATA: type = N_SETD; break;
case N_BSS: type = N_SETB; break;
}
sym_pointer->e_type[0] = type;
}
PUT_WORD(abfd, value, sym_pointer->e_value);
@ -2105,7 +2126,7 @@ DEFUN(NAME(aout,swap_std_reloc_in), (abfd, bytes, cache_ptr, symbols),
int r_baserel, r_jmptable, r_relative;
struct aoutdata *su = &(abfd->tdata.aout_data->a);
cache_ptr->address = (int32_type)(bfd_h_get_32 (abfd, bytes->r_address));
cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
/* now the fun stuff */
if (abfd->xvec->header_byteorder_big_p != false) {
@ -2354,6 +2375,31 @@ DEFUN(NAME(aout,get_lineno),(ignore_abfd, ignore_symbol),
return (alent *)NULL;
}
void
DEFUN(NAME(aout,get_symbol_info),(ignore_abfd, symbol, ret),
bfd *ignore_abfd AND
asymbol *symbol AND
symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
if (ret->type == '?')
{
int type_code = aout_symbol(symbol)->type & 0xff;
CONST char *stab_name = aout_stab_name(type_code);
static char buf[10];
if (stab_name == NULL)
{
sprintf(buf, "(%d)", type_code);
stab_name = buf;
}
ret->type = '-';
ret->stab_other = (unsigned)(aout_symbol(symbol)->other & 0xff);
ret->stab_desc = (unsigned)(aout_symbol(symbol)->desc & 0xffff);
ret->stab_name = stab_name;
}
}
void
DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how),
@ -2390,35 +2436,6 @@ DEFUN(NAME(aout,print_symbol),(ignore_abfd, afile, symbol, how),
fprintf(file," %s", symbol->name);
}
break;
case bfd_print_symbol_nm:
{
int section_code = bfd_decode_symclass (symbol);
if (section_code == 'U')
fprintf(file, " ");
else
fprintf_vma(file, symbol->value+symbol->section->vma);
if (section_code == '?')
{
int type_code = aout_symbol(symbol)->type & 0xff;
CONST char *stab_name = aout_stab_name(type_code);
char buf[10];
if (stab_name == NULL)
{
sprintf(buf, "(%d)", type_code);
stab_name = buf;
}
fprintf(file," - %02x %04x %5s",
(unsigned)(aout_symbol(symbol)->other & 0xff),
(unsigned)(aout_symbol(symbol)->desc & 0xffff),
stab_name);
}
else
fprintf(file," %c", section_code);
if (symbol->name)
fprintf(file," %s", symbol->name);
}
break;
}
}

View File

@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
hpux native ------------> | |
| hp300hpux bfd | ----------> hpux w/gnu ext
hpux w/gnu extension ----> | |
@ -45,7 +45,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
indirect symbols but the reverse it not always possible.
Another example of differences is that the hp format stores symbol offsets
in the object code while the gnu utilities use a field in the
in the object code while the gnu utilities use a field in the
relocation record for this. To support the hp native format, the object
code would need to be patched with the offsets when producing .o files.
@ -58,34 +58,49 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <aoutx.h>
implement a bunch of functions
#include "aout-target.h"
}
The hp symbol table is a bit different than other a.out targets. Instead
of having an array of nlist items and an array of strings, hp's format
has them mixed together in one structure. In addition, the strings are
not null terminated. It looks something like this:
nlist element 1
string1
nlist element 2
string2
...
The whole symbol table is read as one chunk and then we march thru it
and convert it to canonical form. As we march thru the table, we copy
the nlist data into the internal form and we compact the strings and null
terminate them, using storage from the already allocated symbol table:
string1
null
string2
null
*/
/* @@ Is this really so different from normal a.out that it needs to include
aoutx.h? We should go through this file sometime and see what can be made
more dependent on aout32.o and what might need to be broken off and accessed
through the backend_data field. Or, maybe we really do need such a
completely separate implementation. I don't have time to investigate this
much further right now. [raeburn:19930428.2124EST] */
/* @@ Also, note that there wind up being two versions of some routines, with
different names, only one of which actually gets used. For example:
slurp_symbol_table
swap_std_reloc_in
slurp_reloc_table
get_symtab
get_symtab_upper_bound
canonicalize_reloc
mkobject
This should also be fixed. */
#define ARCH 32
#define TARGETNAME "a.out-hp300hpux"
#define MY(OP) CAT(hp300hpux_,OP)
@ -101,7 +116,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define e_desc e_almod
#define AR_PAD_CHAR '/'
#define TARGET_IS_BIG_ENDIAN_P
#define TARGET_IS_BIG_ENDIAN_P
#define DEFAULT_ARCH bfd_arch_m68k
#define MY_get_section_contents aout_32_get_section_contents
@ -116,15 +131,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define MY_canonicalize_reloc MY(canonicalize_reloc)
#define MY_write_object_contents MY(write_object_contents)
#if 0
#define MY_write_syms aout_32_write_syms
#endif
#define hp300hpux_write_syms aout_32_write_syms
#define MY_callback MY(callback)
#define NAME_swap_exec_header_in NAME(aout,swap_exec_header_in)
#define NAME_swap_exec_header_in NAME(hp300hpux_32_,swap_exec_header_in)
#define HP_SYMTYPE_UNDEFINED 0x00
#define HP_SYMTYPE_ABSOLUTE 0x01
@ -155,14 +166,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HP_RLENGTH_LONG 0x02
#define HP_RLENGTH_ALIGN 0x03
#define aout hp300hpux
#define NAME(x,y) CAT3(hp300hpux,_32_,y)
#include "aoutx.h"
/* since the hpux symbol table has nlist elements interspersed with strings */
/* and we need to insert som strings for secondary symbols, we give ourselves */
/* a little extra padding up front to account for this. Note that for each */
/* non-secondary symbol we process, we gain 9 bytes of space for the discarded*/
/* nlist element (one byte used for null). SYM_EXTRA_BYTES is the extra space*/
/* Since the hpux symbol table has nlist elements interspersed with
strings and we need to insert som strings for secondary symbols, we
give ourselves a little extra padding up front to account for
this. Note that for each non-secondary symbol we process, we gain
9 bytes of space for the discarded nlist element (one byte used for
null). SYM_EXTRA_BYTES is the extra space. */
#define SYM_EXTRA_BYTES 1024
/* Set parameters about this a.out file that are machine-dependent.
@ -192,7 +204,7 @@ DEFUN(MY(callback),(abfd),
/* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
obj_str_filepos (abfd) = N_STROFF (*execp);
/* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH
SET_ARCH_MACH(abfd, *execp);
@ -206,17 +218,17 @@ DEFUN(MY(callback),(abfd),
/* The file offsets of the relocation info */
obj_textsec (abfd)->rel_filepos = N_GNU_TRELOFF(*execp);
obj_datasec (abfd)->rel_filepos = N_GNU_DRELOFF(*execp);
/* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_GNU_SYMOFF(*execp);
obj_str_filepos (abfd) = (obj_sym_filepos (abfd) + execp->a_syms);
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
bfd_get_symcount (abfd) = execp->a_syms / 12;
obj_symbol_entry_size (abfd) = 12;
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
}
return abfd->xvec;
}
@ -226,55 +238,55 @@ DEFUN(MY(write_object_contents),(abfd),
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
bfd_size_type text_size; /* dummy vars */
bfd_size_type text_size; /* dummy vars */
file_ptr text_end;
memset (&exec_bytes, 0, sizeof (exec_bytes));
#if CHOOSE_RELOC_SIZE
CHOOSE_RELOC_SIZE(abfd);
#else
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
#endif
if (adata(abfd).magic == undecided_magic)
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
if (adata(abfd).magic == undecided_magic)
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
execp->a_syms = 0;
execp->a_entry = bfd_get_start_address (abfd);
execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *
obj_reloc_entry_size (abfd));
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
obj_reloc_entry_size (abfd));
N_SET_MACHTYPE(*execp, 0xc);
execp->a_entry = bfd_get_start_address (abfd);
execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *
obj_reloc_entry_size (abfd));
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
obj_reloc_entry_size (abfd));
N_SET_MACHTYPE(*execp, 0xc);
N_SET_FLAGS (*execp, 0x2);
NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);
NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);
/* update fields not covered by default swap_exec_header_out */
/* this is really the sym table size but we store it in drelocs */
bfd_h_put_32 (abfd, bfd_get_symcount (abfd) * 12, exec_bytes.e_drelocs);
bfd_seek (abfd, 0L, false);
bfd_seek (abfd, 0L, false);
bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd);
/* Now write out reloc info, followed by syms and strings */
if (bfd_get_symcount (abfd) != 0)
{
bfd_seek (abfd, (long)(N_TRELOFF(*execp)), false);
if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) return false;
bfd_seek (abfd, (long)(N_DRELOFF(*execp)), false);
if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) return false;
/* Now write out reloc info, followed by syms and strings */
if (bfd_get_symcount (abfd) != 0)
{
bfd_seek (abfd, (long)(N_TRELOFF(*execp)), false);
if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) return false;
bfd_seek (abfd, (long)(N_DRELOFF(*execp)), false);
if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) return false;
}
MY(write_syms)(abfd);
return true;
}
}
/* convert the hp symbol type to be the same as aout64.h usage so we */
/* can piggyback routines in aoutx.h. */
@ -290,7 +302,7 @@ DEFUN(convert_sym_type,(sym_pointer, cache_ptr, abfd),
name_type = (cache_ptr->type);
new_type = 0;
if ((name_type & HP_SYMTYPE_ALIGN) != 0)
{
/* iou_error ("aligned symbol encountered: %s", name);*/
@ -332,12 +344,12 @@ DEFUN(convert_sym_type,(sym_pointer, cache_ptr, abfd),
}
if (name_type & HP_SYMTYPE_EXTERNAL)
new_type |= N_EXT;
if (name_type & HP_SECONDARY_SYMBOL)
new_type = (new_type & ~N_TYPE) | N_INDR;
}
cache_ptr->type = new_type;
}
@ -384,7 +396,7 @@ DEFUN(NAME(aout,swap_exec_header_in),(abfd, raw_bytes, execp),
if (bfd_h_get_32 (abfd, bytes->e_passize) != 0) break;
if (bfd_h_get_32 (abfd, bytes->e_syms) != 0) break;
if (bfd_h_get_32 (abfd, bytes->e_supsize) != 0) break;
syms = bfd_h_get_32 (abfd, bytes->e_drelocs);
if (syms == 0) break;
@ -440,7 +452,7 @@ DEFUN(MY(slurp_symbol_table),(abfd),
unsigned num_syms = 0;
unsigned num_secondary = 0;
int xxx = 0; /* for translate_from_native_sym_flags */
/* If there's no work to be done, don't do any */
if (obj_aout_symbols (abfd) != (aout_symbol_type *)NULL) return true;
symbol_bytes = exec_hdr(abfd)->a_syms;
@ -458,12 +470,12 @@ DEFUN(MY(slurp_symbol_table),(abfd),
bfd_release (abfd, syms);
return false;
}
sym_end = (struct external_nlist *) (((char *)syms) + symbol_bytes);
/* first, march thru the table and figure out how many symbols there are */
for (sym_pointer = syms; sym_pointer < sym_end; sym_pointer++, num_syms++)
for (sym_pointer = syms; sym_pointer < sym_end; sym_pointer++, num_syms++)
{
if (bfd_get_8(abfd, sym_pointer->e_type) & HP_SECONDARY_SYMBOL)
num_secondary++;
@ -474,24 +486,24 @@ DEFUN(MY(slurp_symbol_table),(abfd),
/* now that we know the symbol count, update the bfd header */
bfd_get_symcount (abfd) = num_syms+num_secondary;
cached = (aout_symbol_type *)
bfd_zalloc(abfd, (bfd_size_type)(bfd_get_symcount (abfd) *
sizeof(aout_symbol_type)));
/* as we march thru the hp symbol table, convert it into a list of
null terminated strings to hold the symbol names. Make sure any
assignment to the strings pointer is done after we're thru using
the nlist so we don't overwrite anything important. */
num_secondary = 0;
/* OK, now walk the new symtable, cacheing symbol properties */
{
aout_symbol_type *cache_ptr = cached;
aout_symbol_type cache_save;
/* Run through table and copy values */
for (sym_pointer = syms, cache_ptr = cached;
sym_pointer < sym_end; sym_pointer++, cache_ptr++)
sym_pointer < sym_end; sym_pointer++, cache_ptr++)
{
unsigned int length;
cache_ptr->symbol.the_bfd = abfd;
@ -501,7 +513,7 @@ DEFUN(MY(slurp_symbol_table),(abfd),
cache_ptr->symbol.udata = 0;
length = bfd_get_8(abfd, sym_pointer->e_length);
cache_ptr->other = length; /* other not used, save length here */
cache_save = *cache_ptr;
convert_sym_type(sym_pointer, cache_ptr, abfd);
translate_from_native_sym_flags (sym_pointer, cache_ptr, abfd,
@ -525,7 +537,7 @@ DEFUN(MY(slurp_symbol_table),(abfd),
}
else
cache_ptr->symbol.name = (char *)NULL;
/**********************************************************/
/* this is a bit of a kludge, but a secondary hp symbol */
/* gets translated into a gnu indirect symbol. When this */
@ -561,7 +573,7 @@ DEFUN(MY(slurp_symbol_table),(abfd),
}
obj_aout_symbols (abfd) = cached;
return true;
}
@ -581,9 +593,9 @@ DEFUN(MY(swap_std_reloc_in), (abfd, bytes, cache_ptr, symbols),
int r_baserel = 0, r_jmptable = 0, r_relative = 0;
struct aoutdata *su = &(abfd->tdata.aout_data->a);
cache_ptr->address = (int32_type)(bfd_h_get_32 (abfd, bytes->r_address));
cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
r_index = bfd_h_get_16(abfd, bytes->r_index);
switch (bytes->r_type[0])
{
case HP_RSEGMENT_TEXT:
@ -612,7 +624,7 @@ DEFUN(MY(swap_std_reloc_in), (abfd, bytes, cache_ptr, symbols),
printf
("illegal relocation segment type: %x\n", (bytes->r_type[0]));
}
switch (bytes->r_length[0])
{
case HP_RLENGTH_BYTE:
@ -659,7 +671,7 @@ DEFUN(MY(slurp_reloc_table),(abfd, asect, symbols),
struct hp300hpux_reloc *rptr;
unsigned int counter;
arelent *cache_ptr;
if (asect->relocation) return true;
if (asect->flags & SEC_CONSTRUCTOR) return true;
@ -744,7 +756,7 @@ DEFUN(MY(get_symtab),(abfd, location),
if (obj_aout_subformat(abfd) == gnu_encap_format)
return aout_32_get_symtab(abfd,location);
if (!MY(slurp_symbol_table)(abfd)) return 0;
for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);)
@ -777,7 +789,7 @@ DEFUN(MY(canonicalize_reloc),(abfd, section, relptr, symbols),
arelent *tblptr = section->relocation;
unsigned int count;
if (obj_aout_subformat(abfd) == gnu_encap_format)
return aout_32_canonicalize_reloc(abfd,section,relptr,symbols);
return aout_32_canonicalize_reloc(abfd,section,relptr,symbols);
if (!(tblptr || MY(slurp_reloc_table)(abfd, section, symbols)))
return 0;
@ -793,7 +805,7 @@ DEFUN(MY(canonicalize_reloc),(abfd, section, relptr, symbols),
tblptr = section->relocation;
if (!tblptr) return 0;
for (count = 0; count++ < section->reloc_count;)
for (count = 0; count++ < section->reloc_count;)
{
*relptr++ = tblptr++;
}