[Git][ghc/ghc][master] Drop a kludge for binutils<2.17, which is now over 10 years old.

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Nov 1 16:47:36 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d45d8cb3 by M Farkas-Dyck at 2022-11-01T12:47:21-04:00
Drop a kludge for binutils<2.17, which is now over 10 years old.

- - - - -


2 changed files:

- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs


Changes:

=====================================
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


=====================================
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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d45d8cb3d9bce11729b840bc96ec4616f559809e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d45d8cb3d9bce11729b840bc96ec4616f559809e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221101/80025b9c/attachment-0001.html>


More information about the ghc-commits mailing list