use ld.gold on ARMv7

see https://ghc.haskell.org/trac/ghc/ticket/8976
for workaround patches posted upstream by nomeata

remove some old leftover patches (fedpkg unused-patches)
epel9
Jens Petersen 10 years ago committed by Jens Petersen
parent 7a3899d9ad
commit 30d039255a

@ -1,11 +0,0 @@
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -927,7 +927,7 @@ void stmPreGCHook (Capability *cap) {
static volatile StgInt64 max_commits = 0;
#if defined(THREADED_RTS)
-static volatile StgBool token_locked = FALSE;
+static volatile StgWord token_locked = FALSE;
static void getTokenBatch(Capability *cap) {
while (cas((void *)&token_locked, FALSE, TRUE) == TRUE) { /* nothing */ }

@ -1,13 +0,0 @@
--- ghc-7.4.2/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs~ 2012-06-07 02:10:40.000000000 +0900
+++ ghc-7.4.2/libraries/Cabal/Cabal/Distribution/Simple/Setup.hs 2012-08-24 20:33:00.032123967 +0900
@@ -313,7 +313,7 @@
configDistPref = Flag defaultDistPref,
configVerbosity = Flag normal,
configUserInstall = Flag False, --TODO: reverse this
- configGHCiLib = Flag True,
+ configGHCiLib = Flag False,
configSplitObjs = Flag False, -- takes longer, so turn off by default
configStripExes = Flag True,
configTests = Flag False,
Diff finished. Fri Aug 24 20:33:10 2012

@ -1,37 +0,0 @@
From 08a38628f29df63ac842f4d083efb414f42d7bff Mon Sep 17 00:00:00 2001
From: "Edward Z. Yang" <ezyang@mit.edu>
Date: Tue, 9 Jul 2013 00:01:43 -0700
Subject: [PATCH] Disable executable stack for the linker note, fixing #703
(again)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
---
compiler/main/DriverPipeline.hs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 67377e6..26425ae 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1640,7 +1640,17 @@ mkNoteObjsToLinkIntoBinary dflags dep_packages = do
text elfSectionNote,
text "\n",
- text "\t.ascii \"", info', text "\"\n" ]
+ text "\t.ascii \"", info', text "\"\n",
+
+ -- ALL generated assembly must have this section to disable
+ -- executable stacks. See also
+ -- compiler/nativeGen/AsmCodeGen.lhs for another instance
+ -- where we need to do this.
+ (if platformHasGnuNonexecStack (targetPlatform dflags)
+ then text ".section .note.GNU-stack,\"\",@progbits\n"
+ else empty)
+
+ ]
where
info' = text $ escape info
--
1.8.1.2

@ -1,11 +0,0 @@
--- ghc-7.6.3/compiler/llvmGen/LlvmCodeGen/Base.hs~ 2013-04-19 06:22:46.000000000 +0900
+++ ghc-7.6.3/compiler/llvmGen/LlvmCodeGen/Base.hs 2013-07-24 17:05:06.491900335 +0900
@@ -151,7 +151,7 @@
minSupportLlvmVersion = 28
maxSupportLlvmVersion :: LlvmVersion
-maxSupportLlvmVersion = 31
+maxSupportLlvmVersion = 34
-- ----------------------------------------------------------------------------
-- * Environment Handling

@ -1,11 +0,0 @@
Index: rts/Adjustor.c
===================================================================
--- rts/Adjustor.c (revision c2870706b29c24ac86ae2a9e2359dd1e4af71ac8)
+++ rts/Adjustor.c (revision 27cf625ab871f34434d9fe86cecf85a31f73f0e5)
@@ -390,5 +390,5 @@
adjustorStub->call[0] = 0xe8;
- *(long*)&adjustorStub->call[1] = ((char*)&adjustorCode) - ((char*)adjustorStub + 5);
+ *(long*)&adjustorStub->call[1] = ((char*)&adjustorCode) - ((char*)code + 5);
adjustorStub->hptr = hptr;
adjustorStub->wptr = wptr;

@ -0,0 +1,17 @@
Patch by nomeata: https://ghc.haskell.org/trac/ghc/ticket/8976#comment:12
Index: ghc-7.8.3.20141119/aclocal.m4
===================================================================
--- ghc-7.8.3.20141119.orig/aclocal.m4 2014-12-08 18:49:28.207171714 +0100
+++ ghc-7.8.3.20141119/aclocal.m4 2014-12-08 19:03:06.815522917 +0100
@@ -553,6 +553,10 @@
$3="$$3 -D_HPUX_SOURCE"
$5="$$5 -D_HPUX_SOURCE"
;;
+ arm*)
+ # On arm, link using gold
+ $3="$$3 -fuse-ld=gold"
+ ;;
esac
# If gcc knows about the stack protector, turn it off.

