1999-05-03 09:29:11 +02:00
|
|
|
|
/* vms-hdr.c -- BFD back-end for VMS/VAX (openVMS/VAX) and
|
|
|
|
|
EVAX (openVMS/Alpha) files.
|
2007-04-26 16:47:00 +02:00
|
|
|
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
|
|
|
|
|
2007 Free Software Foundation, Inc.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
HDR record handling functions
|
|
|
|
|
EMH record handling functions
|
|
|
|
|
and
|
|
|
|
|
EOM record handling functions
|
|
|
|
|
EEOM record handling functions
|
|
|
|
|
|
|
|
|
|
Written by Klaus K"ampf (kkaempf@rmi.de)
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-03 16:26:43 +02:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2005-04-21 09:45:39 +02:00
|
|
|
|
(at your option) any later version.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
2007-07-03 16:26:43 +02:00
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
|
MA 02110-1301, USA. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2007-04-26 16:47:00 +02:00
|
|
|
|
#include "sysdep.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#include "bfd.h"
|
2002-10-14 14:06:04 +02:00
|
|
|
|
#include "bfdver.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#include "bfdlink.h"
|
2001-09-19 07:33:36 +02:00
|
|
|
|
#include "safe-ctype.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#include "libbfd.h"
|
|
|
|
|
|
|
|
|
|
#include "vms.h"
|
|
|
|
|
|
2000-12-21 19:40:21 +01:00
|
|
|
|
#ifdef HAVE_ALLOCA_H
|
|
|
|
|
#include <alloca.h>
|
|
|
|
|
#endif
|
2001-09-01 12:29:27 +02:00
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
/* Read & process emh record
|
2005-04-21 09:45:39 +02:00
|
|
|
|
return 0 on success, -1 on error. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
int
|
2005-04-21 09:45:39 +02:00
|
|
|
|
_bfd_vms_slurp_hdr (bfd *abfd, int objtype)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
unsigned char *ptr;
|
|
|
|
|
unsigned char *vms_rec;
|
|
|
|
|
int subtype;
|
|
|
|
|
|
|
|
|
|
vms_rec = PRIV(vms_rec);
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug(2, "HDR/EMH\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
switch (objtype)
|
|
|
|
|
{
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case OBJ_S_C_HDR:
|
|
|
|
|
subtype = vms_rec[1];
|
|
|
|
|
break;
|
|
|
|
|
case EOBJ_S_C_EMH:
|
|
|
|
|
subtype = bfd_getl16 (vms_rec + 4) + EVAX_OFFSET;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
subtype = -1;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug(3, "subtype %d\n", subtype);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
switch (subtype)
|
|
|
|
|
{
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case MHD_S_C_MHD:
|
|
|
|
|
/* Module header. */
|
|
|
|
|
PRIV (hdr_data).hdr_b_strlvl = vms_rec[2];
|
|
|
|
|
PRIV (hdr_data).hdr_l_recsiz = bfd_getl16 (vms_rec + 3);
|
|
|
|
|
PRIV (hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 5);
|
|
|
|
|
ptr = vms_rec + 5 + vms_rec[5] + 1;
|
|
|
|
|
PRIV (hdr_data).hdr_t_version = _bfd_vms_save_counted_string (ptr);
|
|
|
|
|
ptr += *ptr + 1;
|
|
|
|
|
PRIV (hdr_data).hdr_t_date = _bfd_vms_save_sized_string (ptr, 17);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case MHD_S_C_LNM:
|
|
|
|
|
PRIV (hdr_data).hdr_c_lnm = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 2));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case MHD_S_C_SRC:
|
|
|
|
|
PRIV (hdr_data).hdr_c_src = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 2));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case MHD_S_C_TTL:
|
|
|
|
|
PRIV (hdr_data).hdr_c_ttl = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 2));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case EMH_S_C_MHD + EVAX_OFFSET:
|
|
|
|
|
/* Module header. */
|
|
|
|
|
PRIV (hdr_data).hdr_b_strlvl = vms_rec[6];
|
|
|
|
|
PRIV (hdr_data).hdr_l_arch1 = bfd_getl32 (vms_rec + 8);
|
|
|
|
|
PRIV (hdr_data).hdr_l_arch2 = bfd_getl32 (vms_rec + 12);
|
|
|
|
|
PRIV (hdr_data).hdr_l_recsiz = bfd_getl32 (vms_rec + 16);
|
|
|
|
|
PRIV (hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 20);
|
|
|
|
|
ptr = vms_rec + 20 + vms_rec[20] + 1;
|
|
|
|
|
PRIV (hdr_data).hdr_t_version =_bfd_vms_save_counted_string (ptr);
|
|
|
|
|
ptr += *ptr + 1;
|
|
|
|
|
PRIV (hdr_data).hdr_t_date = _bfd_vms_save_sized_string (ptr, 17);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case EMH_S_C_LNM + EVAX_OFFSET:
|
|
|
|
|
PRIV (hdr_data).hdr_c_lnm = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 6));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case EMH_S_C_SRC + EVAX_OFFSET:
|
|
|
|
|
PRIV (hdr_data).hdr_c_src = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 6));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case EMH_S_C_TTL + EVAX_OFFSET:
|
|
|
|
|
PRIV (hdr_data).hdr_c_ttl = _bfd_vms_save_sized_string (vms_rec, PRIV (rec_length - 6));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
case MHD_S_C_CPR:
|
|
|
|
|
case MHD_S_C_MTC:
|
|
|
|
|
case MHD_S_C_GTX:
|
|
|
|
|
case EMH_S_C_CPR + EVAX_OFFSET:
|
|
|
|
|
case EMH_S_C_MTC + EVAX_OFFSET:
|
|
|
|
|
case EMH_S_C_GTX + EVAX_OFFSET:
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
default:
|
|
|
|
|
bfd_set_error (bfd_error_wrong_format);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
return -1;
|
2005-04-21 09:45:39 +02:00
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Output routines. */
|
|
|
|
|
|
2003-11-30 19:40:41 +01:00
|
|
|
|
/* Manufacture a VMS like time on a unix based system.
|
2005-04-21 09:45:39 +02:00
|
|
|
|
stolen from obj-vms.c. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
static unsigned char *
|
2005-04-21 09:45:39 +02:00
|
|
|
|
get_vms_time_string (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
static unsigned char tbuf[18];
|
|
|
|
|
#ifndef VMS
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
char *pnt;
|
|
|
|
|
time_t timeb;
|
2005-04-21 09:45:39 +02:00
|
|
|
|
|
|
|
|
|
time (& timeb);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
pnt = ctime (&timeb);
|
|
|
|
|
pnt[3] = 0;
|
|
|
|
|
pnt[7] = 0;
|
|
|
|
|
pnt[10] = 0;
|
|
|
|
|
pnt[16] = 0;
|
|
|
|
|
pnt[24] = 0;
|
2005-02-20 15:59:07 +01:00
|
|
|
|
sprintf ((char *) tbuf, "%2s-%3s-%s %s",
|
|
|
|
|
pnt + 8, pnt + 4, pnt + 20, pnt + 11);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#else
|
|
|
|
|
#include <starlet.h>
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
int Size;
|
|
|
|
|
unsigned char *Ptr;
|
|
|
|
|
} Descriptor;
|
|
|
|
|
Descriptor.Size = 17;
|
|
|
|
|
Descriptor.Ptr = tbuf;
|
|
|
|
|
SYS$ASCTIM (0, &Descriptor, 0, 0);
|
|
|
|
|
#endif /* not VMS */
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (6, "vmstimestring:'%s'\n", tbuf);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return tbuf;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* Write object header for bfd abfd. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
int
|
2005-04-21 09:45:39 +02:00
|
|
|
|
_bfd_vms_write_hdr (bfd *abfd, int objtype)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
asymbol *symbol;
|
1999-07-12 12:30:21 +02:00
|
|
|
|
unsigned int symnum;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
int had_case = 0;
|
|
|
|
|
int had_file = 0;
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "vms_write_hdr (%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
_bfd_vms_output_alignment (abfd, 2);
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* MHD. */
|
|
|
|
|
if (objtype != OBJ_S_C_HDR)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_MHD);
|
|
|
|
|
_bfd_vms_output_short (abfd, EOBJ_S_C_STRLVL);
|
|
|
|
|
_bfd_vms_output_long (abfd, 0);
|
|
|
|
|
_bfd_vms_output_long (abfd, 0);
|
|
|
|
|
_bfd_vms_output_long (abfd, MAX_OUTREC_SIZE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bfd_get_filename (abfd) != 0)
|
|
|
|
|
{
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* Strip path and suffix information. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
char *fname, *fout, *fptr;
|
|
|
|
|
|
|
|
|
|
fptr = bfd_get_filename (abfd);
|
2005-04-21 09:45:39 +02:00
|
|
|
|
fname = alloca (strlen (fptr) + 1);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
strcpy (fname, fptr);
|
|
|
|
|
fout = strrchr (fname, ']');
|
|
|
|
|
if (fout == 0)
|
|
|
|
|
fout = strchr (fname, ':');
|
|
|
|
|
if (fout != 0)
|
|
|
|
|
fout++;
|
|
|
|
|
else
|
|
|
|
|
fout = fname;
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* Strip .obj suffix. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
fptr = strrchr (fname, '.');
|
|
|
|
|
if ((fptr != 0)
|
|
|
|
|
&& (strcasecmp (fptr, ".OBJ") == 0))
|
|
|
|
|
*fptr = 0;
|
|
|
|
|
|
|
|
|
|
fptr = fout;
|
|
|
|
|
while (*fptr != 0)
|
|
|
|
|
{
|
2001-09-19 07:33:36 +02:00
|
|
|
|
*fptr = TOUPPER (*fptr);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
fptr++;
|
|
|
|
|
if ((*fptr == ';')
|
|
|
|
|
|| ((fptr - fout) > 31))
|
|
|
|
|
*fptr = 0;
|
|
|
|
|
}
|
|
|
|
|
_bfd_vms_output_counted (abfd, fout);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
_bfd_vms_output_counted (abfd, "NONAME");
|
|
|
|
|
|
2001-10-02 07:58:41 +02:00
|
|
|
|
_bfd_vms_output_counted (abfd, BFD_VERSION_STRING);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_dump (abfd, get_vms_time_string (), 17);
|
|
|
|
|
_bfd_vms_output_fill (abfd, 0, 17);
|
|
|
|
|
_bfd_vms_output_flush (abfd);
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* LMN. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_LNM);
|
2006-09-16 20:12:17 +02:00
|
|
|
|
_bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("GAS proGIS"));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_flush (abfd);
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* SRC. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_SRC);
|
|
|
|
|
|
|
|
|
|
for (symnum = 0; symnum < abfd->symcount; symnum++)
|
|
|
|
|
{
|
|
|
|
|
symbol = abfd->outsymbols[symnum];
|
|
|
|
|
|
|
|
|
|
if (symbol->flags & BSF_FILE)
|
|
|
|
|
{
|
2006-09-16 20:12:17 +02:00
|
|
|
|
if (CONST_STRNEQ ((char *)symbol->name, "<CASE:"))
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
2005-04-21 09:45:39 +02:00
|
|
|
|
PRIV (flag_hash_long_names) = symbol->name[6] - '0';
|
|
|
|
|
PRIV (flag_show_after_trunc) = symbol->name[7] - '0';
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
if (had_file)
|
|
|
|
|
break;
|
|
|
|
|
had_case = 1;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
_bfd_vms_output_dump (abfd, (unsigned char *) symbol->name,
|
|
|
|
|
(int) strlen (symbol->name));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (had_case)
|
|
|
|
|
break;
|
|
|
|
|
had_file = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (symnum == abfd->symcount)
|
2006-09-16 20:12:17 +02:00
|
|
|
|
_bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("noname"));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
_bfd_vms_output_flush (abfd);
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* TTL. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_TTL);
|
2006-09-16 20:12:17 +02:00
|
|
|
|
_bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("TTL"));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_flush (abfd);
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* CPR. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_CPR);
|
|
|
|
|
_bfd_vms_output_dump (abfd,
|
|
|
|
|
(unsigned char *)"GNU BFD ported by Klaus K<>mpf 1994-1996",
|
|
|
|
|
39);
|
|
|
|
|
_bfd_vms_output_flush (abfd);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process EOM/EEOM record
|
2005-04-21 09:45:39 +02:00
|
|
|
|
return 0 on success, -1 on error. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
int
|
2005-04-21 09:45:39 +02:00
|
|
|
|
_bfd_vms_slurp_eom (bfd *abfd, int objtype)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
unsigned char *vms_rec;
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug(2, "EOM/EEOM\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
vms_rec = PRIV (vms_rec);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2000-12-26 20:50:50 +01:00
|
|
|
|
if ((objtype == OBJ_S_C_EOM)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|| (objtype == OBJ_S_C_EOMW))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-04-21 09:45:39 +02:00
|
|
|
|
PRIV (eom_data).eom_l_total_lps = bfd_getl32 (vms_rec + 4);
|
|
|
|
|
PRIV (eom_data).eom_b_comcod = *(vms_rec + 8);
|
|
|
|
|
|
|
|
|
|
if (PRIV (eom_data).eom_b_comcod > 1)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
(*_bfd_error_handler) (_("Object module NOT error-free !\n"));
|
|
|
|
|
bfd_set_error (bfd_error_bad_value);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2005-04-21 09:45:39 +02:00
|
|
|
|
PRIV (eom_data).eom_has_transfer = FALSE;
|
|
|
|
|
if (PRIV (rec_size) > 10)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
2005-04-21 09:45:39 +02:00
|
|
|
|
PRIV (eom_data).eom_has_transfer = TRUE;
|
|
|
|
|
PRIV (eom_data).eom_b_tfrflg = *(vms_rec + 9);
|
|
|
|
|
PRIV (eom_data).eom_l_psindx = bfd_getl32 (vms_rec + 12);
|
|
|
|
|
PRIV (eom_data).eom_l_tfradr = bfd_getl32 (vms_rec + 16);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
abfd->start_address = PRIV (eom_data).eom_l_tfradr;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-21 09:45:39 +02:00
|
|
|
|
/* Write eom record for bfd abfd. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
int
|
2005-04-21 09:45:39 +02:00
|
|
|
|
_bfd_vms_write_eom (bfd *abfd, int objtype)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "vms_write_eom (%p, %d)\n", abfd, objtype);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
_bfd_vms_output_begin (abfd, objtype, -1);
|
2005-04-21 09:45:39 +02:00
|
|
|
|
_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. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
if (bfd_get_start_address (abfd) != (bfd_vma)-1)
|
|
|
|
|
{
|
|
|
|
|
asection *section;
|
|
|
|
|
|
|
|
|
|
section = bfd_get_section_by_name (abfd, ".link");
|
|
|
|
|
if (section == 0)
|
|
|
|
|
{
|
|
|
|
|
bfd_set_error (bfd_error_nonrepresentable_section);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
_bfd_vms_output_short (abfd, 0);
|
2000-12-26 20:50:50 +01:00
|
|
|
|
_bfd_vms_output_long (abfd, (unsigned long) (section->index));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
_bfd_vms_output_long (abfd,
|
|
|
|
|
(unsigned long) bfd_get_start_address (abfd));
|
|
|
|
|
_bfd_vms_output_long (abfd, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_bfd_vms_output_end (abfd);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|