2010-01-27 Tristan Gingold <gingold@adacore.com>

* vms.h: Remove trailing spaces.
	(struct hdr_struct): Remove unused hdr_c_cpr field.
	(enum file_format_enum): Add comments.
	* vms.c (vms_bfd_print_private_bfd_data): New function that
	replaces the macro.
	Remove trailing spaces.
	* vms-misc.c: Improve comments.
	(_bfd_vms_get_object_record): Also handle files without pads.
	* vms-hdr.c (_bfd_vms_write_dbg): Fix format string.
	* vms-gsd.c (struct flagdescstruct): Make name field const.
	(gsyflagdesc): Fix typo.
This commit is contained in:
Tristan Gingold
2010-01-27 16:43:27 +00:00
parent b10d287364
commit 771deb084e
6 changed files with 79 additions and 29 deletions

View File

@ -1,3 +1,17 @@
2010-01-27 Tristan Gingold <gingold@adacore.com>
* vms.h: Remove trailing spaces.
(struct hdr_struct): Remove unused hdr_c_cpr field.
(enum file_format_enum): Add comments.
* vms.c (vms_bfd_print_private_bfd_data): New function that
replaces the macro.
Remove trailing spaces.
* vms-misc.c: Improve comments.
(_bfd_vms_get_object_record): Also handle files without pads.
* vms-hdr.c (_bfd_vms_write_dbg): Fix format string.
* vms-gsd.c (struct flagdescstruct): Make name field const.
(gsyflagdesc): Fix typo.
2010-01-27 Alan Modra <amodra@gmail.com>
PR ld/11217

View File

@ -204,7 +204,7 @@ vms_esecflag_by_name (struct sec_flags_struct *section_flags,
#if VMS_DEBUG
struct flagdescstruct { char *name; flagword value; };
struct flagdescstruct { const char *name; flagword value; };
static const struct flagdescstruct gpsflagdesc[] =
{
@ -231,7 +231,7 @@ static const struct flagdescstruct gsyflagdesc[] =
{ "REL", GSY_S_M_REL },
{ "COMM", EGSY_S_V_COMM },
{ "VECEP", EGSY_S_V_VECEP },
{ "NORM", EGCY_S_V_NORM },
{ "NORM", EGSY_S_V_NORM },
{ NULL, 0 }
};

View File

@ -1397,7 +1397,7 @@ int
_bfd_vms_write_dbg (bfd *abfd ATTRIBUTE_UNUSED, int objtype ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
_bfd_vms_debug (2, "vms_write_dbg (%p, objtype)\n", abfd, objtype);
_bfd_vms_debug (2, "vms_write_dbg (%p, %d)\n", abfd, objtype);
#endif
return 0;

View File

@ -211,7 +211,7 @@ _bfd_vms_get_header_values (bfd * abfd ATTRIBUTE_UNUSED,
can view and change the attributes of a file. Changing from
'variable length' to 'fixed length, 512 bytes' reveals the
record size at the first 2 bytes of every record. The same
happens during the transfer of object files from VMS to Unix,
may happen during the transfer of object files from VMS to Unix,
at least with UCX, the DEC implementation of TCP/IP.
The VMS format repeats the size at bytes 2 & 3 of every record.
@ -355,6 +355,8 @@ _bfd_vms_get_object_record (bfd *abfd)
test_len = 0;
else
{
int off = 0;
/* See _bfd_vms_get_first_record. */
test_len = 6;
@ -366,10 +368,16 @@ _bfd_vms_get_object_record (bfd *abfd)
bfd_set_error (bfd_error_file_truncated);
return -1;
}
/* Alignment byte may be present or not. This is not easy to
detect but all object record types are not 0 (on Alpha VMS).
We also hope that pad byte is 0. */
if (PRIV (vms_buf)[0])
off = 1;
}
/* Read the record header */
if (bfd_bread (PRIV (vms_buf), test_len, abfd) != test_len)
if (bfd_bread (PRIV (vms_buf) + off, test_len - off, abfd)
!= test_len - off)
{
bfd_set_error (bfd_error_file_truncated);
return -1;

View File

@ -90,7 +90,6 @@ static bfd_boolean vms_set_section_contents
#define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab
#define vms_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#define vms_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
#define vms_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define vms_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
#define vms_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
@ -1411,6 +1410,22 @@ vms_set_section_contents (bfd * abfd,
memcpy (section->contents + offset, location, (size_t) count);
return TRUE;
}
static bfd_boolean
vms_bfd_print_private_bfd_data (bfd *abfd, void *ptr)
{
FILE *file = (FILE *)ptr;
fprintf (file, _("structure level: %d\n"), PRIV(hdr_data.hdr_b_strlvl));
fprintf (file, _("module name : %s\n"), PRIV(hdr_data.hdr_t_name));
fprintf (file, _("module version : %s\n"), PRIV(hdr_data.hdr_t_version));
fprintf (file, _("module date : %s\n"), PRIV(hdr_data.hdr_t_date));
fprintf (file, _("language name : %s\n"), PRIV(hdr_data.hdr_c_lnm));
fprintf (file, _("source files : %s\n"), PRIV(hdr_data.hdr_c_src));
fprintf (file, _("title : %s\n"), PRIV(hdr_data.hdr_c_ttl));
return TRUE;
}
const bfd_target vms_alpha_vec =
{

View File

@ -587,7 +587,6 @@ struct hdr_struct
char *hdr_c_lnm;
char *hdr_c_src;
char *hdr_c_ttl;
char *hdr_c_cpr;
};
#define EMH_S_W_HDRTYP 4
@ -676,8 +675,22 @@ struct eom_struct
#define DBG_S_L_DMT_PSECT_LENGTH 4
#define DBG_S_C_DMT_PSECT_SIZE 8
/* File format. */
enum file_format_enum
{
/* Not yet known. */
FF_UNKNOWN,
/* Unix format. Each record is preceeded by the record length,
on 2 bytes. */
FF_FOREIGN,
/* Native (=VMS) format. The file only contains the content of the
records. This may also appear on Unix, depending on which tool
was used to transfer files. */
FF_NATIVE
};
enum file_format_enum { FF_UNKNOWN, FF_FOREIGN, FF_NATIVE };
enum file_type_enum { FT_UNKNOWN, FT_MODULE, FT_IMAGE };
typedef struct vms_symbol_struct