2000-12-26 Kazu Hirata <kazu@hxi.com>

* vaxnetbsd.c: Fix formatting.
	* versados.c: Likewise.
	* vms-gsd.c: Likewise.
	* vms-hdr.c: Likewise.
	* vms-misc.c: Likewise.
This commit is contained in:
Kazu Hirata 2000-12-26 19:50:50 +00:00
parent ae7d06ad04
commit 558e161f24
6 changed files with 36 additions and 87 deletions

View File

@ -1,3 +1,11 @@
2000-12-26 Kazu Hirata <kazu@hxi.com>
* vaxnetbsd.c: Fix formatting.
* versados.c: Likewise.
* vms-gsd.c: Likewise.
* vms-hdr.c: Likewise.
* vms-misc.c: Likewise.
2000-12-25 Alexandre Oliva <aoliva@redhat.com>
* archive.c (coff_write_armap): Don't write more than symbol_count

View File

@ -15,7 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define BYTES_IN_WORD 4
#undef TARGET_IS_BIG_ENDIAN_P

View File

@ -36,7 +36,6 @@
o Object Text Recrod
o End Record
*/
#include "bfd.h"
@ -44,18 +43,15 @@
#include "libbfd.h"
#include "libiberty.h"
static boolean versados_mkobject PARAMS ((bfd *));
static boolean versados_scan PARAMS ((bfd *));
static const bfd_target *versados_object_p PARAMS ((bfd *));
#define VHEADER '1'
#define VESTDEF '2'
#define VOTR '3'
#define VEND '4'
#define ES_BASE 17 /* first symbol has esdid 17 */
/* Per file target dependent information */
@ -145,11 +141,7 @@ union ext_any
struct ext_otr otr;
};
/* Initialize by filling in the hex conversion array. */
/* Initialize by filling in the hex conversion array. */
/* Set up the tdata information. */
@ -171,13 +163,10 @@ versados_mkobject (abfd)
return true;
}
/* Report a problem in an S record file. FIXME: This probably should
not call fprintf, but we really do need some mechanism for printing
error messages. */
static asymbol *
versados_new_symbol (abfd, snum, name, val, sec)
bfd *abfd;
@ -195,7 +184,6 @@ versados_new_symbol (abfd, snum, name, val, sec)
return n;
}
static int
get_record (abfd, ptr)
bfd *abfd;
@ -244,7 +232,6 @@ new_symbol_string (abfd, name)
return n;
}
static void
process_esd (abfd, esd, pass)
bfd *abfd;
@ -296,7 +283,6 @@ process_esd (abfd, esd, pass)
}
break;
case ESD_ABS:
size = get_4 (&ptr);
start = get_4 (&ptr);
@ -356,7 +342,6 @@ reloc_howto_type versados_howto_table[] =
"-v32", true, 0xffffffff, 0xffffffff, false),
};
static int
get_offset (len, ptr)
int len;
@ -405,7 +390,6 @@ process_otr (abfd, otr, pass)
int offsetlen = flag & 0x7;
int j;
if (esdids == 0)
{
/* A zero esdid means the new pc is the offset given */
@ -433,7 +417,7 @@ process_otr (abfd, otr, pass)
int rn = EDATA (abfd, otr->esdid - 1).relocs++;
if (pass == 1)
{
/* this is the first pass over the data,
/* this is the first pass over the data,
just remember that we need a reloc */
}
else
@ -471,7 +455,6 @@ process_otr (abfd, otr, pass)
if (!contents && need_contents)
esdid->contents = (unsigned char *) bfd_alloc (abfd, esdid->section->_raw_size);
}
static boolean
@ -586,8 +569,6 @@ versados_scan (abfd)
return 1;
}
/* Check whether an existing file is a versados file. */
static const bfd_target *
@ -633,7 +614,6 @@ versados_object_p (abfd)
return abfd->xvec;
}
static boolean
versados_pass_2 (abfd)
bfd *abfd;
@ -648,7 +628,6 @@ versados_pass_2 (abfd)
VDATA (abfd)->es_done = ES_BASE;
/* read records till we get to where we want to be */
while (1)
@ -701,8 +680,6 @@ versados_set_section_contents (abfd, section, location, offset, bytes_to_do)
return false;
}
/*ARGSUSED */
static int
versados_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
@ -755,7 +732,6 @@ versados_get_symtab (abfd, alocation)
return symcount;
}
/*ARGSUSED */
void
versados_get_symbol_info (ignore_abfd, symbol, ret)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -765,7 +741,6 @@ versados_get_symbol_info (ignore_abfd, symbol, ret)
bfd_symbol_info (symbol, ret);
}
/*ARGSUSED */
void
versados_print_symbol (ignore_abfd, afile, symbol, how)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
@ -796,7 +771,6 @@ versados_get_reloc_upper_bound (abfd, asect)
return (asect->reloc_count + 1) * sizeof (arelent *);
}
long
versados_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
@ -922,6 +896,6 @@ const bfd_target versados_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(PTR) 0
};

View File

@ -21,7 +21,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#include "bfd.h"
@ -85,7 +84,6 @@ static struct sec_flags_struct vax_section_flags[] = {
(SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }
};
/* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible */
static struct sec_flags_struct evax_section_flags[] = {
@ -170,7 +168,6 @@ vms_secflag_by_name (abfd, section_flags, name, size)
return section_flags[i].flags_always;
}
/* Retrieve vms section flags by name and size */
static flagword
@ -653,7 +650,7 @@ _bfd_vms_slurp_gsd (abfd, objtype)
new_flags |= BSF_FUNCTION;
}
symbol->value = bfd_getl64 (vms_rec+8);
symbol->section = (asection *)((unsigned long) bfd_getl32 (vms_rec+28));
symbol->section = (asection *) ((unsigned long) bfd_getl32 (vms_rec+28));
#if VMS_DEBUG
vms_debug(4, "egsd sym def #%d (%s, %d, %04x=%s)\n", abfd->symcount,
symbol->name, (int)symbol->section, old_flags, flag2str(gsyflagdesc, old_flags));
@ -899,9 +896,9 @@ _bfd_vms_write_gsd (abfd, objtype)
{
_bfd_vms_output_quad (abfd, symbol->value);
_bfd_vms_output_quad (abfd,
((asymbol *)(symbol->udata.p))->value);
((asymbol *) (symbol->udata.p))->value);
_bfd_vms_output_long (abfd,
(((asymbol *)(symbol->udata.p))
(((asymbol *) (symbol->udata.p))
->section->index));
_bfd_vms_output_long (abfd, symbol->section->index);
}
@ -921,7 +918,7 @@ _bfd_vms_write_gsd (abfd, objtype)
_bfd_vms_output_alignment (abfd, 8);
_bfd_vms_output_pop (abfd);
_bfd_vms_output_end (abfd);
_bfd_vms_output_end (abfd);
return 0;
}

View File

