#95747: fix build of GHC 8.10.2

This commit is contained in:
Domen Kožar 2020-08-18 15:56:34 +02:00
parent a19e16756b
commit f9b57fd66a
No known key found for this signature in database
GPG key ID: C2FFBCAFD2C24246
2 changed files with 301 additions and 0 deletions

View file

@ -107,6 +107,11 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "doc" ];
# https://gitlab.haskell.org/ghc/ghc/-/issues/18549
patches = [
./issue-18549.patch
];
postPatch = "patchShebangs .";
# GHC is a bit confused on its cross terminology.

View file

@ -0,0 +1,296 @@
From fac083e7ac8a37b61a4082bbbca2848e52fd1bb2 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Sun, 9 Aug 2020 09:15:16 -0400
Subject: [PATCH] Revert "[linker/rtsSymbols] More linker symbols"
This reverts commit aa2e5863699306920513b216f337de09e29b5bb8.
---
rts/RtsSymbols.c | 224 ++++-------------------------------------------
1 file changed, 17 insertions(+), 207 deletions(-)
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index d10a6900db..b2f90a892d 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -58,6 +58,7 @@
SymI_HasProto(signal_handlers) \
SymI_HasProto(stg_sig_install) \
SymI_HasProto(rtsTimerSignal) \
+ SymI_HasProto(atexit) \
SymI_NeedsDataProto(nocldstop)
#endif
@@ -976,213 +977,29 @@
RTS_USER_SIGNALS_SYMBOLS \
RTS_INTCHAR_SYMBOLS
+
// 64-bit support functions in libgcc.a
-// See https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc
-#define RTS_LIBGCC_SYMBOLS_32 \
- SymI_NeedsProto(__fixunsdfdi) \
- /* 4 The GCC low-level runtime library */\
- /* 4.1.1 Arithmetic functions */\
- /* SymI_NeedsProto(__ashlsi3) */\
- SymI_NeedsProto(__ashldi3) \
- /* SymI_NeedsProto(__ashlti3) */\
- /* These functions return the result of shifting a left by b bits. */\
- /* SymI_NeedsProto(__ashrsi3) */\
- SymI_NeedsProto(__ashrdi3) \
- /* SymI_NeedsProto(__ashrti3) */\
- /* These functions return the result of arithmetically shifting a right by b bits. */\
- /* SymI_NeedsProto(__divsi3) */\
- SymI_NeedsProto(__divdi3) \
- /* SymI_NeedsProto(__divti3) */\
- /* These functions return the quotient of the signed division of a and b. */\
- /* SymI_NeedsProto(__lshrsi3) */ \
- SymI_NeedsProto(__lshrdi3) \
- /* SymI_NeedsProto(__lshrti3) */ \
- /* These functions return the result of logically shifting a right by b bits. */\
- /* SymI_NeedsProto(__modsi3) */ \
- SymI_NeedsProto(__moddi3) \
- /* SymI_NeedsProto(__modti3) */ \
- /* These functions return the remainder of the signed division of a and b. */\
- /* SymI_NeedsProto(__mulsi3) */ \
- SymI_NeedsProto(__muldi3) \
- /* SymI_NeedsProto(__multi3) */ \
- /* These functions return the product of a and b. */\
- SymI_NeedsProto(__negdi2) \
- /* SymI_NeedsProto(__negti2) */ \
- /* These functions return the negation of a. */\
- /* SymI_NeedsProto(__udivsi3) */ \
- SymI_NeedsProto(__udivdi3) \
- /* SymI_NeedsProto(__udivti3) */ \
- /* These functions return the quotient of the unsigned division of a and b. */\
- SymI_NeedsProto(__udivmoddi4) \
- /* SymI_NeedsProto(__udivmodti4) */ \
- /* These functions calculate both the quotient and remainder of the unsigned division of a and b. The return value is the quotient, and the remainder is placed in variable pointed to by c. */\
- /* SymI_NeedsProto(__umodsi3) */ \
- SymI_NeedsProto(__umoddi3) \
- /* SymI_NeedsProto(__umodti3) */ \
- /* These functions return the remainder of the unsigned division of a and b. */\
- /* 4.1.2 Comparison functions */\
- /* The following functions implement integral comparisons. These functions implement a low-level compare, upon which the higher level comparison operators (such as less than and greater than or equal to) can be constructed. The returned values lie in the range zero to two, to allow the high-level operators to be implemented by testing the returned result using either signed or unsigned comparison. */\
- SymI_NeedsProto(__cmpdi2) \
- /* SymI_NeedsProto(__cmpti2) */ \
- /* These functions perform a signed comparison of a and b. If a is less than b, they return 0; if a is greater than b, they return 2; and if a and b are equal they return 1. */\
- SymI_NeedsProto(__ucmpdi2) \
- /* SymI_NeedsProto(__ucmpti2) */ \
- /* These functions perform an unsigned comparison of a and b. If a is less than b, they return 0; if a is greater than b, they return 2; and if a and b are equal they return 1. */\
- /* 4.1.3 Trapping arithmetic functions */\
- /* The following functions implement trapping arithmetic. These functions call the libc function abort upon signed arithmetic overflow. */\
- SymI_NeedsProto(__absvsi2) \
- SymI_NeedsProto(__absvdi2) \
- /* These functions return the absolute value of a. */\
- /* SymI_NeedsProto(__addvsi3) */ \
- SymI_NeedsProto(__addvdi3) \
- /* These functions return the sum of a and b; that is a + b. */\
- /* SymI_NeedsProto(__mulvsi3) */ \
- SymI_NeedsProto(__mulvdi3) \
- /* The functions return the product of a and b; that is a * b. */\
- SymI_NeedsProto(__negvsi2) \
- SymI_NeedsProto(__negvdi2) \
- /* These functions return the negation of a; that is -a. */\
- /* SymI_NeedsProto(__subvsi3) */ \
- SymI_NeedsProto(__subvdi3) \
- /* These functions return the difference between b and a; that is a - b. */\
- /* 4.1.4 Bit operations */\
- SymI_NeedsProto(__clzsi2) \
- SymI_NeedsProto(__clzdi2) \
- /* SymI_NeedsProto(__clzti2) */ \
- /* These functions return the number of leading 0-bits in a, starting at the most significant bit position. If a is zero, the result is undefined. */\
- SymI_NeedsProto(__ctzsi2) \
- SymI_NeedsProto(__ctzdi2) \
- /* SymI_NeedsProto(__ctzti2) */ \
- /* These functions return the number of trailing 0-bits in a, starting at the least significant bit position. If a is zero, the result is undefined. */\
- SymI_NeedsProto(__ffsdi2) \
- /* SymI_NeedsProto(__ffsti2) */ \
- /* These functions return the index of the least significant 1-bit in a, or the value zero if a is zero. The least significant bit is index one. */\
- SymI_NeedsProto(__paritysi2) \
- SymI_NeedsProto(__paritydi2) \
- /* SymI_NeedsProto(__parityti2) */\
- /* These functions return the value zero if the number of bits set in a is even, and the value one otherwise. */\
- SymI_NeedsProto(__popcountsi2) \
- SymI_NeedsProto(__popcountdi2) \
- /* SymI_NeedsProto(__popcountti2) */ \
- /* These functions return the number of bits set in a. */\
- SymI_NeedsProto(__bswapsi2) \
- SymI_NeedsProto(__bswapdi2)
-#define RTS_LIBGCC_SYMBOLS_aarch32 \
- /* armv6l */\
- /* TODO: should check for __ARM_EABI__ */\
- SymI_NeedsProto(__aeabi_d2f) \
- SymI_NeedsProto(__aeabi_d2iz) \
- SymI_NeedsProto(__aeabi_d2lz) \
- SymI_NeedsProto(__aeabi_d2uiz) \
- SymI_NeedsProto(__aeabi_d2ulz) \
- SymI_NeedsProto(__aeabi_dadd) \
- SymI_NeedsProto(__aeabi_dcmpeq) \
- SymI_NeedsProto(__aeabi_dcmpge) \
- SymI_NeedsProto(__aeabi_dcmpgt) \
- SymI_NeedsProto(__aeabi_dcmple) \
- SymI_NeedsProto(__aeabi_dcmplt) \
- SymI_NeedsProto(__aeabi_dcmpun) \
- SymI_NeedsProto(__aeabi_ddiv) \
- SymI_NeedsProto(__aeabi_dmul) \
- SymI_NeedsProto(__aeabi_dneg) \
- SymI_NeedsProto(__aeabi_dsub) \
- SymI_NeedsProto(__aeabi_f2d) \
- SymI_NeedsProto(__aeabi_f2iz) \
- SymI_NeedsProto(__aeabi_f2lz) \
- SymI_NeedsProto(__aeabi_f2uiz) \
- SymI_NeedsProto(__aeabi_f2ulz) \
- SymI_NeedsProto(__aeabi_fadd) \
- SymI_NeedsProto(__aeabi_fcmpeq) \
- SymI_NeedsProto(__aeabi_fcmpge) \
- SymI_NeedsProto(__aeabi_fcmpgt) \
- SymI_NeedsProto(__aeabi_fcmple) \
- SymI_NeedsProto(__aeabi_fcmplt) \
- SymI_NeedsProto(__aeabi_fcmpun) \
- SymI_NeedsProto(__aeabi_fdiv) \
- SymI_NeedsProto(__aeabi_fmul) \
- SymI_NeedsProto(__aeabi_fneg) \
- SymI_NeedsProto(__aeabi_fsub) \
- SymI_NeedsProto(__aeabi_i2d) \
- SymI_NeedsProto(__aeabi_i2f) \
- SymI_NeedsProto(__aeabi_idiv) \
- SymI_NeedsProto(__aeabi_idivmod) \
- SymI_NeedsProto(__aeabi_l2d) \
- SymI_NeedsProto(__aeabi_l2f) \
- SymI_NeedsProto(__aeabi_lasr) \
- SymI_NeedsProto(__aeabi_lcmp) \
- SymI_NeedsProto(__aeabi_ldivmod) \
- SymI_NeedsProto(__aeabi_llsl) \
- SymI_NeedsProto(__aeabi_llsr) \
- SymI_NeedsProto(__aeabi_lmul) \
- SymI_NeedsProto(__aeabi_ui2d) \
- SymI_NeedsProto(__aeabi_ui2f) \
- SymI_NeedsProto(__aeabi_uidiv) \
- SymI_NeedsProto(__aeabi_uidivmod) \
- SymI_NeedsProto(__aeabi_ul2d) \
- SymI_NeedsProto(__aeabi_ul2f) \
- SymI_NeedsProto(__aeabi_ulcmp) \
- SymI_NeedsProto(__aeabi_uldivmod)
-#define RTS_LIBGCC_SYMBOLS_64 \
+#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
+#define RTS_LIBGCC_SYMBOLS \
+ SymI_NeedsProto(__divdi3) \
+ SymI_NeedsProto(__udivdi3) \
+ SymI_NeedsProto(__moddi3) \
+ SymI_NeedsProto(__umoddi3) \
+ SymI_NeedsProto(__muldi3) \
+ SymI_NeedsProto(__ashldi3) \
+ SymI_NeedsProto(__ashrdi3) \
+ SymI_NeedsProto(__lshrdi3) \
+ SymI_NeedsProto(__fixunsdfdi)
+#elif defined(__GNUC__) && SIZEOF_VOID_P == 8
+#define RTS_LIBGCC_SYMBOLS \
SymI_NeedsProto(__udivti3) \
SymI_NeedsProto(__umodti3)
-
-/* for aarch64 */
-#define RTS_LIBGCC_SYMBOLS_aarch64 \
- SymI_NeedsProto(__netf2) \
- SymI_NeedsProto(__addtf3) \
- SymI_NeedsProto(__subtf3) \
- SymI_NeedsProto(__multf3) \
- SymI_NeedsProto(__extenddftf2) \
- SymI_NeedsProto(__fixtfsi) \
- SymI_NeedsProto(__fixunstfsi) \
- SymI_NeedsProto(__floatsitf) \
- SymI_NeedsProto(__floatunsitf)
-
-#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && defined(arm_HOST_OS)
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_32 RTS_LIBGCC_SYMBOLS_aarch32
-#elif defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_32
-#elif defined(__GNUC__) && SIZEOF_VOID_P == 8 && defined(aarch64_HOST_OS)
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_64 RTS_LIBGCC_SYMBOLS_aarch64
-#elif defined(__GNUC__) && SIZEOF_VOID_P == 8
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_64
#else
#define RTS_LIBGCC_SYMBOLS
#endif
-#if !defined(mingw32_HOST_OS) && !defined(DYNAMIC) && (defined(_FORTIFY_SOURCE) || defined(__SSP__))
-#define RTS_SSP_SYMBOLS \
- SymI_NeedsProto(__stack_chk_guard) \
- SymI_NeedsProto(__stack_chk_fail)
-#else
-#define RTS_SSP_SYMBOLS
-#endif
-#if !defined(DYNAMIC) && defined(linux_HOST_OS)
-// we need these for static musl builds. However when
-// linking shared objects (DLLs) this will fail, hence
-// we do not include them when building with -DDYNAMIC
-#define RTS_LINKER_SYMBOLS \
- SymI_NeedsProto(__fini_array_start) \
- SymI_NeedsProto(__fini_array_end)
-#else
-#define RTS_LINKER_SYMBOLS
-#endif
-
-#if defined(darwin_HOST_OS) && defined(powerpc_HOST_ARCH)
- // Symbols that don't have a leading underscore
- // on Mac OS X. They have to receive special treatment,
- // see machoInitSymbolsWithoutUnderscore()
-#define RTS_MACHO_NOUNDERLINE_SYMBOLS \
- SymI_NeedsProto(saveFP) \
- SymI_NeedsProto(restFP)
-#endif
-
/* entirely bogus claims about types of these symbols */
-/* to prevent a bit of define expansion, SymI_NeedsProto is a variadic
- * macro. And we'll concat vvv with the __VA_ARGS__. This prevents
- * vvv from getting macro expanded.
- */
-#define SymI_NeedsProto(vvv,...) extern void vvv ## __VA_ARGS__ (void);
+#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);
@@ -1209,8 +1026,6 @@ RTS_DARWIN_ONLY_SYMBOLS
RTS_OPENBSD_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_LIBFFI_SYMBOLS
-RTS_SSP_SYMBOLS
-RTS_LINKER_SYMBOLS
#undef SymI_NeedsProto
#undef SymI_NeedsDataProto
#undef SymI_HasProto
@@ -1230,7 +1045,7 @@ RTS_LINKER_SYMBOLS
#define SymE_HasDataProto(vvv) \
SymE_HasProto(vvv)
-#define SymI_NeedsProto(vvv,...) SymI_HasProto(vvv ## __VA_ARGS__)
+#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)
@@ -1251,8 +1066,6 @@ RTS_LINKER_SYMBOLS
#define SymI_HasProto_deprecated(vvv) \
{ #vvv, (void*)0xBAADF00D, true },
-void *RTS_DYNAMIC = NULL;
-
RtsSymbolVal rtsSyms[] = {
RTS_SYMBOLS
RTS_RET_SYMBOLS
@@ -1264,14 +1077,11 @@ RtsSymbolVal rtsSyms[] = {
RTS_LIBGCC_SYMBOLS
RTS_LIBFFI_SYMBOLS
SymI_HasDataProto(nonmoving_write_barrier_enabled)
- RTS_SSP_SYMBOLS
- RTS_LINKER_SYMBOLS
#if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
// dyld stub code contains references to this,
// but it should never be called because we treat
// lazy pointers as nonlazy.
{ "dyld_stub_binding_helper", (void*)0xDEADBEEF, false },
#endif
- { "_DYNAMIC", (void*)(&RTS_DYNAMIC), false },
{ 0, 0, false } /* sentinel */
};
--
2.25.4