/* Alpha VMS external format of Libraries.
- Copyright 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 Free Software Foundation, Inc.
Written by Tristan Gingold <gingold@adacore.com>, AdaCore.
This file is part of BFD, the Binary File Descriptor library.
/* Libray HeaDer. */
+/* Magic numbers. Should match the major version. */
+
#define LHD_SANEID_DCX 319232342
#define LHD_SANEID3 233579905
-#define LHD_SANEID4 233579911
+#define LHD_SANEID6 233579911
/* Library type. */
#define LBR__C_TYP_UNK 0 /* Unknown / unspecified. */
#define LBR__C_TYP_EOBJ 7 /* Alpha object. */
#define LBR__C_TYP_ESHSTB 8 /* Alpha shareable image. */
#define LBR__C_TYP_IOBJ 9 /* IA-64 object. */
+#define LBR__C_TYP_ISHSTB 10 /* IA-64 shareable image. */
struct vms_lhd
{
unsigned char nextvbn[4];
/* Free pre-allocated index block. */
+ /* Number of free blocks. */
unsigned char freidxblk[4];
+ /* VBN of a simply linked list of free blocks. The list is terminated by a
+ nul VBN. */
unsigned char freeidx[4];
/* Highest pre-allocated index block and in use. */
unsigned char fill_4[4 * 13];
};
+/* Known major ids. */
+#define LBR_MAJORID 3 /* Alpha libraries. */
+#define LBR_ELFMAJORID 6 /* Elf libraries (new index, new data). */
+
/* Offset of the first IDD. */
#define LHD_IDXDESC 196
unsigned char parent[4];
unsigned char fill_1[6];
+
+ /* The key field contains vms_idx/vms_elfidx structures, which are
+ simply a key (= a string) and a rfa. */
unsigned char keys[INDEXDEF__BLKSIZ];
};
-/* Index keys. */
-struct vms_idxdef
+/* An offset in a file. */
+
+struct vms_rfa
{
+ /* Logical block number, 1 based.
+ 0 means that the field is absent. Block size is 512. */
unsigned char vbn[4];
+
+ /* Offset within the block. */
unsigned char offset[2];
+};
+
+/* Index keys. For version 3. */
+
+struct vms_idx
+{
+ /* Offset from the start of the vbn, so minimum should be
+ DATA__DATA (ie 6). */
+ struct vms_rfa rfa;
unsigned char keylen;
+ /* The length of this field is in fact keylen. */
unsigned char keyname[256];
};
-struct vms_idxdef2
-{
- unsigned char vbn[4];
+/* Index keys, for version 4 and later. */
- /* Offset from the start of the vbn, so minimum should be
- DATA__DATA (ie 6). */
- unsigned char offset[2];
+struct vms_elfidx
+{
+ struct vms_rfa rfa;
unsigned char keylen[2];
- unsigned char fill_1;
+ unsigned char flags;
unsigned char keyname[256];
};
+/* Flags of elfidx. */
+
+#define ELFIDX__WEAK 0x01 /* Weak symbol. */
+#define ELFIDX__GROUP 0x02 /* Group symbol. */
+#define ELFIDX__LISTRFA 0x04 /* RFA field points to an LHS. */
+#define ELFIDX__SYMESC 0x08 /* Long symbol. */
+
#define RFADEF__C_INDEX 0xffff
+/* List head structure. That's what is pointed by rfa when LISTRFA flag
+ is set in elfidx. */
+
+struct vms_lhs
+{
+ struct vms_rfa ng_g_rfa; /* Non-group global. */
+ struct vms_rfa ng_wk_rfa; /* Non-group weak. */
+ struct vms_rfa g_g_rfa; /* Group global. */
+ struct vms_rfa g_wk_rfa; /* Group weak. */
+ unsigned char flags;
+};
+
+/* List node structure. Fields of LHS point to this structure. */
+
+struct vms_lns
+{
+ /* Next node in the list. */
+ struct vms_rfa nxtrfa;
+
+ /* Module associated with the key. */
+ struct vms_rfa modrfa;
+};
+
struct vms_datadef
{
/* Number of records in this block. */
#define DATA__LENGTH 512
#define DATA__DATA 6
+/* Key name block. This is used for keys longer than 128 bytes. */
+
+struct vms_kbn
+{
+ /* Length of the key chunk. */
+ unsigned char keylen[2];
+
+ /* RFA of the next chunk. */
+ struct vms_rfa rfa;
+
+ /* Followed by the key chunk. */
+};
+
/* Module header. */
struct vms_mhd
{
/* Ident or GSMATCH. */
unsigned char objidlng;
unsigned char objid[31];
+
+ unsigned char pad1[3];
+ unsigned char otherefcnt[4];
+ unsigned char modsize[4];
+ unsigned char pad2[4];
};
#define MHD__C_MHDID 0xad /* Value for id. */
+#define MHD__C_MHDLEN 16 /* Fixed part length. */
#define MHD__C_USRDAT 16
-#define MHD__M_SELSRC 0x1
+
+/* Flags for objstat. */
+#define MHD__M_SELSRC 0x1 /* Selective search. */
#define MHD__M_OBJTIR 0x2
#define MHD__M_WKSYM 0x4