@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
/*---------------------------------------------------------------------------*/
/* Read & process emh record
return 0 on success, -1 on error */
@ -199,11 +198,9 @@ _bfd_vms_slurp_hdr (abfd, objtype)
return 0;
}
/*-----------------------------------------------------------------------------*/
/* Output routines. */
/* Manufacure a VMS like time on a unix based system.
stolen from obj-vms.c */
@ -243,7 +240,6 @@ get_vms_time_string ()
return tbuf;
}
/* write object header for bfd abfd */
int
@ -256,7 +252,6 @@ _bfd_vms_write_hdr (abfd, objtype)
int had_case = 0;
int had_file = 0;
#if VMS_DEBUG
vms_debug (2, "vms_write_hdr (%p)\n", abfd);
#endif
@ -395,7 +390,7 @@ _bfd_vms_slurp_eom (abfd, objtype)
vms_rec = PRIV(vms_rec);
if ((objtype == OBJ_S_C_EOM)
if ((objtype == OBJ_S_C_EOM)
|| (objtype == OBJ_S_C_EOMW))
{
}
@ -423,7 +418,6 @@ _bfd_vms_slurp_eom (abfd, objtype)
return 0;
}
/* Write eom record for bfd abfd */
int
@ -436,7 +430,7 @@ _bfd_vms_write_eom (abfd, objtype)
#endif
_bfd_vms_output_begin (abfd, objtype, -1);
_bfd_vms_output_long (abfd, (unsigned long)(PRIV(vms_linkage_index) >> 1));
_bfd_vms_output_long (abfd, (unsigned long) (PRIV(vms_linkage_index) >> 1));
_bfd_vms_output_byte (abfd, 0); /* completion code */
_bfd_vms_output_byte (abfd, 0); /* fill byte */
@ -451,7 +445,7 @@ _bfd_vms_write_eom (abfd, objtype)
return -1;
}
_bfd_vms_output_short (abfd, 0);
_bfd_vms_output_long (abfd, (unsigned long)(section->index));
_bfd_vms_output_long (abfd, (unsigned long) (section->index));
_bfd_vms_output_long (abfd,
(unsigned long) bfd_get_start_address (abfd));
_bfd_vms_output_long (abfd, 0);

View File

