* 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 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
#if VMS_DEBUG
-struct flagdescstruct { char *name; flagword value; };
+struct flagdescstruct { const char *name; flagword value; };
static const struct flagdescstruct gpsflagdesc[] =
{
{ "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 }
};
_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;
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.
test_len = 0;
else
{
+ int off = 0;
+
/* See _bfd_vms_get_first_record. */
test_len = 6;
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;
#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
}
else if (sec == (unsigned long)-1)
sym->section = &bfd_und_section;
-
+
return TRUE;
}
fab.fab$b_fac = FAB$M_PUT;
fab.fab$l_fop = FAB$M_ESC;
fab.fab$l_ctx = RME$C_SETRFM;
-
+
sys$open (&fab);
-
+
fab.fab$b_rfm = FAB$C_VAR;
-
+
sys$modify (&fab);
sys$close (&fab);
}
static long
vms_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, asection *section)
{
- return (section->reloc_count + 1) * sizeof (arelent *);
+ return (section->reloc_count + 1) * sizeof (arelent *);
}
/* Convert relocations from VMS (external) form into BFD internal
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;
+}
\f
const bfd_target vms_alpha_vec =
{
#define EOBJ_S_C_ETBT 13 /* EVAX Taceback information record. */
#define EOBJ_S_C_MAXRECTYP 13 /* EVAX Lst assigned record type. */
-#define OBJ_S_K_SUBTYP 1
-#define OBJ_S_C_SUBTYP 1
-#define EOBJ_S_K_SUBTYP 4
-#define EOBJ_S_C_SUBTYP 4
+#define OBJ_S_K_SUBTYP 1
+#define OBJ_S_C_SUBTYP 1
+#define EOBJ_S_K_SUBTYP 4
+#define EOBJ_S_C_SUBTYP 4
#define OBJ_S_C_MAXRECSIZ 2048 /* Maximu legal record size. */
#define EOBJ_S_C_MAXRECSIZ 8192 /* Maximu legal record size. */
#define OBJ_S_C_STRLVL 0 /* Structre level. */
#define EVAX_OFFSET 256 /* Type ofset for EVAX codes in switch. */
-/* Miscellaneous definitions. */
+/* Miscellaneous definitions. */
-#if __GNUC__
-typedef unsigned long long uquad;
-#else
-typedef unsigned long uquad;
-#endif
+#if __GNUC__
+typedef unsigned long long uquad;
+#else
+typedef unsigned long uquad;
+#endif
#define MAX_OUTREC_SIZE 4096
#define MIN_OUTREC_LUFT 64
-/* VMS module header. */
+/* VMS module header. */
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
#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
#define vms_section_data(sec) \
((struct vms_section_data_struct *)sec->used_by_bfd)
-
+
struct evax_private_udata_struct
{
asymbol *bsym;
};
#define SECTION_NAME_TEMPLATE "__SEC__%d"
-
-#if VMS_DEBUG
+
+#if VMS_DEBUG
extern void _bfd_vms_debug (int, char *, ...) ATTRIBUTE_PRINTF_2;
extern void _bfd_hexdump (int, unsigned char *, int, int);
#define vms_debug2(X) _bfd_vms_debug X
#else
#define vms_debug2(X)
-#endif
-
+#endif
+
extern struct bfd_hash_entry * _bfd_vms_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
extern void _bfd_vms_get_header_values (bfd *, unsigned char *, int *, int *);
extern int _bfd_vms_get_record (bfd *abf);