-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include cmm-sources
when linking shared objects
#7252
Merged
+113
−3
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# cabal v2-run | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- cmmexperiment-0 (lib) (first run) | ||
- cmmexperiment-0 (exe:demo) (first run) | ||
Configuring library for cmmexperiment-0.. | ||
Preprocessing library for cmmexperiment-0.. | ||
Building library for cmmexperiment-0.. | ||
Configuring executable 'demo' for cmmexperiment-0.. | ||
Warning: The package has an extraneous version range for a dependency on an internal library: cmmexperiment >=0 && ==0. This version range includes the current package but isn't needed as the current package's library will always be used. | ||
Preprocessing executable 'demo' for cmmexperiment-0.. | ||
Building executable 'demo' for cmmexperiment-0.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
packages: . | ||
executable-dynamic: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest $ do | ||
skipIfWindows | ||
res <- cabal' "v2-run" ["demo"] | ||
assertOutputContains "= Post common block elimination =" res | ||
assertOutputContains "In Box we have 0x" res |
6 changes: 6 additions & 0 deletions
6
cabal-testsuite/PackageTests/CmmSourcesDyn/cbits/HeapPrim.cmm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "Cmm.h" | ||
|
||
aToMyWordzh (P_ clos) | ||
{ | ||
return (clos); | ||
} |
27 changes: 27 additions & 0 deletions
27
cabal-testsuite/PackageTests/CmmSourcesDyn/cmmexperiment.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cabal-version: 3.0 | ||
name: cmmexperiment | ||
version: 0 | ||
build-type: Simple | ||
|
||
-- This code is extracted form ghc-heap | ||
-- Copyright (c) 2012-2013, Joachim Breitner | ||
-- (and probably -2020 GHC Team) | ||
-- Under BSD-3-Clause | ||
|
||
library | ||
default-language: Haskell2010 | ||
hs-source-dirs: src | ||
build-depends: base | ||
exposed-modules: Demo | ||
|
||
cmm-sources: cbits/HeapPrim.cmm | ||
if impl(ghc >=8.2) | ||
cmm-options: -ddump-cmm-verbose | ||
else | ||
cmm-options: -ddump-cmm | ||
|
||
executable demo | ||
default-language: Haskell2010 | ||
main-is: Main.hs | ||
hs-source-dirs: demo | ||
build-depends: base, cmmexperiment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module Main (main) where | ||
import Demo (main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Setup configure | ||
Configuring cmmexperiment-0... | ||
# Setup build | ||
Preprocessing library for cmmexperiment-0.. | ||
Building library for cmmexperiment-0.. | ||
Preprocessing executable 'demo' for cmmexperiment-0.. | ||
Building executable 'demo' for cmmexperiment-0.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = setupTest $ do | ||
skipIf "ghc < 7.8" =<< ghcVersionIs (< mkVersion [7,8]) | ||
setup "configure" [] | ||
res <- setup' "build" [] | ||
assertOutputContains "= Post common block elimination =" res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE ForeignFunctionInterface #-} | ||
{-# LANGUAGE GHCForeignImportPrim #-} | ||
{-# LANGUAGE MagicHash #-} | ||
{-# LANGUAGE UnliftedFFITypes #-} | ||
module Demo (main) where | ||
|
||
#include "MachDeps.h" | ||
|
||
import Data.Bits | ||
import GHC.Exts | ||
import Numeric (showHex) | ||
|
||
foreign import prim "aToMyWordzh" aToWord# :: Any -> Word# | ||
|
||
tAG_MASK :: Int | ||
tAG_MASK = (1 `shift` TAG_BITS) - 1 | ||
|
||
data Box = Box Any | ||
|
||
instance Show Box where | ||
showsPrec _ (Box a) rs = | ||
-- unsafePerformIO (print "↓" >> pClosure a) `seq` | ||
pad_out (showHex addr "") ++ (if tag>0 then "/" ++ show tag else "") ++ rs | ||
where | ||
ptr = W# (aToWord# a) | ||
tag = ptr .&. fromIntegral tAG_MASK -- ((1 `shiftL` TAG_BITS) -1) | ||
addr = ptr - tag | ||
pad_out ls = '0':'x':ls | ||
|
||
asBox :: a -> Box | ||
asBox x = Box (unsafeCoerce# x) | ||
|
||
main :: IO () | ||
main = do | ||
let box = asBox "foobar" | ||
putStrLn $ "In Box we have " ++ show box |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echoing @phadej's question:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand the question. Before the files weren't even passed the the linker, now they are. It is possible that these other files are also needed but this patch fixes the issue for cxxObjs, as claimed, and other files types are out-of-scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrasing as I understand it: Is this part of the "Include cmm-sources and asm-sources when linking shared objects" goal? If yes, why aren't cmmObjs and asmObjs included here too (as in cProfObjs/cSharedObjs)?
wasn't it cmm and asm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cObjs
contains all the objs you list as it is constructed from cLikeFiles (which contains asm, cmm, c etc).cabal/Cabal/src/Distribution/Simple/GHC.hs
Line 554 in 5f69122