@ -0,0 +1,78 @@
On ARM, we want to make sure that GHC uses the gold linker.
In order to achieve that, we need to get `-fuse-ld=gold` into
SettingsCCompilerLinkFlags in the settings.
This field is filled with only CONF_GCC_LINKER_OPTS_STAGE2. So we want that
flag to show up there.
But this variable is used in a few other cases (LDFLAGS, options to hsc2hs)
where -fuse-ld=gold caused problems.
(These problems were not investigated. Maybe _they_ could be solved?)
So as a work-around we remove any other use of CONF_GCC_LINKER_OPTS_STAGE2.
Index: ghc-7.8.3.20141119/libffi/ghc.mk
===================================================================
--- ghc-7.8.3.20141119.orig/libffi/ghc.mk 2014-04-07 20:26:08.000000000 +0200
+++ ghc-7.8.3.20141119/libffi/ghc.mk 2014-12-08 18:57:03.392339809 +0100
@@ -88,7 +88,7 @@
NM=$(NM) \
RANLIB=$(REAL_RANLIB_CMD) \
CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -w" \
- LDFLAGS="$(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE1) -w" \
+ LDFLAGS="$(SRC_LD_OPTS) -w" \
"$(SHELL)" ./configure \
--prefix=$(TOP)/libffi/build/inst \
--libdir=$(TOP)/libffi/build/inst/lib \
Index: ghc-7.8.3.20141119/mk/config.mk.in
===================================================================
--- ghc-7.8.3.20141119.orig/mk/config.mk.in 2014-12-08 18:49:28.215171926 +0100
+++ ghc-7.8.3.20141119/mk/config.mk.in 2014-12-08 18:57:20.637055726 +0100
@@ -570,7 +570,6 @@
# $1 = stage
SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(filter-out -O,$$(SRC_CC_OPTS) $$(CONF_CC_OPTS_STAGE$1)))
SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(CONF_CPP_OPTS_STAGE$1))
-SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --lflag=,$$(CONF_GCC_LINKER_OPTS_STAGE$1))
endef
$(eval $(call set_stage_HSC2HS_OPTS,0))
$(eval $(call set_stage_HSC2HS_OPTS,1))
Index: ghc-7.8.3.20141119/rules/build-package-data.mk
===================================================================
--- ghc-7.8.3.20141119.orig/rules/build-package-data.mk 2014-04-14 14:38:12.000000000 +0200
+++ ghc-7.8.3.20141119/rules/build-package-data.mk 2014-12-08 18:57:49.366250332 +0100
@@ -50,7 +50,7 @@
# for a feature it may not generate warning-free C code, and thus may
# think that the feature doesn't exist if -Werror is on.
$1_$2_CONFIGURE_CFLAGS = $$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS_STAGE$3) $$($1_CC_OPTS) $$($1_$2_CC_OPTS) $$(SRC_CC_WARNING_OPTS)
-$1_$2_CONFIGURE_LDFLAGS = $$(SRC_LD_OPTS) $$(CONF_GCC_LINKER_OPTS_STAGE$3) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)
+$1_$2_CONFIGURE_LDFLAGS = $$(SRC_LD_OPTS) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)
$1_$2_CONFIGURE_CPPFLAGS = $$(SRC_CPP_OPTS) $$(CONF_CPP_OPTS_STAGE$3) $$($1_CPP_OPTS) $$($1_$2_CPP_OPTS)
$1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$($1_$2_CONFIGURE_CFLAGS)"
Index: ghc-7.8.3.20141119/rules/distdir-opts.mk
===================================================================
--- ghc-7.8.3.20141119.orig/rules/distdir-opts.mk 2014-04-07 20:26:08.000000000 +0200
+++ ghc-7.8.3.20141119/rules/distdir-opts.mk 2014-12-08 18:58:18.435461083 +0100
@@ -64,7 +64,6 @@
endif
$1_$2_DIST_LD_OPTS = \
- $$(CONF_GCC_LINKER_OPTS_STAGE$3) \
$$(SRC_LD_OPTS) \
$$($1_LD_OPTS) \
$$($1_$2_LD_OPTS) \
Index: ghc-7.8.3.20141119/utils/hsc2hs/ghc.mk
===================================================================
--- ghc-7.8.3.20141119.orig/utils/hsc2hs/ghc.mk 2014-04-07 20:26:15.000000000 +0200
+++ ghc-7.8.3.20141119/utils/hsc2hs/ghc.mk 2014-12-08 18:57:07.848524715 +0100
@@ -27,7 +27,7 @@
# system uses it for all stages and passes the right options for each stage
# on the command line
define utils/hsc2hs_dist-install_SHELL_WRAPPER_EXTRA
-echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE1)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE1))"' >> "$(WRAPPER)"
+echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE1))"' >> "$(WRAPPER)"
endef
ifneq "$(BINDIST)" "YES"

