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