X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FLinker.c;h=bbfdc370b6dac62c5daf40890ce2981b6cdc78b7;hb=ee3e75b51e5a86dda79bb990a83bfaa49915a22a;hp=ac91c61e21930d7308064df3e7edfb403bf5d22f;hpb=6cc1e7810b99d785361bb100d7e7b365f71580e7;p=ghc-hetmet.git diff --git a/ghc/rts/Linker.c b/ghc/rts/Linker.c index ac91c61..bbfdc37 100644 --- a/ghc/rts/Linker.c +++ b/ghc/rts/Linker.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Linker.c,v 1.11 2001/01/19 17:31:24 simonmar Exp $ + * $Id: Linker.c,v 1.15 2001/01/29 17:23:41 simonmar Exp $ * * (c) The GHC Team, 2000 * @@ -13,6 +13,7 @@ #include "Hash.h" #include "Linker.h" #include "RtsUtils.h" +#include "StoragePriv.h" #ifdef HAVE_SYS_TYPES_H #include @@ -25,9 +26,15 @@ #ifdef HAVE_DLFCN_H #include #endif - + #ifdef GHCI /* endif is right at end of file */ +#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) || defined(freebsd_TARGET_OS) +#define OBJFORMAT_ELF +#elif defined(cygwin32_TARGET_OS) || defined (mingw32_TARGET_OS) +#define OBJFORMAT_PEi386 +#endif + /* A bucket in the symbol hash-table. Primarily, maps symbol names to * absolute addresses. All symbols from a given module are linked * together, so they can be freed at the same time. There's also a @@ -83,11 +90,11 @@ typedef struct _ObjectCode { /* List of currently loaded objects */ ObjectCode *objects; -#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) +#if defined(OBJFORMAT_ELF) static int ocVerifyImage_ELF ( ObjectCode* oc ); static int ocGetNames_ELF ( ObjectCode* oc ); static int ocResolve_ELF ( ObjectCode* oc ); -#elif defined(cygwin32_TARGET_OS) +#elif defined(OBJFORMAT_PEi386) static int ocVerifyImage_PEi386 ( ObjectCode* oc ); static int ocGetNames_PEi386 ( ObjectCode* oc ); static int ocResolve_PEi386 ( ObjectCode* oc ); @@ -132,6 +139,9 @@ static int ocResolve_PEi386 ( ObjectCode* oc ); SymX(stg_sel_10_upd_info) \ SymX(stg_sel_11_upd_info) \ SymX(stg_sel_12_upd_info) \ + SymX(stg_sel_13_upd_info) \ + SymX(stg_sel_14_upd_info) \ + SymX(stg_sel_15_upd_info) \ SymX(stg_upd_frame_info) \ SymX(stg_seq_frame_info) \ SymX(stg_CAF_BLACKHOLE_info) \ @@ -141,7 +151,6 @@ static int ocResolve_PEi386 ( ObjectCode* oc ); SymX(stg_WEAK_info) \ SymX(stg_CHARLIKE_closure) \ SymX(stg_INTLIKE_closure) \ - SymX(stg_CAF_UNENTERED_entry) \ SymX(newCAF) \ SymX(newBCOzh_fast) \ SymX(mkApUpd0zh_fast) \ @@ -200,6 +209,7 @@ static int ocResolve_PEi386 ( ObjectCode* oc ); SymX(__int_encodeFloat) \ SymX(__int_encodeDouble) \ SymX(__gmpz_cmp_si) \ + SymX(__gmpz_cmp_ui) \ SymX(__gmpz_cmp) \ SymX(__gmpn_gcd_1) \ SymX(prog_argv) \ @@ -224,7 +234,16 @@ static int ocResolve_PEi386 ( ObjectCode* oc ); SymX(PatErrorHdrHook) \ SymX(defaultsHook) \ SymX(PreTraceHook) \ - SymX(PostTraceHook) + SymX(PostTraceHook) \ + SymX(stg_sig_install) \ + Sym(nocldstop) \ + SymX(createAdjustor) \ + SymX(rts_mkInt) \ + SymX(rts_mkStablePtr) \ + SymX(rts_apply) \ + SymX(rts_evalIO) \ + SymX(rts_checkSchedStatus) \ + SymX(rts_getInt) #ifndef SUPPORT_LONG_LONGS #define RTS_LONG_LONG_SYMS /* nothing */ @@ -352,9 +371,9 @@ loadObj( char *path ) oc = stgMallocBytes(sizeof(ObjectCode), "loadObj(oc)"); -# if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) +# if defined(OBJFORMAT_ELF) oc->formatName = "ELF"; -# elif defined(cygwin32_TARGET_OS) +# elif defined(OBJFORMAT_PEi386) oc->formatName = "PEi386"; # else free(oc); @@ -386,9 +405,9 @@ loadObj( char *path ) } /* verify the in-memory image */ -# if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) +# if defined(OBJFORMAT_ELF) r = ocVerifyImage_ELF ( oc ); -# elif defined(cygwin32_TARGET_OS) +# elif defined(OBJFORMAT_PEi386) r = ocVerifyImage_PEi386 ( oc ); # else barf("loadObj: no verify method"); @@ -396,9 +415,9 @@ loadObj( char *path ) if (!r) { return r; } /* build the symbol list for this image */ -# if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) +# if defined(OBJFORMAT_ELF) r = ocGetNames_ELF ( oc ); -# elif defined(cygwin32_TARGET_OS) +# elif defined(OBJFORMAT_PEi386) r = ocGetNames_PEi386 ( oc ); # else barf("loadObj: no getNames method"); @@ -424,9 +443,9 @@ resolveObjs( void ) for (oc = objects; oc; oc = oc->next) { if (oc->status != OBJECT_RESOLVED) { -# if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) +# if defined(OBJFORMAT_ELF) r = ocResolve_ELF ( oc ); -# elif defined(cygwin32_TARGET_OS) +# elif defined(OBJFORMAT_PEi386) r = ocResolve_PEi386 ( oc ); # else barf("link: not implemented on this platform"); @@ -474,7 +493,7 @@ unloadObj( char *path ) } /* -------------------------------------------------------------------------- - * PEi386 specifics (cygwin32) + * PEi386 specifics (Win32 targets) * ------------------------------------------------------------------------*/ /* The information for this linker comes from @@ -485,7 +504,7 @@ unloadObj( char *path ) */ -#if defined(cygwin32_TARGET_OS) +#if defined(OBJFORMAT_PEi386) @@ -1099,14 +1118,14 @@ ocResolve_PEi386 ( ObjectCode* oc, int verb ) return TRUE; } -#endif /* defined(cygwin32_TARGET_OS) */ +#endif /* defined(OBJFORMAT_PEi386) */ /* -------------------------------------------------------------------------- - * ELF specifics (Linux, Solaris) + * ELF specifics * ------------------------------------------------------------------------*/ -#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) +#if defined(OBJFORMAT_ELF) #define FALSE 0 #define TRUE 1 @@ -1466,7 +1485,7 @@ ocResolve_ELF ( ObjectCode* oc ) } -#endif /* defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) */ +#endif /* ELF */ /* ----------------------------------------------------------------------------- * Look up an address to discover whether it is in text or data space. @@ -1491,7 +1510,7 @@ lookupSection ( void* addr ) } int -is_dynamically_loaded_code_or_rodata_ptr ( char* p ) +is_dynamically_loaded_code_or_rodata_ptr ( void* p ) { SectionKind sk = lookupSection(p); ASSERT (sk != SECTIONKIND_NOINFOAVAIL); @@ -1500,7 +1519,7 @@ is_dynamically_loaded_code_or_rodata_ptr ( char* p ) int -is_dynamically_loaded_rwdata_ptr ( char* p ) +is_dynamically_loaded_rwdata_ptr ( void* p ) { SectionKind sk = lookupSection(p); ASSERT (sk != SECTIONKIND_NOINFOAVAIL); @@ -1509,7 +1528,7 @@ is_dynamically_loaded_rwdata_ptr ( char* p ) int -is_not_dynamically_loaded_ptr ( char* p ) +is_not_dynamically_loaded_ptr ( void* p ) { SectionKind sk = lookupSection(p); ASSERT (sk != SECTIONKIND_NOINFOAVAIL);