LinkerInternals.h 2.33 KB
Newer Older
1
/* -----------------------------------------------------------------------------
2
 * $Id: LinkerInternals.h,v 1.7 2003/10/08 09:42:35 wolfgang Exp $
3 4 5 6 7 8 9 10 11 12 13 14 15
 *
 * (c) The GHC Team, 2000
 *
 * RTS Object Linker
 *
 * ---------------------------------------------------------------------------*/

typedef enum { OBJECT_LOADED, OBJECT_RESOLVED } OStatus;

/* Indication of section kinds for loaded objects.  Needed by
   the GC for deciding whether or not a pointer on the stack
   is a code pointer.
*/
16 17 18 19 20
typedef 
   enum { SECTIONKIND_CODE_OR_RODATA,
          SECTIONKIND_RWDATA,
          SECTIONKIND_OTHER,
          SECTIONKIND_NOINFOAVAIL } 
21 22
   SectionKind;

23 24 25 26 27 28 29
typedef 
   struct _Section { 
      void* start; 
      void* end; 
      SectionKind kind;
      struct _Section* next;
   } 
30 31
   Section;

32 33 34 35 36 37 38 39
typedef 
   struct _ProddableBlock {
      void* start;
      int   size;
      struct _ProddableBlock* next;
   }
   ProddableBlock;

40 41 42 43
/* Top-level structure for an object module.  One of these is allocated
 * for each object file in use.
 */
typedef struct _ObjectCode {
44 45 46 47
    OStatus    status;
    char*      fileName;
    int        fileSize;
    char*      formatName;            /* eg "ELF32", "DLL", "COFF", etc. */
48

49 50 51 52 53
    /* An array containing ptrs to all the symbol names copied from
       this object into the global symbol hash table.  This is so that
       we know which parts of the latter mapping to nuke when this
       object is removed from the system. */
    char**     symbols;
54
    int        n_symbols;
55 56

    /* ptr to malloc'd lump of memory holding the obj file */
57
    void*      image;
58

59 60 61
    /* The section-kind entries for this object module.  Linked
       list. */
    Section* sections;
62 63 64

    /* A private hash table for local symbols. */
    HashTable* lochash;
65 66 67
    
    /* Allow a chain of these things */
    struct _ObjectCode * next;
68 69 70 71 72

    /* SANITY CHECK ONLY: a list of the only memory regions which may
       safely be prodded during relocation.  Any attempt to prod
       outside one of these is an error in the linker. */
    ProddableBlock* proddables;
73 74 75 76 77 78 79

#ifdef ia64_TARGET_ARCH
    /* Procedure Linkage Table for this object */
    void *plt;
    unsigned int pltIndex;
#endif

80 81 82 83 84 85
#ifdef darwin_TARGET_OS
    char*           jump_islands;
    unsigned long   island_start_symbol;
    unsigned long   n_islands;
#endif

86 87 88
} ObjectCode;

extern ObjectCode *objects;