[commit: ghc] ghc-7.10: rts/Linker.c: distinct between DATA and CODE labels when importing (623e203)
git at git.haskell.org
git at git.haskell.org
Tue Apr 7 14:28:53 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-7.10
Link : http://ghc.haskell.org/trac/ghc/changeset/623e2033d0caf18c363526fb5c3fffed1785c75f/ghc
>---------------------------------------------------------------
commit 623e2033d0caf18c363526fb5c3fffed1785c75f
Author: Sergei Trofimovich <siarheit at google.com>
Date: Tue Apr 7 09:08:37 2015 -0500
rts/Linker.c: distinct between DATA and CODE labels when importing
The patch is a last major piece to make unregisterised GHC build
under GCC's link-time optimizer.
Before the patch we imported everything external as functions.
Now we distinct between global variables and functions.
The difference is crucial on ia64 and a complement to fixes:
> d82f592522eb8e063276a8a8c87ab93e18353c6b
> CMM: add a mechanism to import C .data labels
> e18525fae273f4c1ad8d6cbe1dea4fc074cac721
> pprC: declare extern cmm primitives as functions, not data
Signed-off-by: Sergei Trofimovich <siarheit at google.com>
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D797
(cherry picked from commit ab76b0990e9f7d20bde403be38935f9d16491806)
>---------------------------------------------------------------
623e2033d0caf18c363526fb5c3fffed1785c75f
rts/Linker.c | 60 ++++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 42 insertions(+), 18 deletions(-)
diff --git a/rts/Linker.c b/rts/Linker.c
index 0bd2aa8..5b30b84 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -365,7 +365,7 @@ typedef struct _RtsSymbolVal {
SymI_HasProto(stg_sig_install) \
SymI_HasProto(rtsTimerSignal) \
SymI_HasProto(atexit) \
- SymI_NeedsProto(nocldstop)
+ SymI_NeedsDataProto(nocldstop)
#endif
#if defined (cygwin32_HOST_OS)
@@ -890,18 +890,18 @@ typedef struct _RtsSymbolVal {
#define RTS_LIBFFI_SYMBOLS \
SymE_NeedsProto(ffi_prep_cif) \
SymE_NeedsProto(ffi_call) \
- SymE_NeedsProto(ffi_type_void) \
- SymE_NeedsProto(ffi_type_float) \
- SymE_NeedsProto(ffi_type_double) \
- SymE_NeedsProto(ffi_type_sint64) \
- SymE_NeedsProto(ffi_type_uint64) \
- SymE_NeedsProto(ffi_type_sint32) \
- SymE_NeedsProto(ffi_type_uint32) \
- SymE_NeedsProto(ffi_type_sint16) \
- SymE_NeedsProto(ffi_type_uint16) \
- SymE_NeedsProto(ffi_type_sint8) \
- SymE_NeedsProto(ffi_type_uint8) \
- SymE_NeedsProto(ffi_type_pointer)
+ SymE_NeedsDataProto(ffi_type_void) \
+ SymE_NeedsDataProto(ffi_type_float) \
+ SymE_NeedsDataProto(ffi_type_double) \
+ SymE_NeedsDataProto(ffi_type_sint64) \
+ SymE_NeedsDataProto(ffi_type_uint64) \
+ SymE_NeedsDataProto(ffi_type_sint32) \
+ SymE_NeedsDataProto(ffi_type_uint32) \
+ SymE_NeedsDataProto(ffi_type_sint16) \
+ SymE_NeedsDataProto(ffi_type_uint16) \
+ SymE_NeedsDataProto(ffi_type_sint8) \
+ SymE_NeedsDataProto(ffi_type_uint8) \
+ SymE_NeedsDataProto(ffi_type_pointer)
#ifdef TABLES_NEXT_TO_CODE
#define RTS_RET_SYMBOLS /* nothing */
@@ -931,8 +931,8 @@ typedef struct _RtsSymbolVal {
/* Modules compiled with -ticky may mention ticky counters */
/* This list should marry up with the one in $(TOP)/includes/stg/Ticky.h */
#define RTS_TICKY_SYMBOLS \
- SymI_NeedsProto(ticky_entry_ctrs) \
- SymI_NeedsProto(top_ct) \
+ SymI_NeedsDataProto(ticky_entry_ctrs) \
+ SymI_NeedsDataProto(top_ct) \
\
SymI_HasProto(ENT_VIA_NODE_ctr) \
SymI_HasProto(ENT_STATIC_THK_SINGLE_ctr) \
@@ -1410,9 +1410,9 @@ typedef struct _RtsSymbolVal {
SymI_HasProto(getAllocations) \
SymI_HasProto(revertCAFs) \
SymI_HasProto(RtsFlags) \
- SymI_NeedsProto(rts_breakpoint_io_action) \
- SymI_NeedsProto(rts_stop_next_breakpoint) \
- SymI_NeedsProto(rts_stop_on_exception) \
+ SymI_NeedsDataProto(rts_breakpoint_io_action) \
+ SymI_NeedsDataProto(rts_stop_next_breakpoint) \
+ SymI_NeedsDataProto(rts_stop_on_exception) \
SymI_HasProto(stopTimer) \
SymI_HasProto(n_capabilities) \
SymI_HasProto(enabled_capabilities) \
@@ -1462,15 +1462,19 @@ typedef struct _RtsSymbolVal {
/* entirely bogus claims about types of these symbols */
#define SymI_NeedsProto(vvv) extern void vvv(void);
+#define SymI_NeedsDataProto(vvv) extern StgWord vvv[];
#if defined(COMPILING_WINDOWS_DLL)
#define SymE_HasProto(vvv) SymE_HasProto(vvv);
# if defined(x86_64_HOST_ARCH)
# define SymE_NeedsProto(vvv) extern void __imp_ ## vvv (void);
+# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
# else
# define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void);
+# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
# endif
#else
#define SymE_NeedsProto(vvv) SymI_NeedsProto(vvv);
+#define SymE_NeedsDataProto(vvv) SymI_NeedsDataProto(vvv);
#define SymE_HasProto(vvv) SymI_HasProto(vvv)
#endif
#define SymI_HasProto(vvv) /**/
@@ -1484,10 +1488,13 @@ RTS_DARWIN_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_LIBFFI_SYMBOLS
#undef SymI_NeedsProto
+#undef SymI_NeedsDataProto
#undef SymI_HasProto
#undef SymI_HasProto_redirect
#undef SymE_HasProto
+#undef SymE_HasDataProto
#undef SymE_NeedsProto
+#undef SymE_NeedsDataProto
#ifdef LEADING_UNDERSCORE
#define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s)
@@ -1497,11 +1504,17 @@ RTS_LIBFFI_SYMBOLS
#define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
(void*)(&(vvv)) },
+#define SymI_HasDataProto(vvv) \
+ SymI_HasProto(vvv)
#define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
(void*)DLL_IMPORT_DATA_REF(vvv) },
+#define SymE_HasDataProto(vvv) \
+ SymE_HasProto(vvv)
#define SymI_NeedsProto(vvv) SymI_HasProto(vvv)
+#define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv)
#define SymE_NeedsProto(vvv) SymE_HasProto(vvv)
+#define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv)
// SymI_HasProto_redirect allows us to redirect references to one symbol to
// another symbol. See newCAF/newDynCAF for an example.
@@ -7343,20 +7356,31 @@ machoInitSymbolsWithoutUnderscore(void)
__asm__ volatile(".globl _symbolsWithoutUnderscore\n.data\n_symbolsWithoutUnderscore:");
#undef SymI_NeedsProto
+#undef SymI_NeedsDataProto
+
#define SymI_NeedsProto(x) \
__asm__ volatile(".long " # x);
+#define SymI_NeedsDataProto(x) \
+ SymI_NeedsProto(x)
+
RTS_MACHO_NOUNDERLINE_SYMBOLS
__asm__ volatile(".text");
#undef SymI_NeedsProto
+#undef SymI_NeedsDataProto
+
#define SymI_NeedsProto(x) \
ghciInsertSymbolTable("(GHCi built-in symbols)", symhash, #x, *p++, HS_BOOL_FALSE, NULL);
+#define SymI_NeedsDataProto(x) \
+ SymI_NeedsProto(x)
+
RTS_MACHO_NOUNDERLINE_SYMBOLS
#undef SymI_NeedsProto
+#undef SymI_NeedsDataProto
}
#endif
More information about the ghc-commits
mailing list