summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorAlex Dzyoba <alex@dzyoba.com>2016-08-04 13:42:21 +0200
committerBen Gamari <ben@smart-cactus.org>2016-08-05 10:40:45 +0200
commite3e2e49a8f6952e1c8a19321c729c17b294d8c92 (patch)
tree154d6713a76098b6553516d26c8297213ad1133d /compiler/nativeGen
parentf09d65474ed042360999cb88221d65b07bfb4b5f (diff)
downloadhaskell-e3e2e49a8f6952e1c8a19321c729c17b294d8c92.tar.gz
codeGen: Remove binutils<2.17 hack, fixes T11758
There was a complication on the x86_64 platform, where pointers were 64 bits, but the tools didn't support 64-bit relative relocations. This was true before binutils 2.17, which nowadays is quite standart (even CentOs 5 is shipped with 2.17). Hacks were removed from x86 genSwitch and asm pretty printer. Also [x86-64-relative] note was dropped from includes/rts/storage/InfoTables.h as it's not referenced anywhere now. Reviewers: austin, simonmar, rwbarton, erikd, bgamari Reviewed By: simonmar, erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2426
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/X86/CodeGen.hs15
-rw-r--r--compiler/nativeGen/X86/Ppr.hs23
2 files changed, 3 insertions, 35 deletions
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index cd45d92418..2bfcd9a0c8 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -2624,23 +2624,10 @@ genSwitch dflags expr targets
let op = OpAddr (AddrBaseIndex (EABaseReg tableReg)
(EAIndex reg (wORD_SIZE dflags)) (ImmInt 0))
- return $ if is32bit || os == OSDarwin
- then e_code `appOL` t_code `appOL` toOL [
+ return $ e_code `appOL` t_code `appOL` toOL [
ADD (intFormat (wordWidth dflags)) op (OpReg tableReg),
JMP_TBL (OpReg tableReg) ids rosection lbl
]
- else -- HACK: On x86_64 binutils<2.17 is only able to generate
- -- PC32 relocations, hence we only get 32-bit offsets in
- -- the jump table. As these offsets are always negative
- -- we need to properly sign extend them to 64-bit. This
- -- hack should be removed in conjunction with the hack in
- -- PprMach.hs/pprDataItem once binutils 2.17 is standard.
- e_code `appOL` t_code `appOL` toOL [
- MOVSxL II32 op (OpReg reg),
- ADD (intFormat (wordWidth dflags)) (OpReg reg)
- (OpReg tableReg),
- JMP_TBL (OpReg tableReg) ids rosection lbl
- ]
| otherwise
= do
(reg,e_code) <- getSomeReg (cmmOffset dflags expr offset)
diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs
index 7809ae1df9..090ff53edf 100644
--- a/compiler/nativeGen/X86/Ppr.hs
+++ b/compiler/nativeGen/X86/Ppr.hs
@@ -454,27 +454,8 @@ pprDataItem' dflags lit
_ -> panic "X86.Ppr.ppr_item: no match for II64"
| otherwise ->
[text "\t.quad\t" <> pprImm imm]
- _
- | target32Bit platform ->
- [text "\t.quad\t" <> pprImm imm]
- | otherwise ->
- -- x86_64: binutils can't handle the R_X86_64_PC64
- -- relocation type, which means we can't do
- -- pc-relative 64-bit addresses. Fortunately we're
- -- assuming the small memory model, in which all such
- -- offsets will fit into 32 bits, so we have to stick
- -- to 32-bit offset fields and modify the RTS
- -- appropriately
- --
- -- See Note [x86-64-relative] in includes/rts/storage/InfoTables.h
- --
- case lit of
- -- A relative relocation:
- CmmLabelDiffOff _ _ _ ->
- [text "\t.long\t" <> pprImm imm,
- text "\t.long\t0"]
- _ ->
- [text "\t.quad\t" <> pprImm imm]
+
+ _ -> [text "\t.quad\t" <> pprImm imm]
ppr_item _ _
= panic "X86.Ppr.ppr_item: no match"