1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 2000
7 * ---------------------------------------------------------------------------*/
9 #ifndef LINKERINTERNALS_H
10 #define LINKERINTERNALS_H
12 typedef enum { OBJECT_LOADED, OBJECT_RESOLVED } OStatus;
14 /* Indication of section kinds for loaded objects. Needed by
15 the GC for deciding whether or not a pointer on the stack
19 enum { SECTIONKIND_CODE_OR_RODATA,
22 SECTIONKIND_NOINFOAVAIL }
30 struct _Section* next;
35 struct _ProddableBlock {
38 struct _ProddableBlock* next;
42 /* Jump Islands are sniplets of machine code required for relative
43 * address relocations on the PowerPC.
46 #ifdef powerpc_HOST_ARCH
48 short lis_r12, hi_addr;
49 short ori_r12_r12, lo_addr;
53 #elif x86_64_HOST_ARCH
55 uint8_t jumpIsland[6];
59 /* Top-level structure for an object module. One of these is allocated
60 * for each object file in use.
62 typedef struct _ObjectCode {
66 char* formatName; /* eg "ELF32", "DLL", "COFF", etc. */
68 /* If this object is a member of an archive, archiveMemberName is
69 * like "libarchive.a(object.o)". Otherwise it's NULL.
71 char* archiveMemberName;
73 /* An array containing ptrs to all the symbol names copied from
74 this object into the global symbol hash table. This is so that
75 we know which parts of the latter mapping to nuke when this
76 object is removed from the system. */
80 /* ptr to malloc'd lump of memory holding the obj file */
84 /* record by how much image has been deliberately misaligned
85 after allocation, so that we can use realloc */
89 /* The section-kind entries for this object module. Linked
93 /* Allow a chain of these things */
94 struct _ObjectCode * next;
96 /* SANITY CHECK ONLY: a list of the only memory regions which may
97 safely be prodded during relocation. Any attempt to prod
98 outside one of these is an error in the linker. */
99 ProddableBlock* proddables;
101 #ifdef ia64_HOST_ARCH
102 /* Procedure Linkage Table for this object */
104 unsigned int pltIndex;
107 #if powerpc_HOST_ARCH || x86_64_HOST_ARCH
108 SymbolExtra *symbol_extras;
109 unsigned long first_symbol_extra;
110 unsigned long n_symbol_extras;
115 #define OC_INFORMATIVE_FILENAME(OC) \
116 ( (OC)->archiveMemberName ? \
117 (OC)->archiveMemberName : \
121 extern ObjectCode *objects;
123 void exitLinker( void );
125 #endif /* LINKERINTERNALS_H */