summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorM Farkas-Dyck <strake888@proton.me>2022-08-15 11:42:18 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-01 12:47:21 -0400
commitd45d8cb3d9bce11729b840bc96ec4616f559809e (patch)
treefe0d75bc395d12f9d471e1dfb5d84f759bdd32c9 /compiler/GHC
parent270037faa124bf59dda8ba4f3d73b97d4c109a5f (diff)
downloadhaskell-d45d8cb3d9bce11729b840bc96ec4616f559809e.tar.gz
Drop a kludge for binutils<2.17, which is now over 10 years old.
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/CmmToAsm/X86/CodeGen.hs17
-rw-r--r--compiler/GHC/CmmToAsm/X86/Ppr.hs24
2 files changed, 2 insertions, 39 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
index fd85ae6154..564822e3e3 100644
--- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
@@ -2928,25 +2928,10 @@ genSwitch expr targets = do
let op = OpAddr (AddrBaseIndex (EABaseReg tableReg)
(EAIndex reg (platformWordSizeInBytes platform)) (ImmInt 0))
- offsetReg <- getNewRegNat (intFormat (platformWordWidth platform))
- return $ if is32bit || os == OSDarwin
- then e_code `appOL` t_code `appOL` toOL [
+ return $ e_code `appOL` t_code `appOL` toOL [
ADD (intFormat (platformWordWidth platform)) 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 offsetReg),
- ADD (intFormat (platformWordWidth platform))
- (OpReg offsetReg)
- (OpReg tableReg),
- JMP_TBL (OpReg tableReg) ids rosection lbl
- ]
else do
(reg,e_code) <- getSomeReg indexExpr
lbl <- getNewLabelNat
diff --git a/compiler/GHC/CmmToAsm/X86/Ppr.hs b/compiler/GHC/CmmToAsm/X86/Ppr.hs
index 0b19665857..6c16160ce8 100644
--- a/compiler/GHC/CmmToAsm/X86/Ppr.hs
+++ b/compiler/GHC/CmmToAsm/X86/Ppr.hs
@@ -532,29 +532,7 @@ pprDataItem config lit
<> int (fromIntegral
(fromIntegral (x `shiftR` 32) :: Word32))]
_ -> panic "X86.Ppr.ppr_item: no match for II64"
- | otherwise ->
- [text "\t.quad\t" <> pprImm platform imm]
- _
- | target32Bit platform ->
- [text "\t.quad\t" <> pprImm platform 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 rts/include/rts/storage/InfoTables.h
- --
- case lit of
- -- A relative relocation:
- CmmLabelDiffOff _ _ _ _ ->
- [text "\t.long\t" <> pprImm platform imm,
- text "\t.long\t0"]
- _ ->
- [text "\t.quad\t" <> pprImm platform imm]
+ _ -> [text "\t.quad\t" <> pprImm platform imm]
asmComment :: SDoc -> SDoc