Commit c3446c63 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

Shuffle declarations into LinkerInternals.h

Summary: These will be needed across source files shortly.

Test Plan: Validate

Reviewers: erikd, austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2647
parent 3f051262
......@@ -91,24 +91,6 @@
#include <sys/tls.h>
#endif
/* SymbolInfo tracks a symbol's address, the object code from which
it originated, and whether or not it's weak.
RtsSymbolInfo is used to track the state of the symbols currently
loaded or to be loaded by the Linker.
Where the information in the `ObjectCode` is used to track the
original status of the symbol inside the `ObjectCode`.
A weak symbol that has been used will still be marked as weak
in the `ObjectCode` but in the `RtsSymbolInfo` it won't be.
*/
typedef struct _RtsSymbolInfo {
SymbolAddr* value;
ObjectCode *owner;
HsBool weak;
} RtsSymbolInfo;
/* `symhash` is a Hash table mapping symbol names to RtsSymbolInfo.
This hashtable will contain information on all symbols
that we know of, however the .o they are in may not be loaded.
......@@ -206,9 +188,6 @@ Mutex linker_mutex;
Mutex linker_unloaded_mutex;
#endif
/* Type of the initializer */
typedef void (*init_t) (int argc, char **argv, char **env);
static HsInt isAlreadyLoaded( pathchar *path );
static HsInt loadOc( ObjectCode* oc );
static ObjectCode* mkOc( pathchar *path, char *image, int imageSize,
......@@ -307,8 +286,6 @@ typedef DLL_DIRECTORY_COOKIE(WINAPI *LPAddDLLDirectory)(PCWSTR NewDirectory);
typedef WINBOOL(WINAPI *LPRemoveDLLDirectory)(DLL_DIRECTORY_COOKIE Cookie);
#endif /* OBJFORMAT_PEi386 */
static void freeProddableBlocks (ObjectCode *oc);
/* on x86_64 we have a problem with relocating symbol references in
* code that was compiled without -fPIC. By default, the small memory
* model is used, which assumes that symbol references can fit in a
......@@ -2606,7 +2583,7 @@ HsInt purgeObj (pathchar *path)
* which may be prodded during relocation, and abort if we try and write
* outside any of these.
*/
static void
void
addProddableBlock ( ObjectCode* oc, void* start, int size )
{
ProddableBlock* pb
......@@ -2620,7 +2597,7 @@ addProddableBlock ( ObjectCode* oc, void* start, int size )
oc->proddables = pb;
}
static void
void
checkProddableBlock (ObjectCode *oc, void *addr, size_t size )
{
ProddableBlock* pb;
......@@ -2634,7 +2611,7 @@ checkProddableBlock (ObjectCode *oc, void *addr, size_t size )
barf("checkProddableBlock: invalid fixup in runtime linker: %p", addr);
}
static void freeProddableBlocks (ObjectCode *oc)
void freeProddableBlocks (ObjectCode *oc)
{
ProddableBlock *pb, *next;
......@@ -2648,7 +2625,7 @@ static void freeProddableBlocks (ObjectCode *oc)
/* -----------------------------------------------------------------------------
* Section management.
*/
static void
void
addSection (Section *s, SectionKind kind, SectionAlloc alloc,
void* start, StgWord size, StgWord mapped_offset,
void* mapped_start, StgWord mapped_size)
......
......@@ -14,6 +14,9 @@
#include "BeginPrivate.h"
typedef void SymbolAddr;
typedef char SymbolName;
/* See Linker.c Note [runtime-linker-phases] */
typedef enum {
OBJECT_LOADED,
......@@ -182,12 +185,41 @@ extern Mutex linker_mutex;
extern Mutex linker_unloaded_mutex;
#endif
/* Type of the initializer */
typedef void (*init_t) (int argc, char **argv, char **env);
/* SymbolInfo tracks a symbol's address, the object code from which
it originated, and whether or not it's weak.
RtsSymbolInfo is used to track the state of the symbols currently
loaded or to be loaded by the Linker.
Where the information in the `ObjectCode` is used to track the
original status of the symbol inside the `ObjectCode`.
A weak symbol that has been used will still be marked as weak
in the `ObjectCode` but in the `RtsSymbolInfo` it won't be.
*/
typedef struct _RtsSymbolInfo {
SymbolAddr* value;
ObjectCode *owner;
HsBool weak;
} RtsSymbolInfo;
void exitLinker( void );
void freeObjectCode (ObjectCode *oc);
void *mmapForLinker (size_t bytes, uint32_t flags, int fd, int offset);
void addProddableBlock ( ObjectCode* oc, void* start, int size );
void checkProddableBlock (ObjectCode *oc, void *addr, size_t size );
void freeProddableBlocks (ObjectCode *oc);
void addSection (Section *s, SectionKind kind, SectionAlloc alloc,
void* start, StgWord size, StgWord mapped_offset,
void* mapped_start, StgWord mapped_size);
#if defined(mingw32_HOST_OS)
typedef unsigned char UChar;
......
......@@ -10,6 +10,7 @@
#define RTS_SYMBOLS_H
#include "ghcautoconf.h"
#include "LinkerInternals.h"
#ifdef LEADING_UNDERSCORE
#define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s)
......@@ -17,9 +18,6 @@
#define MAYBE_LEADING_UNDERSCORE_STR(s) (s)
#endif
typedef char SymbolName;
typedef void SymbolAddr;
typedef struct _RtsSymbolVal {
const SymbolName* lbl;
SymbolAddr* addr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment