|
| 1 | +diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal |
| 2 | +index c633124..2bd51c0 100644 |
| 3 | +--- a/libraries/ghc-prim/ghc-prim.cabal |
| 4 | ++++ b/libraries/ghc-prim/ghc-prim.cabal |
| 5 | +@@ -70,7 +70,7 @@ Library |
| 6 | + if os(linux) |
| 7 | + -- we need libm, but for musl and other's we might need libc, as libm |
| 8 | + -- is just an empty shell. |
| 9 | +- extra-libraries: c, m |
| 10 | ++ extra-libraries: gcc, c, m |
| 11 | + |
| 12 | + c-sources: |
| 13 | + cbits/atomic.c |
| 14 | +diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c |
| 15 | +index 9ca696c..b4a85e5 100644 |
| 16 | +--- a/rts/RtsSymbols.c |
| 17 | ++++ b/rts/RtsSymbols.c |
| 18 | +@@ -1000,6 +1000,18 @@ |
| 19 | + #define RTS_LIBGCC_SYMBOLS |
| 20 | + #endif |
| 21 | + |
| 22 | ++ |
| 23 | ++#if !defined(DYNAMIC) && defined(linux_HOST_OS) |
| 24 | ++// we need these for static musl builds. However when |
| 25 | ++// linking shared objects (DLLs) this will fail, hence |
| 26 | ++// we do not include them when building with -DDYNAMIC |
| 27 | ++#define RTS_LINKER_SYMBOLS \ |
| 28 | ++ SymI_NeedsProto(__fini_array_start) \ |
| 29 | ++ SymI_NeedsProto(__fini_array_end) |
| 30 | ++#else |
| 31 | ++#define RTS_LINKER_SYMBOLS |
| 32 | ++#endif |
| 33 | ++ |
| 34 | + /* entirely bogus claims about types of these symbols */ |
| 35 | + #define SymI_NeedsProto(vvv) extern void vvv(void); |
| 36 | + #define SymI_NeedsDataProto(vvv) extern StgWord vvv[]; |
| 37 | +@@ -1028,6 +1040,7 @@ RTS_DARWIN_ONLY_SYMBOLS |
| 38 | + RTS_OPENBSD_ONLY_SYMBOLS |
| 39 | + RTS_LIBGCC_SYMBOLS |
| 40 | + RTS_LIBFFI_SYMBOLS |
| 41 | ++RTS_LINKER_SYMBOLS |
| 42 | + #undef SymI_NeedsProto |
| 43 | + #undef SymI_NeedsDataProto |
| 44 | + #undef SymI_HasProto |
| 45 | +@@ -1068,6 +1081,8 @@ RTS_LIBFFI_SYMBOLS |
| 46 | + #define SymI_HasProto_deprecated(vvv) \ |
| 47 | + { #vvv, (void*)0xBAADF00D, true }, |
| 48 | + |
| 49 | ++void *RTS_DYNAMIC = NULL; |
| 50 | ++ |
| 51 | + RtsSymbolVal rtsSyms[] = { |
| 52 | + RTS_SYMBOLS |
| 53 | + RTS_RET_SYMBOLS |
| 54 | +@@ -1078,6 +1093,7 @@ RtsSymbolVal rtsSyms[] = { |
| 55 | + RTS_OPENBSD_ONLY_SYMBOLS |
| 56 | + RTS_LIBGCC_SYMBOLS |
| 57 | + RTS_LIBFFI_SYMBOLS |
| 58 | ++ RTS_LINKER_SYMBOLS |
| 59 | + SymI_HasDataProto(nonmoving_write_barrier_enabled) |
| 60 | + #if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH) |
| 61 | + // dyld stub code contains references to this, |
| 62 | +@@ -1085,5 +1101,6 @@ RtsSymbolVal rtsSyms[] = { |
| 63 | + // lazy pointers as nonlazy. |
| 64 | + { "dyld_stub_binding_helper", (void*)0xDEADBEEF, false }, |
| 65 | + #endif |
| 66 | ++ { "_DYNAMIC", (void*)(&RTS_DYNAMIC), false }, |
| 67 | + { 0, 0, false } /* sentinel */ |
| 68 | + }; |
0 commit comments