summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Nowicki-Korgol <myszon@fb.com>2019-11-03 10:12:56 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-11-08 05:37:34 -0500
commita46313352280d6c28ee505e0f63ade11077ef7c6 (patch)
treed1e7c77f32bfdde123021268c2d45677b2052ab3
parent9db2e905f974f6b6dae74cb5157c497e056d24f2 (diff)
downloadhaskell-a46313352280d6c28ee505e0f63ade11077ef7c6.tar.gz
Set correct length of DWARF .debug_aranges section (fixes #17428)
-rw-r--r--compiler/nativeGen/Dwarf/Types.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs
index 9066b3ebef..9386117386 100644
--- a/compiler/nativeGen/Dwarf/Types.hs
+++ b/compiler/nativeGen/Dwarf/Types.hs
@@ -230,7 +230,8 @@ pprDwarfARanges arngs unitU = sdocWithPlatform $ \plat ->
-- entry is 8 bytes (32-bit platform) or 16 bytes (64-bit platform).
-- pad such that first entry begins at multiple of entry size.
pad n = vcat $ replicate n $ pprByte 0
- initialLength = 8 + paddingSize + 2*2*wordSize
+ -- Fix for #17428
+ initialLength = 8 + paddingSize + (1 + length arngs) * 2 * wordSize
in pprDwWord (ppr initialLength)
$$ pprHalf 2
$$ sectionOffset (ppr $ mkAsmTempLabel $ unitU)