aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog14
-rw-r--r--bfd/vms-gsd.c4
-rw-r--r--bfd/vms-hdr.c2
-rw-r--r--bfd/vms-misc.c12
-rw-r--r--bfd/vms.c27
-rw-r--r--bfd/vms.h49
6 files changed, 79 insertions, 29 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f8b2e68..ce2c0c6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index ba75bbf4..d0ffd78 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -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 }
};
diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c
index 49e6809..4ac5b97 100644
--- a/bfd/vms-hdr.c
+++ b/bfd/vms-hdr.c
@@ -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;
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index 2181658..47e5985 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -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;
diff --git a/bfd/vms.c b/bfd/vms.c
index a2886dd..176705e 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -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
@@ -195,7 +194,7 @@ fill_section_ptr (struct bfd_hash_entry *entry, void *sections)
}
else if (sec == (unsigned long)-1)
sym->section = &bfd_und_section;
-
+
return TRUE;
}
@@ -516,11 +515,11 @@ vms_convert_to_var (char *vms_filename)
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);
}
@@ -972,7 +971,7 @@ vms_slurp_reloc_table (bfd *abfd, asection *section, asymbol **symbols)
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
@@ -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 =
{
diff --git a/bfd/vms.h b/bfd/vms.h
index 4bde72b..8733e4f 100644
--- a/bfd/vms.h
+++ b/bfd/vms.h
@@ -544,10 +544,10 @@ extern int _bfd_vms_decode_relocs
#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. */
@@ -562,18 +562,18 @@ extern int _bfd_vms_decode_relocs
#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
{
@@ -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
@@ -840,7 +853,7 @@ struct vms_section_data_struct
#define vms_section_data(sec) \
((struct vms_section_data_struct *)sec->used_by_bfd)
-
+
struct evax_private_udata_struct
{
asymbol *bsym;
@@ -850,8 +863,8 @@ struct evax_private_udata_struct
};
#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);
@@ -859,8 +872,8 @@ 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);