@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if __STDC__
#include <stdarg.h>
#endif
@ -38,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
evaluates environment variable VMS_DEBUG for a
numerical value on the first call
all error levels below this value are printed
levels:
1 toplevel bfd calls (functions from the bfd vector)
2 functions called by bfd calls
@ -74,10 +73,10 @@ _bfd_vms_debug (int level, char *format, ...)
if (abslvl > min_level)
return;
while(--level>0)
fprintf(output, " ");
while (--level>0)
fprintf (output, " ");
va_start(args, format);
vfprintf(output, format, args);
vfprintf (output, format, args);
fflush(output);
va_end(args);
@ -112,16 +111,15 @@ _bfd_vms_debug (level, format, a1, a2, a3, a4, a5, a6)
if (level > min_level)
return;
while(--level>0)
fprintf(output, " ");
fprintf(output, format, a1, a2, a3, a4, a5, a6);
while (--level>0)
fprintf (output, " ");
fprintf (output, format, a1, a2, a3, a4, a5, a6);
fflush(output);
return;
}
#endif /* __STDC__ */
/* a debug function
hex dump 'size' bytes starting at 'ptr' */
@ -235,43 +233,41 @@ _bfd_vms_get_header_values (abfd, buf, type, length)
vms_debug (10, "_bfd_vms_get_header_values type %x, length %x\n", (type?*type:0), (length?*length:0));
#endif
return;
}
/* Get next record from object file to vms_buf
set PRIV(buf_size) and return it
this is a little tricky since it should be portable.
the openVMS object file has 'variable length' which means that
read() returns data in chunks of (hopefully) correct and expected
size. The linker (and other tools on vms) depend on that. Unix doesn't
know about 'formatted' files, so reading and writing such an object
file in a unix environment is not trivial.
With the tool 'file' (available on all vms ftp sites), one
can view and change the attributes of a file. Changing from
'variable length' to 'fixed length, 512 bytes' reveals the
record length at the first 2 bytes of every record. The same
happens during the transfer of object files from vms to unix,
at least with ucx, dec's implementation of tcp/ip.
The vms format repeats the length at bytes 2 & 3 of every record.
On the first call (file_format == FF_UNKNOWN) we check if
the first and the third byte pair (!) of the record match.
If they do it's an object file in an unix environment or with
wrong attributes (FF_FOREIGN), else we should be in a vms
environment where read() returns the record size (FF_NATIVE).
reading is always done in 2 steps.
first just the record header is read and the length extracted
by get_header_values
then the read buffer is adjusted and the remaining bytes are
read in.
all file i/o is always done on even file positions */
int
@ -318,12 +314,12 @@ _bfd_vms_get_record (abfd)
test_len = 6; /* probe 6 bytes */
test_start = 2; /* where the record starts */
break;
case FF_NATIVE:
test_len = 4;
test_start = 0;
break;
default:
case FF_VAX:
test_len = 0;
@ -437,7 +433,6 @@ _bfd_vms_get_record (abfd)
return PRIV(rec_length);
}
/* get next vms record from file
update vms_rec and rec_length to new (remaining) values */
@ -484,7 +479,6 @@ _bfd_vms_next_record (abfd)
return PRIV(rec_type);
}
/* Copy sized string (string with fixed length) to new allocated area
size is string length (size of record) */
@ -548,7 +542,6 @@ _bfd_vms_push (abfd, val, psect)
return;
}
/* Pop value and section index */
uquad
@ -610,7 +603,6 @@ add_new_contents (abfd, section)
return newptr;
}
/* Save section data & offset to an vms_section structure
vms_section_table[] holds the vms_section chain */
@ -639,7 +631,6 @@ _bfd_save_vms_section (abfd, section, data, offset, count)
return true;
}
/* Get vms_section pointer to saved contents for section # index */
vms_section *
@ -694,7 +685,6 @@ _bfd_vms_output_begin (abfd, rectype, rechead)
return;
}
/* Set record/subrecord alignment */
void
@ -710,7 +700,6 @@ _bfd_vms_output_alignment (abfd, alignto)
return;
}
/* Prepare for subrecord fields */
void
@ -726,7 +715,6 @@ _bfd_vms_output_push (abfd)
return;
}
/* End of subrecord fields */
void
@ -749,7 +737,6 @@ _bfd_vms_output_pop (abfd)
return;
}
/* Flush unwritten output, ends current record */
void
@ -779,7 +766,7 @@ _bfd_vms_output_flush (abfd)
vms_debug (6, "align: adding %d bytes\n", aligncount);
#endif
while(aligncount-- > 0)
while (aligncount-- > 0)
{
PRIV(output_buf)[real_size++] = 0;
#if 0
@ -814,7 +801,6 @@ _bfd_vms_output_flush (abfd)
return;
}
/* End record output */
void
@ -830,7 +816,6 @@ _bfd_vms_output_end (abfd)
return;
}
/* check remaining buffer size
return what's left. */
@ -847,7 +832,6 @@ _bfd_vms_output_check (abfd, size)
return (MAX_OUTREC_SIZE - (PRIV(output_size) + size + MIN_OUTREC_LUFT));
}
/* Output byte (8 bit) value */
void
@ -864,7 +848,6 @@ _bfd_vms_output_byte (abfd, value)
return;
}
/* Output short (16 bit) value */
void
@ -881,7 +864,6 @@ _bfd_vms_output_short (abfd, value)
return;
}
/* Output long (32 bit) value */
void
@ -898,7 +880,6 @@ _bfd_vms_output_long (abfd, value)
return;
}
/* Output quad (64 bit) value */
void
@ -915,7 +896,6 @@ _bfd_vms_output_quad (abfd, value)
return;
}
/* Output c-string as counted string */
void
@ -944,7 +924,6 @@ int len;
_bfd_vms_output_dump (abfd, (unsigned char *)value, len);
}
/* Output character area */
void
@ -966,7 +945,6 @@ _bfd_vms_output_dump (abfd, data, length)
return;
}
/* Output count bytes of value */
void
@ -1075,7 +1053,6 @@ _bfd_vms_length_hash_symbol (abfd, in, maxlen)
return outbuf;
}
/* Allocate and initialize a new symbol. */
static asymbol *
@ -1098,7 +1075,6 @@ new_symbol (abfd, name)
return symbol;
}
/* Allocate and enter a new private symbol. */
vms_symbol_entry *