* vaxnetbsd.c: Fix formatting.
* versados.c: Likewise.
* vms-gsd.c: Likewise.
* vms-hdr.c: Likewise.
* vms-misc.c: Likewise.
+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
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
o Object Text Recrod
o End Record
-
*/
#include "bfd.h"
#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 */
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. */
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;
return n;
}
-
static int
get_record (abfd, ptr)
bfd *abfd;
return n;
}
-
static void
process_esd (abfd, esd, pass)
bfd *abfd;
}
break;
-
case ESD_ABS:
size = get_4 (&ptr);
start = get_4 (&ptr);
"-v32", true, 0xffffffff, 0xffffffff, false),
};
-
static int
get_offset (len, ptr)
int len;
int offsetlen = flag & 0x7;
int j;
-
if (esdids == 0)
{
/* A zero esdid means the new pc is the offset given */
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
if (!contents && need_contents)
esdid->contents = (unsigned char *) bfd_alloc (abfd, esdid->section->_raw_size);
-
}
static boolean
return 1;
}
-
-
/* Check whether an existing file is a versados file. */
static const bfd_target *
return abfd->xvec;
}
-
static boolean
versados_pass_2 (abfd)
bfd *abfd;
VDATA (abfd)->es_done = ES_BASE;
-
/* read records till we get to where we want to be */
while (1)
return false;
}
-
-/*ARGSUSED */
static int
versados_sizeof_headers (abfd, exec)
bfd *abfd ATTRIBUTE_UNUSED;
return symcount;
}
-/*ARGSUSED */
void
versados_get_symbol_info (ignore_abfd, symbol, ret)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
bfd_symbol_info (symbol, ret);
}
-/*ARGSUSED */
void
versados_print_symbol (ignore_abfd, afile, symbol, how)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
return (asect->reloc_count + 1) * sizeof (arelent *);
}
-
long
versados_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
(PTR) 0
};
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"
(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[] = {
return section_flags[i].flags_always;
}
-
/* Retrieve vms section flags by name and size */
static flagword
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));
{
_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);
}
_bfd_vms_output_alignment (abfd, 8);
_bfd_vms_output_pop (abfd);
- _bfd_vms_output_end (abfd);
+ _bfd_vms_output_end (abfd);
return 0;
}
#endif
/*---------------------------------------------------------------------------*/
-
/* Read & process emh record
return 0 on success, -1 on error */
return 0;
}
-
/*-----------------------------------------------------------------------------*/
/* Output routines. */
-
/* Manufacure a VMS like time on a unix based system.
stolen from obj-vms.c */
return tbuf;
}
-
/* write object header for bfd abfd */
int
int had_case = 0;
int had_file = 0;
-
#if VMS_DEBUG
vms_debug (2, "vms_write_hdr (%p)\n", abfd);
#endif
vms_rec = PRIV(vms_rec);
- if ((objtype == OBJ_S_C_EOM)
+ if ((objtype == OBJ_S_C_EOM)
|| (objtype == OBJ_S_C_EOMW))
{
}
return 0;
}
-
/* Write eom record for bfd abfd */
int
#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 */
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);
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
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
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);
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' */
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
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;
return PRIV(rec_length);
}
-
/* get next vms record from file
update vms_rec and rec_length to new (remaining) values */
return PRIV(rec_type);
}
-
\f
/* Copy sized string (string with fixed length) to new allocated area
size is string length (size of record) */
return;
}
-
/* Pop value and section index */
uquad
return newptr;
}
-
/* Save section data & offset to an vms_section structure
vms_section_table[] holds the vms_section chain */
return true;
}
-
/* Get vms_section pointer to saved contents for section # index */
vms_section *
return;
}
-
/* Set record/subrecord alignment */
void
return;
}
-
/* Prepare for subrecord fields */
void
return;
}
-
/* End of subrecord fields */
void
return;
}
-
/* Flush unwritten output, ends current record */
void
vms_debug (6, "align: adding %d bytes\n", aligncount);
#endif
- while(aligncount-- > 0)
+ while (aligncount-- > 0)
{
PRIV(output_buf)[real_size++] = 0;
#if 0
return;
}
-
/* End record output */
void
return;
}
-
/* check remaining buffer size
return what's left. */
return (MAX_OUTREC_SIZE - (PRIV(output_size) + size + MIN_OUTREC_LUFT));
}
-
/* Output byte (8 bit) value */
void
return;
}
-
/* Output short (16 bit) value */
void
return;
}
-
/* Output long (32 bit) value */
void
return;
}
-
/* Output quad (64 bit) value */
void
return;
}
-
/* Output c-string as counted string */
void
_bfd_vms_output_dump (abfd, (unsigned char *)value, len);
}
-
/* Output character area */
void
return;
}
-
/* Output count bytes of value */
void
return outbuf;
}
-
/* Allocate and initialize a new symbol. */
static asymbol *
return symbol;
}
-
/* Allocate and enter a new private symbol. */
vms_symbol_entry *