[project @ 2001-02-28 10:03:42 by sewardj]
[ghc-hetmet.git] / ghc / rts / LinkerInternals.h
1 /* -----------------------------------------------------------------------------
2  * $Id: LinkerInternals.h,v 1.3 2001/02/28 10:03:42 sewardj 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 enum { SECTIONKIND_CODE_OR_RODATA,
17                SECTIONKIND_RWDATA,
18                SECTIONKIND_OTHER,
19                SECTIONKIND_NOINFOAVAIL } 
20    SectionKind;
21
22 typedef struct { void* start; void* end; SectionKind kind; } 
23    Section;
24
25 /* Top-level structure for an object module.  One of these is allocated
26  * for each object file in use.
27  */
28 typedef struct _ObjectCode {
29     OStatus    status;
30     char*      fileName;
31     int        fileSize;
32     char*      formatName;            /* eg "ELF32", "DLL", "COFF", etc. */
33
34     /* An array containing ptrs to all the symbol names copied from
35        this object into the global symbol hash table.  This is so that
36        we know which parts of the latter mapping to nuke when this
37        object is removed from the system. */
38     char**     symbols;
39     int        n_symbols;
40
41     /* ptr to malloc'd lump of memory holding the obj file */
42     void*      image;
43
44     /* The section-kind entries for this object module.  Dynamically expands. */
45     Section*   sections;
46     int        n_sections;
47
48     /* A private hash table for local symbols. */
49     HashTable* lochash;
50     
51     /* Allow a chain of these things */
52     struct _ObjectCode * next;
53 } ObjectCode;
54
55 extern ObjectCode *objects;