Just before a merge with chrisbs stuff

This commit is contained in:
Steve Chamberlain 1991-04-14 02:23:48 +00:00
parent 0ef6f0192d
commit aa802a3246
3 changed files with 153 additions and 152 deletions

View File

@ -31,6 +31,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
void (*bfd_error_trap)(); void (*bfd_error_trap)();
/*SUPPRESS558*/ /*SUPPRESS558*/
/*SUPPRESS529*/ /*SUPPRESS529*/
@ -50,52 +51,54 @@ typedef void generic_symbol_type;
#include "a.out.sun4.h" #include "a.out.sun4.h"
#define CTOR_TABLE_RELOC_IDX 2 #define CTOR_TABLE_RELOC_IDX 2
static CONST reloc_howto_type howto_table_ext[] = static reloc_howto_type howto_table_ext[] =
{ {
/* type rs size bsz pcrel bitpos abs ovrf sf name partial inplace mask*/ /* type rs size bsz pcrel bitpos abs ovrf sf name partial inplace mask*/
{ (unsigned int) RELOC_8, 0, 0, 8, false, 0, true, true,0,"8", false, 0x000000ff}, { (unsigned int) RELOC_8, 0, 0, 8, false, 0, true, true,0,"8", false, 0,0x000000ff},
{ (unsigned int) RELOC_16, 0, 1, 16, false, 0, true, true,0,"16", false, 0x0000ffff}, { (unsigned int) RELOC_16, 0, 1, 16, false, 0, true, true,0,"16", false, 0,0x0000ffff},
{ (unsigned int) RELOC_32, 0, 2, 32, false, 0, true, true,0,"32", false, 0xffffffff}, { (unsigned int) RELOC_32, 0, 2, 32, false, 0, true, true,0,"32", false, 0,0xffffffff},
{ (unsigned int) RELOC_DISP8, 0, 0, 8, true, 0, false, true,0,"DISP8", false, 0x000000ff}, { (unsigned int) RELOC_DISP8, 0, 0, 8, true, 0, false, true,0,"DISP8", false, 0,0x000000ff},
{ (unsigned int) RELOC_DISP16, 0, 1, 16, true, 0, false, true,0,"DISP16", false, 0x0000ffff}, { (unsigned int) RELOC_DISP16, 0, 1, 16, true, 0, false, true,0,"DISP16", false, 0,0x0000ffff},
{ (unsigned int) RELOC_DISP32, 0, 2, 32, true, 0, false, true,0,"DISP32", false, 0xffffffff}, { (unsigned int) RELOC_DISP32, 0, 2, 32, true, 0, false, true,0,"DISP32", false, 0,0xffffffff},
{ (unsigned int) RELOC_WDISP30,2, 2, 30, true, 0, false, true,0,"WDISP30", false, 0x3fffffff}, { (unsigned int) RELOC_WDISP30,2, 2, 30, true, 0, false, true,0,"WDISP30", false, 0,0x3fffffff},
{ (unsigned int) RELOC_WDISP22,2, 2, 22, true, 0, false, true,0,"WDISP22", false, 0x003fffff}, { (unsigned int) RELOC_WDISP22,2, 2, 22, true, 0, false, true,0,"WDISP22", false, 0,0x003fffff},
{ (unsigned int) RELOC_HI22, 10, 2, 22, false, 0, false, true,0,"HI22", false, 0x003fffff}, { (unsigned int) RELOC_HI22, 10, 2, 22, false, 0, false, true,0,"HI22", false, 0,0x003fffff},
{ (unsigned int) RELOC_22, 0, 2, 22, false, 0, false, true,0,"22", false, 0x003fffff}, { (unsigned int) RELOC_22, 0, 2, 22, false, 0, false, true,0,"22", false, 0,0x003fffff},
{ (unsigned int) RELOC_13, 0, 2, 13, false, 0, false, true,0,"13", false, 0x00001fff}, { (unsigned int) RELOC_13, 0, 2, 13, false, 0, false, true,0,"13", false, 0,0x00001fff},
{ (unsigned int) RELOC_LO10, 0, 2, 10, false, 0, false, true,0,"LO10", false, 0x000003ff}, { (unsigned int) RELOC_LO10, 0, 2, 10, false, 0, false, true,0,"LO10", false, 0,0x000003ff},
{ (unsigned int) RELOC_SFA_BASE,0, 2, 32, false, 0, false, true,0,"SFA_BASE", false, 0xffffffff}, { (unsigned int) RELOC_SFA_BASE,0, 2, 32, false, 0, false, true,0,"SFA_BASE", false, 0,0xffffffff},
{ (unsigned int) RELOC_SFA_OFF13,0,2, 32, false, 0, false, true,0,"SFA_OFF13",false, 0xffffffff}, { (unsigned int) RELOC_SFA_OFF13,0,2, 32, false, 0, false, true,0,"SFA_OFF13",false, 0,0xffffffff},
{ (unsigned int) RELOC_BASE10, 0, 2, 16, false, 0, false, true,0,"BASE10", false, 0x0000ffff}, { (unsigned int) RELOC_BASE10, 0, 2, 16, false, 0, false, true,0,"BASE10", false, 0,0x0000ffff},
{ (unsigned int) RELOC_BASE13, 0, 2, 13, false, 0, false, true,0,"BASE13", false, 0x00001fff}, { (unsigned int) RELOC_BASE13, 0, 2, 13, false, 0, false, true,0,"BASE13", false, 0,0x00001fff},
{ (unsigned int) RELOC_BASE22, 0, 2, 0, false, 0, false, true,0,"BASE22", false, 0x00000000}, { (unsigned int) RELOC_BASE22, 0, 2, 0, false, 0, false, true,0,"BASE22", false, 0,0x00000000},
{ (unsigned int) RELOC_PC10, 0, 2, 10, false, 0, false, true,0,"PC10", false, 0x000003ff}, { (unsigned int) RELOC_PC10, 0, 2, 10, false, 0, false, true,0,"PC10", false, 0,0x000003ff},
{ (unsigned int) RELOC_PC22, 0, 2, 22, false, 0, false, true,0,"PC22", false, 0x003fffff}, { (unsigned int) RELOC_PC22, 0, 2, 22, false, 0, false, true,0,"PC22", false, 0,0x003fffff},
{ (unsigned int) RELOC_JMP_TBL,0, 2, 32, false, 0, false, true,0,"JMP_TBL", false, 0xffffffff}, { (unsigned int) RELOC_JMP_TBL,0, 2, 32, false, 0, false, true,0,"JMP_TBL", false, 0,0xffffffff},
{ (unsigned int) RELOC_SEGOFF16,0, 2, 0, false, 0, false, true,0,"SEGOFF16", false, 0x00000000}, { (unsigned int) RELOC_SEGOFF16,0, 2, 0, false, 0, false, true,0,"SEGOFF16", false, 0,0x00000000},
{ (unsigned int) RELOC_GLOB_DAT,0, 2, 0, false, 0, false, true,0,"GLOB_DAT", false, 0x00000000}, { (unsigned int) RELOC_GLOB_DAT,0, 2, 0, false, 0, false, true,0,"GLOB_DAT", false, 0,0x00000000},
{ (unsigned int) RELOC_JMP_SLOT,0, 2, 0, false, 0, false, true,0,"JMP_SLOT", false, 0x00000000}, { (unsigned int) RELOC_JMP_SLOT,0, 2, 0, false, 0, false, true,0,"JMP_SLOT", false, 0,0x00000000},
{ (unsigned int) RELOC_RELATIVE,0, 2, 0, false, 0, false, true,0,"RELATIVE", false, 0x00000000}, { (unsigned int) RELOC_RELATIVE,0, 2, 0, false, 0, false, true,0,"RELATIVE", false, 0,0x00000000},
{ (unsigned int) RELOC_JUMPTARG,2, 13, 16, true, 0, false, true,0,"JUMPTARG", false, 0x0000ffff}, { (unsigned int) RELOC_JUMPTARG,2, 13, 16, true, 0, false, true,0,"JUMPTARG", false, 0,0x0000ffff},
{ (unsigned int) RELOC_CONST, 0, 13, 16, false, 0, false, true,0,"CONST", false, 0x0000ffff}, { (unsigned int) RELOC_CONST, 0, 13, 16, false, 0, false, true,0,"CONST", false, 0,0x0000ffff},
{ (unsigned int) RELOC_CONSTH, 16, 13, 16, false, 0, false, true,0,"CONSTH", false, 0x0000ffff}, { (unsigned int) RELOC_CONSTH, 16, 13, 16, false, 0, false, true,0,"CONSTH", false, 0,0x0000ffff},
}; };
/* Convert standard reloc records to "arelent" format (incl byte swap). */ /* Convert standard reloc records to "arelent" format (incl byte swap). */
static CONST reloc_howto_type howto_table_std[] = { static reloc_howto_type howto_table_std[] = {
/* type rs size bsz pcrel bitpos abs ovrf sf name*/ /* type rs size bsz pcrel bitpos abs ovrf sf name*/
{ (unsigned int) 0, 0, 0, 8, false, 0, true, true,0,"8", true, 0x000000ff}, { (unsigned int) 0, 0, 0, 8, false, 0, true, true,0,"8", true, 0x000000ff,0x000000ff},
{ (unsigned int) 1, 0, 1, 16, false, 0, true, true,0,"16", true, 0x0000ffff}, { (unsigned int) 1, 0, 1, 16, false, 0, true, true,0,"16", true, 0x0000ffff,0x0000ffff},
{ (unsigned int) 2, 0, 2, 32, false, 0, true, true,0,"32", true, 0xffffffff}, { (unsigned int) 2, 0, 2, 32, false, 0, true, true,0,"32", true, 0xffffffff,0xffffffff},
{ (unsigned int) 3, 0, 3, 64, false, 0, true, true,0,"64", true, 0xdeaddead}, { (unsigned int) 3, 0, 3, 64, false, 0, true, true,0,"64", true, 0xdeaddead,0xdeaddead},
{ (unsigned int) 4, 0, 0, 8, true, 0, false, true,0,"DISP8", true, 0x000000ff}, { (unsigned int) 4, 0, 0, 8, true, 0, false, true,0,"DISP8", true, 0x000000ff,0x000000ff},
{ (unsigned int) 5, 0, 1, 16, true, 0, false, true,0,"DISP16", true, 0x0000ffff}, { (unsigned int) 5, 0, 1, 16, true, 0, false, true,0,"DISP16", true, 0x0000ffff,0x0000ffff},
{ (unsigned int) 6, 0, 2, 32, true, 0, false, true,0,"DISP32", true, 0xffffffff}, { (unsigned int) 6, 0, 2, 32, true, 0, false, true,0,"DISP32", true, 0xffffffff,0xffffffff},
{ (unsigned int) 7, 0, 3, 64, true, 0, false, true,0,"DISP64", true, 0xfeedface}, { (unsigned int) 7, 0, 3, 64, true, 0, false, true,0,"DISP64", true, 0xfeedface,0xfeedface},
}; };
bfd_error_vector_type bfd_error_vector;
/** a.out files */ /** a.out files */
@ -116,11 +119,11 @@ bfd *abfd;
} }
} }
void static void
bfd_aout_swap_exec_header_in (abfd, raw_bytes, execp) DEFUN(bfd_aout_swap_exec_header_in,(abfd, raw_bytes, execp),
bfd *abfd; bfd *abfd AND
unsigned char *raw_bytes; unsigned char *raw_bytes AND
struct exec *execp; struct exec *execp)
{ {
struct exec_bytes *bytes = (struct exec_bytes *)raw_bytes; struct exec_bytes *bytes = (struct exec_bytes *)raw_bytes;
@ -135,11 +138,11 @@ bfd_aout_swap_exec_header_in (abfd, raw_bytes, execp)
execp->a_drsize = bfd_h_getlong (abfd, bytes->a_drsize); execp->a_drsize = bfd_h_getlong (abfd, bytes->a_drsize);
} }
void static void
bfd_aout_swap_exec_header_out (abfd, execp, raw_bytes) DEFUN(bfd_aout_swap_exec_header_out,(abfd, execp, raw_bytes),
bfd *abfd; bfd *abfd AND
struct exec *execp; struct exec *execp AND
unsigned char *raw_bytes; unsigned char *raw_bytes)
{ {
struct exec_bytes *bytes = (struct exec_bytes *)raw_bytes; struct exec_bytes *bytes = (struct exec_bytes *)raw_bytes;
@ -183,6 +186,7 @@ static unsigned int n_stroff(ptr)
struct exec *ptr; struct exec *ptr;
{return n_symoff(ptr) + ptr->a_syms;} {return n_symoff(ptr) + ptr->a_syms;}
static
unsigned int n_badmag(ptr) unsigned int n_badmag(ptr)
struct exec *ptr; struct exec *ptr;
{ {
@ -422,7 +426,7 @@ boolean
sunos4_write_object_contents (abfd) sunos4_write_object_contents (abfd)
bfd *abfd; bfd *abfd;
{ {
unsigned int data_pad = 0; size_t data_pad = 0;
unsigned char exec_bytes[EXEC_BYTES_SIZE]; unsigned char exec_bytes[EXEC_BYTES_SIZE];
struct exec *execp = exec_hdr (abfd); struct exec *execp = exec_hdr (abfd);
@ -464,17 +468,17 @@ sunos4_write_object_contents (abfd)
N_SET_FLAGS (*execp, 0x1); /* copied from ld.c; who the hell knows? */ N_SET_FLAGS (*execp, 0x1); /* copied from ld.c; who the hell knows? */
if (abfd->flags & D_PAGED) if (abfd->flags & D_PAGED)
{ {
data_pad = ((obj_datasec(abfd)->size + PAGE_SIZE -1) data_pad = ((obj_datasec(abfd)->size + PAGE_SIZE -1)
& (- PAGE_SIZE)) - obj_datasec(abfd)->size; & (- PAGE_SIZE)) - obj_datasec(abfd)->size;
if (data_pad > obj_bsssec(abfd)->size) if (data_pad > obj_bsssec(abfd)->size)
execp->a_bss = 0; execp->a_bss = 0;
else else
execp->a_bss = obj_bsssec(abfd)->size - data_pad; execp->a_bss = obj_bsssec(abfd)->size - data_pad;
execp->a_data = obj_datasec(abfd)->size + data_pad; execp->a_data = obj_datasec(abfd)->size + data_pad;
} }
else { else {
execp->a_data = obj_datasec (abfd)->size; execp->a_data = obj_datasec (abfd)->size;
execp->a_bss = obj_bsssec (abfd)->size; execp->a_bss = obj_bsssec (abfd)->size;
@ -497,19 +501,19 @@ sunos4_write_object_contents (abfd)
/* Now write out reloc info, followed by syms and strings */ /* Now write out reloc info, followed by syms and strings */
if (bfd_get_symcount (abfd) != 0) if (bfd_get_symcount (abfd) != 0)
{ {
bfd_seek (abfd, bfd_seek (abfd,
(long)(N_SYMOFF(*execp)), false); (long)(N_SYMOFF(*execp)), false);
sunos4_write_syms (abfd); sunos4_write_syms (abfd);
bfd_seek (abfd, (long)(N_TROFF(*execp)), false); bfd_seek (abfd, (long)(N_TROFF(*execp)), false);
if (!sunos4_squirt_out_relocs (abfd, obj_textsec (abfd))) return false; if (!sunos4_squirt_out_relocs (abfd, obj_textsec (abfd))) return false;
bfd_seek (abfd, (long)(N_DROFF(*execp)), false); bfd_seek (abfd, (long)(N_DROFF(*execp)), false);
if (!sunos4_squirt_out_relocs (abfd, obj_datasec (abfd))) return false; if (!sunos4_squirt_out_relocs (abfd, obj_datasec (abfd))) return false;
} }
return true; return true;
} }
@ -1057,8 +1061,8 @@ translate_to_native_sym_flags (sym_pointer, cache_ptr_g, abfd)
sym_pointer->n_type |= N_TEXT; sym_pointer->n_type |= N_TEXT;
} }
else { else {
bfd_error_trap(bfd_error_nonrepresentable_section,
bfd_get_output_section(cache_ptr)->name); bfd_error_vector.nonrepresentable_section(abfd, bfd_get_output_section(cache_ptr)->name);
} }
/* Turn the symbol from section relative to absolute again */ /* Turn the symbol from section relative to absolute again */
@ -1106,8 +1110,8 @@ bfd *abfd;
} }
boolean boolean
sunos4_slurp_symbol_table (abfd) DEFUN(sunos4_slurp_symbol_table, (abfd),
bfd *abfd; bfd *abfd)
{ {
unsigned int symbol_count; unsigned int symbol_count;
size_t symbol_size; size_t symbol_size;
@ -1210,10 +1214,10 @@ sunos4_slurp_symbol_table (abfd)
return true; return true;
} }
void void
sunos4_write_syms (abfd) DEFUN(sunos4_write_syms,(abfd),
bfd *abfd; bfd *abfd)
{ {
unsigned int count ; unsigned int count ;
asymbol **generic = bfd_get_outsymbols (abfd); asymbol **generic = bfd_get_outsymbols (abfd);
@ -1280,10 +1284,10 @@ sunos4_write_syms (abfd)
} }
} }
void void
sunos4_reclaim_symbol_table (abfd) DEFUN(sunos4_reclaim_symbol_table,(abfd),
bfd *abfd; bfd *abfd)
{ {
asection *section; asection *section;
@ -1985,20 +1989,20 @@ sunos4_close_and_cleanup (abfd)
*/ */
boolean boolean
sunos4_find_nearest_line(abfd, DEFUN(sunos4_find_nearest_line,(abfd,
section, section,
symbols, symbols,
offset, offset,
filename_ptr, filename_ptr,
functionname_ptr, functionname_ptr,
line_ptr) line_ptr),
bfd *abfd; bfd *abfd AND
asection *section; asection *section AND
asymbol **symbols; asymbol **symbols AND
bfd_vma offset; bfd_vma offset AND
char **filename_ptr; char **filename_ptr AND
char **functionname_ptr; char **functionname_ptr AND
unsigned int *line_ptr; unsigned int *line_ptr)
{ {
/* Run down the file looking for the filename, function and linenumber */ /* Run down the file looking for the filename, function and linenumber */
asymbol **p; asymbol **p;

View File

@ -46,7 +46,7 @@ Most of this hacked by Steve Chamberlain, steve@cygnus.com
/* All the swapping routines */ /* All the swapping routines */
static void static void
swap_reloc(abfd, reloc) swap_reloc(abfd, reloc)
bfd *abfd; bfd *abfd;
RELOC *reloc; RELOC *reloc;
@ -57,7 +57,7 @@ swap_reloc(abfd, reloc)
} }
static void static void
swap_filehdr(abfd, filehdr) swap_filehdr(abfd, filehdr)
bfd *abfd; bfd *abfd;
FILHDR *filehdr; FILHDR *filehdr;
@ -73,7 +73,7 @@ swap_filehdr(abfd, filehdr)
} }
static void static void
swap_aouthdr(abfd, aouthdr) swap_aouthdr(abfd, aouthdr)
bfd *abfd; bfd *abfd;
AOUTHDR *aouthdr; AOUTHDR *aouthdr;
@ -92,7 +92,7 @@ swap_aouthdr(abfd, aouthdr)
#endif #endif
} }
static void static void
swap_scnhdr(abfd, scnhdr) swap_scnhdr(abfd, scnhdr)
bfd *abfd; bfd *abfd;
SCNHDR *scnhdr; SCNHDR *scnhdr;
@ -111,7 +111,7 @@ swap_scnhdr(abfd, scnhdr)
#endif #endif
} }
static void static void
swap_name(abfd, ptr) swap_name(abfd, ptr)
bfd *abfd; bfd *abfd;
long *ptr; long *ptr;
@ -125,7 +125,7 @@ swap_name(abfd, ptr)
} }
} }
static void static void
bfd_coff_swap_sym(abfd, se) bfd_coff_swap_sym(abfd, se)
bfd *abfd; bfd *abfd;
SYMENT *se; SYMENT *se;
@ -138,7 +138,7 @@ bfd_coff_swap_sym(abfd, se)
bfd_h_put_x(abfd, se->n_numaux, &se->n_numaux); bfd_h_put_x(abfd, se->n_numaux, &se->n_numaux);
} }
static void static void
bfd_coff_swap_aux(abfd, au, type, class) bfd_coff_swap_aux(abfd, au, type, class)
bfd *abfd; bfd *abfd;
AUXENT *au; AUXENT *au;
@ -184,7 +184,7 @@ bfd_coff_swap_aux(abfd, au, type, class)
} }
} }
static void static void
bfd_coff_swap_lineno(abfd, lineno) bfd_coff_swap_lineno(abfd, lineno)
bfd *abfd; bfd *abfd;
LINENO *lineno; LINENO *lineno;
@ -206,7 +206,7 @@ get_index(symbol)
return (int) symbol->value; return (int) symbol->value;
} }
static void static void
set_index(symbol, idx) set_index(symbol, idx)
asymbol *symbol; asymbol *symbol;
unsigned int idx; unsigned int idx;
@ -318,7 +318,7 @@ coff_real_object_p(abfd, nscns, opthdr)
} }
if (bfd_seek(abfd, 0L, SEEK_SET) < 0) if (bfd_seek(abfd, 0L, SEEK_SET) < 0)
return 0; return 0;
if (bfd_read((void *) file_info, 1, readsize, abfd) != readsize) if (bfd_read((PTR) file_info, 1, readsize, abfd) != readsize)
return 0; return 0;
filehdr = (struct filehdr *) file_info; filehdr = (struct filehdr *) file_info;
sections = (struct scnhdr *) (file_info + sizeof(struct filehdr) + opthdr); sections = (struct scnhdr *) (file_info + sizeof(struct filehdr) + opthdr);
@ -408,7 +408,7 @@ coff_real_object_p(abfd, nscns, opthdr)
if (!(filehdr->f_flags & F_LSYMS)) if (!(filehdr->f_flags & F_LSYMS))
abfd->flags |= HAS_LOCALS; abfd->flags |= HAS_LOCALS;
abfd->tdata = (void *) tdata; abfd->tdata = (PTR) tdata;
bfd_get_symcount(abfd) = filehdr->f_nsyms; bfd_get_symcount(abfd) = filehdr->f_nsyms;
if (filehdr->f_nsyms) if (filehdr->f_nsyms)
abfd->flags |= HAS_SYMS; abfd->flags |= HAS_SYMS;
@ -437,7 +437,7 @@ coff_symbol_from(abfd, symbol)
if (symbol->the_bfd->xvec->flavour != bfd_target_coff_flavour_enum) if (symbol->the_bfd->xvec->flavour != bfd_target_coff_flavour_enum)
return (coff_symbol_type *)NULL; return (coff_symbol_type *)NULL;
if (symbol->the_bfd->tdata == (void *)NULL) if (symbol->the_bfd->tdata == (PTR)NULL)
return (coff_symbol_type *)NULL; return (coff_symbol_type *)NULL;
return (coff_symbol_type *) symbol; return (coff_symbol_type *) symbol;
@ -455,7 +455,7 @@ coff_object_p(abfd)
bfd_error = system_call_error; bfd_error = system_call_error;
/* figure out how much to read */ /* figure out how much to read */
if (bfd_read((void *) &magic, 1, sizeof(magic), abfd) != sizeof(magic)) if (bfd_read((PTR) &magic, 1, sizeof(magic), abfd) != sizeof(magic))
return 0; return 0;
magic = bfd_h_getshort(abfd, (bfd_byte *) (&magic)); magic = bfd_h_getshort(abfd, (bfd_byte *) (&magic));
@ -464,13 +464,13 @@ coff_object_p(abfd)
bfd_error = wrong_format; bfd_error = wrong_format;
return 0; return 0;
} }
if (bfd_read((void *) &nscns, 1, sizeof(nscns), abfd) != sizeof(nscns)) if (bfd_read((PTR) &nscns, 1, sizeof(nscns), abfd) != sizeof(nscns))
return 0; return 0;
nscns = bfd_h_getshort(abfd, (unsigned char *) &nscns); nscns = bfd_h_getshort(abfd, (unsigned char *) &nscns);
if (bfd_seek(abfd, (file_ptr) & (((struct filehdr *) NULL)->f_opthdr), SEEK_SET) if (bfd_seek(abfd, (file_ptr) & (((struct filehdr *) NULL)->f_opthdr), SEEK_SET)
< 0) < 0)
return (bfd_target *) NULL; return (bfd_target *) NULL;
if (bfd_read((void *) &opthdr, 1, sizeof(opthdr), abfd) != sizeof(opthdr)) if (bfd_read((PTR) &opthdr, 1, sizeof(opthdr), abfd) != sizeof(opthdr))
return (bfd_target *) NULL; return (bfd_target *) NULL;
opthdr = bfd_h_getshort(abfd, (unsigned char *) &opthdr); opthdr = bfd_h_getshort(abfd, (unsigned char *) &opthdr);
@ -491,7 +491,7 @@ coff_mkobject(abfd)
bfd_error = no_memory; bfd_error = no_memory;
return false; return false;
} }
abfd->tdata = (void *) ((struct icofdata *) rawptr); abfd->tdata = (PTR) ((struct icofdata *) rawptr);
exec_hdr(abfd) = (AOUTHDR *) (rawptr + sizeof(struct icofdata)); exec_hdr(abfd) = (AOUTHDR *) (rawptr + sizeof(struct icofdata));
obj_relocbase(abfd) =0; obj_relocbase(abfd) =0;
return true; return true;
@ -499,7 +499,7 @@ coff_mkobject(abfd)
static void static void
coff_count_linenumbers(abfd) coff_count_linenumbers(abfd)
bfd *abfd; bfd *abfd;
{ {
@ -598,7 +598,7 @@ applied so we can dig it out through a pointer.
*/ */
static void static void
coff_mangle_symbols(bfd_ptr) coff_mangle_symbols(bfd_ptr)
bfd *bfd_ptr; bfd *bfd_ptr;
{ {
@ -774,7 +774,7 @@ bfd *bfd_ptr;
static void static void
coff_write_symbols(abfd) coff_write_symbols(abfd)
bfd *abfd; bfd *abfd;
{ {
@ -920,10 +920,10 @@ coff_write_symbols(abfd)
int type = native->n_type; int type = native->n_type;
int class = native->n_sclass; int class = native->n_sclass;
bfd_coff_swap_sym(abfd, native); bfd_coff_swap_sym(abfd, native);
bfd_write((void *) native, 1, SYMESZ, abfd); bfd_write((PTR) native, 1, SYMESZ, abfd);
for (j = 0; j != native->n_numaux; j++) { for (j = 0; j != native->n_numaux; j++) {
bfd_coff_swap_aux(abfd, native + j + 1, type, class); bfd_coff_swap_aux(abfd, native + j + 1, type, class);
bfd_write((void *) (native + j + 1), 1, AUXESZ, abfd); bfd_write((PTR) (native + j + 1), 1, AUXESZ, abfd);
} }
/* /*
@ -941,12 +941,12 @@ coff_write_symbols(abfd)
if (string_size) { if (string_size) {
unsigned int size = string_size + 4; unsigned int size = string_size + 4;
bfd_h_put_x(abfd, size, &size); bfd_h_put_x(abfd, size, &size);
bfd_write((void *) &size, 1, sizeof(size), abfd); bfd_write((PTR) &size, 1, sizeof(size), abfd);
for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) { for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) {
asymbol *q = *p; asymbol *q = *p;
size_t name_length = strlen(q->name); size_t name_length = strlen(q->name);
if (name_length > SYMNMLEN) { if (name_length > SYMNMLEN) {
bfd_write((void *) (q->name), 1, name_length + 1, abfd); bfd_write((PTR) (q->name), 1, name_length + 1, abfd);
} }
} }
} }
@ -958,13 +958,13 @@ coff_write_symbols(abfd)
uint32e_type size = 4; uint32e_type size = 4;
bfd_h_put_x(abfd, size, &size); bfd_h_put_x(abfd, size, &size);
bfd_write((void *)&size, 1, sizeof(size), abfd); bfd_write((PTR)&size, 1, sizeof(size), abfd);
} }
} }
static void static void
coff_write_relocs(abfd) coff_write_relocs(abfd)
bfd *abfd; bfd *abfd;
{ {
@ -981,11 +981,11 @@ coff_write_relocs(abfd)
n.r_symndx = get_index((*(q->sym_ptr_ptr))); n.r_symndx = get_index((*(q->sym_ptr_ptr)));
n.r_type = q->howto->type; n.r_type = q->howto->type;
swap_reloc(abfd, &n); swap_reloc(abfd, &n);
bfd_write((void *) &n, 1, RELSZ, abfd); bfd_write((PTR) &n, 1, RELSZ, abfd);
} }
} }
} }
static void static void
coff_write_linenumbers(abfd) coff_write_linenumbers(abfd)
bfd *abfd; bfd *abfd;
{ {
@ -1001,17 +1001,17 @@ coff_write_linenumbers(abfd)
if (l) { if (l) {
/* Found a linenumber entry, output */ /* Found a linenumber entry, output */
struct lineno out; struct lineno out;
bzero( &out, sizeof(out)); bzero( (PTR)&out, sizeof(out));
out.l_lnno = 0; out.l_lnno = 0;
out.l_addr.l_symndx = l->u.offset; out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno(abfd, &out); bfd_coff_swap_lineno(abfd, &out);
bfd_write((void *) &out, 1, LINESZ, abfd); bfd_write((PTR) &out, 1, LINESZ, abfd);
l++; l++;
while (l->line_number) { while (l->line_number) {
out.l_lnno = l->line_number; out.l_lnno = l->line_number;
out.l_addr.l_symndx = l->u.offset; out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno(abfd, &out); bfd_coff_swap_lineno(abfd, &out);
bfd_write((void *) &out, 1, LINESZ, abfd); bfd_write((PTR) &out, 1, LINESZ, abfd);
l++; l++;
} }
} }
@ -1037,7 +1037,7 @@ coff_make_empty_symbol(abfd)
return &new->symbol; return &new->symbol;
} }
static void static void
coff_print_symbol(ignore_abfd, file, symbol, how) coff_print_symbol(ignore_abfd, file, symbol, how)
bfd *ignore_abfd; bfd *ignore_abfd;
FILE *file; FILE *file;
@ -1056,7 +1056,7 @@ coff_print_symbol(ignore_abfd, file, symbol, how)
{ {
char *section_name = symbol->section == (asection *) NULL ? char *section_name = symbol->section == (asection *) NULL ?
"*abs" : symbol->section->name; "*abs" : symbol->section->name;
bfd_print_symbol_vandf((void *) file, symbol); bfd_print_symbol_vandf((PTR) file, symbol);
fprintf(file, " %-5s %s %s %s", fprintf(file, " %-5s %s %s %s",
section_name, section_name,
@ -1167,7 +1167,7 @@ coff_set_arch_mach(abfd, arch, machine)
/* Calculate the file position for each section. */ /* Calculate the file position for each section. */
static void static void
coff_compute_section_file_positions(abfd) coff_compute_section_file_positions(abfd)
bfd *abfd; bfd *abfd;
{ {
@ -1338,7 +1338,7 @@ coff_write_object_contents(abfd)
#endif #endif
swap_scnhdr(abfd, &section); swap_scnhdr(abfd, &section);
bfd_write((void *) (&section), 1, SCNHSZ, abfd); bfd_write((PTR) (&section), 1, SCNHSZ, abfd);
pad = 0; pad = 0;
} }
@ -1440,11 +1440,11 @@ coff_write_object_contents(abfd)
if (bfd_seek(abfd, 0L, SEEK_SET) != 0) if (bfd_seek(abfd, 0L, SEEK_SET) != 0)
return false; return false;
bfd_write((void *) &file_header, 1, FILHSZ, abfd); bfd_write((PTR) &file_header, 1, FILHSZ, abfd);
if (abfd->flags & EXEC_P) { if (abfd->flags & EXEC_P) {
bfd_write((void *) exec_hdr(abfd), 1, AOUTSZ, abfd); bfd_write((PTR) exec_hdr(abfd), 1, AOUTSZ, abfd);
} }
return true; return true;
} }
@ -1455,7 +1455,7 @@ static boolean
coff_set_section_contents(abfd, section, location, offset, count) coff_set_section_contents(abfd, section, location, offset, count)
bfd *abfd; bfd *abfd;
sec_ptr section; sec_ptr section;
void *location; PTR location;
file_ptr offset; file_ptr offset;
size_t count; size_t count;
{ {
@ -1473,7 +1473,7 @@ static boolean
coff_get_section_contents(abfd, section, location, offset, count) coff_get_section_contents(abfd, section, location, offset, count)
bfd *abfd; bfd *abfd;
sec_ptr section; sec_ptr section;
void *location; PTR location;
file_ptr offset; file_ptr offset;
int count; int count;
{ {
@ -1521,28 +1521,28 @@ coff_close_and_cleanup(abfd)
static void * static PTR
buy_and_read(abfd, where, seek_direction, size) buy_and_read(abfd, where, seek_direction, size)
bfd *abfd; bfd *abfd;
file_ptr where; file_ptr where;
int seek_direction; int seek_direction;
size_t size; size_t size;
{ {
void *area = (void *) malloc(size); PTR area = (PTR) malloc(size);
if (!area) { if (!area) {
bfd_error = no_memory; bfd_error = no_memory;
return (NULL); return (NULL);
} }
bfd_seek(abfd, where, seek_direction); bfd_seek(abfd, where, seek_direction);
if (bfd_read(area, 1, size, abfd) != size) { if (bfd_read(area, 1, size, abfd) != size) {
bfd_error = system_call_error; bfd_error = system_call_error;
free(area); free(area);
return (NULL); return (NULL);
} /* on error */ } /* on error */
return (area); return (area);
} /* buy_and_read() */ } /* buy_and_read() */
static void static void
offset_symbol_indices(symtab, count, offset) offset_symbol_indices(symtab, count, offset)
SYMENT *symtab; SYMENT *symtab;
unsigned long count; unsigned long count;
@ -1598,7 +1598,7 @@ offset_symbol_indices(symtab, count, offset)
return; return;
} /* offset_symbol_indices() */ } /* offset_symbol_indices() */
/* swap the entire symbol table */ /* swap the entire symbol table */
static void static void
swap_raw_symtab(abfd, raw_symtab) swap_raw_symtab(abfd, raw_symtab)
bfd *abfd; bfd *abfd;
SYMENT *raw_symtab; SYMENT *raw_symtab;
@ -2004,7 +2004,7 @@ find_next_file_symbol(current, end)
Note that C_FILE symbols can, and some do, have more than 1 aux entry. Note that C_FILE symbols can, and some do, have more than 1 aux entry.
*/ */
static void static void
force_indices_file_symbol_relative(abfd, symtab) force_indices_file_symbol_relative(abfd, symtab)
bfd *abfd; bfd *abfd;
SYMENT *symtab; SYMENT *symtab;
@ -2316,7 +2316,7 @@ coff_slurp_reloc_table(abfd, asect, symbols)
*/ */
if (ptr->the_bfd == abfd && ptr->section != (asection *) NULL) { if (ptr->the_bfd == abfd && ptr->section != (asection *) NULL) {
cache_ptr->addend = -ptr->section->vma; cache_ptr->addend = -(ptr->section->vma + ptr->value);
} }
else { else {
cache_ptr->addend = 0; cache_ptr->addend = 0;

View File

@ -108,11 +108,11 @@ Summary:
may ignore the byte-within-word field of the pointer. */ may ignore the byte-within-word field of the pointer. */
#ifndef __PTR_TO_INT #ifndef __PTR_TO_INT
#define __PTR_TO_INT(P) ((P) - (char *)0) #define __PTR_TO_INT(P) ((P) - (char*)0)
#endif #endif
#ifndef __INT_TO_PTR #ifndef __INT_TO_PTR
#define __INT_TO_PTR(P) ((P) + (char *)0) #define __INT_TO_PTR(P) ((P) + (char*)0)
#endif #endif
struct _obstack_chunk /* Lives at front of each chunk. */ struct _obstack_chunk /* Lives at front of each chunk. */
@ -131,11 +131,8 @@ struct obstack /* control current object in current chunk */
char *chunk_limit; /* address of char after current chunk */ char *chunk_limit; /* address of char after current chunk */
int temp; /* Temporary for some macros. */ int temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */ int alignment_mask; /* Mask of alignment for each object. */
#ifdef __STDC__
void *(*chunkfun) (); /* User's fcn to allocate a chunk. */ PTR(*chunkfun) (); /* User's fcn to allocate a chunk. */
#else
char *(*chunkfun) (); /* User's fcn to allocate a chunk. */
#endif
void (*freefun) (); /* User's function to free a chunk. */ void (*freefun) (); /* User's function to free a chunk. */
}; };