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
switch (PRIV(file_format))
{
- case FF_UNKNOWN:
- case FF_FOREIGN:
- test_len = 6; /* probe 6 bytes */
- test_start = 2; /* where the record starts */
+ case FF_UNKNOWN:
+ case FF_FOREIGN:
+ test_len = 6; /* probe 6 bytes */
+ test_start = 2; /* where the record starts */
break;
- case FF_NATIVE:
- test_len = 4;
- test_start = 0;
+ case FF_NATIVE:
+ test_len = 4;
+ test_start = 0;
break;
- case FF_VAX:
- test_len = 0;
- test_start = 0;
+ default:
+ case FF_VAX:
+ test_len = 0;
+ test_start = 0;
break;
- }
+ }
/* skip odd alignment byte */
return PRIV(rec_length);
}
-
/* get next vms record from file
update vms_rec and rec_length to new (remaining) values */
return -1;
}
- if (!PRIV(vms_rec))
+ if (!PRIV(vms_rec) || !PRIV(vms_buf)
+ || PRIV(vms_rec) >= (PRIV(vms_buf) + PRIV(buf_size)))
return -1;
if (PRIV(is_vax))
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 *