@ -1,32 +0,0 @@
commit 08a38628f29df63ac842f4d083efb414f42d7bff
Author: Edward Z. Yang <ezyang@mit.edu>
Date: Tue Jul 9 00:01:43 2013 -0700
Disable executable stack for the linker note, fixing #703 (again)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Modified compiler/main/DriverPipeline.hs
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 67377e6..26425ae 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1640,7 +1640,17 @@ mkNoteObjsToLinkIntoBinary dflags dep_packages = do
text elfSectionNote,
text "\n",
- text "\t.ascii \"", info', text "\"\n" ]
+ text "\t.ascii \"", info', text "\"\n",
+
+ -- ALL generated assembly must have this section to disable
+ -- executable stacks. See also
+ -- compiler/nativeGen/AsmCodeGen.lhs for another instance
+ -- where we need to do this.
+ (if platformHasGnuNonexecStack (targetPlatform dflags)
+ then text ".section .note.GNU-stack,\"\",@progbits\n"
+ else empty)
+
+ ]
where
info' = text $ escape info

@ -1,46 +0,0 @@
commit db9b63105a541e4ad3f9c55e2cfadf716445ab87
Author: Geoffrey Mainland <gmainlan@microsoft.com>
Date: Wed Jun 12 14:31:49 2013 +0100
Avoid generating empty llvm.used definitions.
LLVM 3.3rc3 complains when the llvm.used global is an empty array, so don't
define llvm.used at all when it would be empty.
Modified compiler/llvmGen/LlvmCodeGen.hs
diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs
index a157a25..4f2bded 100644
--- a/compiler/llvmGen/LlvmCodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen.hs
@@ -117,19 +117,19 @@ cmmProcLlvmGens :: DynFlags -> BufHandle -> UniqSupply -> LlvmEnv -> [RawCmmDecl
-> [[LlvmVar]] -- ^ info tables that need to be marked as 'used'
-> IO ()
-cmmProcLlvmGens _ _ _ _ [] _ []
- = return ()
-
cmmProcLlvmGens dflags h _ _ [] _ ivars
- = let ivars' = concat ivars
- cast x = LMBitc (LMStaticPointer (pVarLift x)) i8Ptr
- ty = (LMArray (length ivars') i8Ptr)
- usedArray = LMStaticArray (map cast ivars') ty
- lmUsed = (LMGlobalVar (fsLit "llvm.used") ty Appending
- (Just $ fsLit "llvm.metadata") Nothing False, Just usedArray)
- in Prt.bufLeftRender h $ {-# SCC "llvm_used_ppr" #-}
- withPprStyleDoc dflags (mkCodeStyle CStyle) $
- pprLlvmData ([lmUsed], [])
+ | null ivars' = return ()
+ | otherwise = Prt.bufLeftRender h $
+ {-# SCC "llvm_used_ppr" #-}
+ withPprStyleDoc dflags (mkCodeStyle CStyle) $
+ pprLlvmData ([lmUsed], [])
+ where
+ ivars' = concat ivars
+ cast x = LMBitc (LMStaticPointer (pVarLift x)) i8Ptr
+ ty = (LMArray (length ivars') i8Ptr)
+ usedArray = LMStaticArray (map cast ivars') ty
+ lmUsed = (LMGlobalVar (fsLit "llvm.used") ty Appending
+ (Just $ fsLit "llvm.metadata") Nothing False, Just usedArray)
cmmProcLlvmGens dflags h us env ((CmmData _ _) : cmms) count ivars
= cmmProcLlvmGens dflags h us env cmms count ivars

@ -43,10 +43,6 @@ Source4: ghc-doc-index
Patch1: ghc-gen_contents_index-haddock-path.patch
# add libffi include dir to ghc wrapper for archs using gcc/llc
#Patch10: ghc-wrapper-libffi-include.patch
# stop warnings about unsupported version of llvm
# NB: value affects ABI hash of libHSghc!
# will probably be needed again for llvm-3.5
#Patch14: ghc-7.6.3-LlvmCodeGen-llvm-version-warning.patch
# unversion library html docdirs
Patch16: ghc-cabal-unversion-docdir.patch
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
@ -55,6 +51,8 @@ Patch20: ghc-glibc-2.20_BSD_SOURCE.patch
Patch21: ghc-arm64.patch
Patch22: ghc-armv7-VFPv3D16--NEON.patch
Patch23: ghc-7.8.3-Cabal-install-PATH-warning.patch
Patch24: ghc-7.8-arm7-use-ld-gold-8976.patch
Patch25: ghc-7.8-arm7_saner-linker-opt-handling-9873.patch
%global Cabal_ver 1.18.1.5
%global array_ver 0.5.0.0
@ -125,7 +123,7 @@ BuildRequires: python
BuildRequires: llvm34
%endif
%ifarch armv7hl aarch64
# patch22
# patch22 and patch24
BuildRequires: autoconf, automake
%endif
Requires: ghc-compiler = %{version}-%{release}
@ -265,10 +263,6 @@ rm -r libffi-tarballs
#%%patch10 -p1 -b .10-ffi
%endif
%ifarch armv7hl armv5tel
#%%patch14 -p1 -b .orig
%endif
# unversion pkgdoc htmldir
%if 0%{?fedora} >= 21
%patch16 -p1 -b .orig
@ -282,6 +276,8 @@ rm -r libffi-tarballs
%ifarch armv7hl
%patch22 -p1 -b .orig
%patch24 -p1 -b .24~
%patch25 -p1 -b .25~
%endif
%patch23 -p1 -b .orig
@ -561,6 +557,8 @@ fi
- provides haskeline, terminfo and xhtml libraries
- shared libraries on all archs
- bindir/ghci only on ghc_arches_with_ghci
- use ld.gold on ARMv7 (see https://ghc.haskell.org/trac/ghc/ticket/8976)
[thanks to nomeata for workaround patches posted upstream]
* Tue Nov 18 2014 Jens Petersen <petersen@redhat.com> - 7.6.3-28
- remove the build hack to switch from llvm to llvm34 (#1161049)

Loading…
Cancel
Save