summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-07-21 13:07:00 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-27 21:35:55 -0400
commitcddafcf6a968f454aebc4dd65aa64bf42870b6e9 (patch)
tree658b28c5e8e8e44d67d10b518d3064c03f163d22
parent9da20e3de5513ccccf8144c69f5e63dd4eaae6f4 (diff)
downloadhaskell-cddafcf6a968f454aebc4dd65aa64bf42870b6e9.tar.gz
PIC: test for cross-module references
-rw-r--r--compiler/GHC/CmmToAsm/PIC.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/GHC/CmmToAsm/PIC.hs b/compiler/GHC/CmmToAsm/PIC.hs
index 81ce9d34a9..10ddaa1f5f 100644
--- a/compiler/GHC/CmmToAsm/PIC.hs
+++ b/compiler/GHC/CmmToAsm/PIC.hs
@@ -285,14 +285,11 @@ howToAccessLabel config arch OSDarwin DataReference lbl
-- when generating PIC code, all cross-module data references must
-- must go via a symbol pointer, too, because the assembler
-- cannot generate code for a label difference where one
- -- label is undefined. Doesn't apply t x86_64.
- -- Unfortunately, we don't know whether it's cross-module,
- -- so we do it for all externally visible labels.
- -- This is a slight waste of time and space, but otherwise
- -- we'd need to pass the current Module all the way in to
- -- this function.
+ -- label is undefined. Doesn't apply to x86_64 (why?).
| arch /= ArchX86_64
- , ncgPIC config && externallyVisibleCLabel lbl
+ , not (isLocalCLabel (ncgThisModule config) lbl)
+ , ncgPIC config
+ , externallyVisibleCLabel lbl
= AccessViaSymbolPtr
| otherwise