deb9af2d994cccee210195ee073cb8ea9fb20a5b
[ghc-hetmet.git] / ghc / rts / LinkerInternals.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 2000
4  *
5  * RTS Object Linker
6  *
7  * ---------------------------------------------------------------------------*/
8
9 typedef enum { OBJECT_LOADED, OBJECT_RESOLVED } OStatus;
10
11 /* Indication of section kinds for loaded objects.  Needed by
12    the GC for deciding whether or not a pointer on the stack
13    is a code pointer.
14 */
15 typedef 
16    enum { SECTIONKIND_CODE_OR_RODATA,
17           SECTIONKIND_RWDATA,
18           SECTIONKIND_OTHER,
19           SECTIONKIND_NOINFOAVAIL } 
20    SectionKind;
21
22 typedef 
23    struct _Section { 
24       void* start; 
25       void* end; 
26       SectionKind kind;
27       struct _Section* next;
28    } 
29    Section;
30
31 typedef 
32    struct _ProddableBlock {
33       void* start;
34       int   size;
35       struct _ProddableBlock* next;
36    }
37    ProddableBlock;
38
39 /* Top-level structure for an object module.  One of these is allocated
40  * for each object file in use.
41  */
42 typedef struct _ObjectCode {
43     OStatus    status;
44     char*      fileName;
45     int        fileSize;
46     char*      formatName;            /* eg "ELF32", "DLL", "COFF", etc. */
47
48     /* An array containing ptrs to all the symbol names copied from
49        this object into the global symbol hash table.  This is so that
50        we know which parts of the latter mapping to nuke when this
51        object is removed from the system. */
52     char**     symbols;
53     int        n_symbols;
54
55     /* ptr to malloc'd lump of memory holding the obj file */
56     void*      image;
57
58     /* The section-kind entries for this object module.  Linked
59        list. */
60     Section* sections;
61
62     /* A private hash table for local symbols. */
63     HashTable* lochash;
64     
65     /* Allow a chain of these things */
66     struct _ObjectCode * next;
67
68     /* SANITY CHECK ONLY: a list of the only memory regions which may
69        safely be prodded during relocation.  Any attempt to prod
70        outside one of these is an error in the linker. */
71     ProddableBlock* proddables;
72
73 #ifdef ia64_TARGET_ARCH
74     /* Procedure Linkage Table for this object */
75     void *plt;
76     unsigned int pltIndex;
77 #endif
78
79 #ifdef darwin_TARGET_OS
80     char*           jump_islands;
81     unsigned long   island_start_symbol;
82     unsigned long   n_islands;
83 #endif
84
85 } ObjectCode;
86
87 extern ObjectCode *objects;