Skip to content
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
merged 2 commits into from
Apr 14, 2021

Conversation

mpickering
Copy link
Collaborator

Fixes #7182

Patch is by @bgamari, I have just rebased it on master as requested by @phadej in #7183


Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog (add file to changelog.d directory).
  • The documentation has been updated, if necessary.

Please also shortly describe how you tested your change. Bonus points for added tests!

Previously we neglected to include such objects.

Fixes haskell#7182.
@fgaz fgaz requested a review from phadej January 20, 2021 10:05
Essentially just copying the existing CmmSources test but building with
`--enable-executable-dynamic`
@mpickering
Copy link
Collaborator Author

Anyone fancy merging this patch?

@bgamari
Copy link
Contributor

bgamari commented Mar 25, 2021

This should also end up in the 3.6 branch.

Comment on lines -1368 to +1370
ghcOptRPaths = rpaths
ghcOptRPaths = rpaths,
ghcOptInputFiles = toNubListR
[tmpDir </> x | x <- cObjs ++ cxxObjs]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echoing @phadej's question:

This change is something else? We don't need cmmObjs nor asmObjs however?

Copy link
Collaborator Author

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.

Copy link
Member

@fgaz fgaz Mar 29, 2021

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.

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)?

this patch fixes the issue for cxxObjs

wasn't it cmm and asm?

Copy link
Collaborator Author

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).

let cLikeFiles = fromNubListR $ mconcat

@phadej
Copy link
Collaborator

phadej commented Mar 30, 2021

The confusion steps from having lines

      cObjs       = map (`replaceExtension` objExtension) cLikeFiles 

and

      cObjs               = map (`replaceExtension` objExtension) cSrcs

Rename the first to cLikeObjs (and all other related "just" C) and then confusion will be no more.

In particular this is confusing because it seems that there is split to "C, asm, cmm" and "C++" (cxx). However cxxSources are in cLikeFiles.

THere is code like

    let cProfObjs            = map (`replaceExtension` ("p_" ++ objExtension))
                               (cSources libBi ++ cxxSources libBi)
        cSharedObjs          = map (`replaceExtension` ("dyn_" ++ objExtension))
                               (cSources libBi ++ cxxSources libBi)

why that doesn't include cmm and asm files? They don't have profiling variants?

There are a lot of questions, and variable naming & code structure doesn't give answers.

@mpickering
Copy link
Collaborator Author

I am not sure if @phadej is requesting changes or just suggesting an improvement. We didn't modify the names in this confusing code.

This patch is critical to build ghc-debug with 9.2 so needs to be in the 3.6 branch.

@fgaz fgaz added this to the 3.6.0.0-rc1 milestone Apr 2, 2021
@phadej
Copy link
Collaborator

phadej commented Apr 3, 2021

@mpickering I'm not a maintainer of Cabal, so my comments can be ignored.

Copy link
Member

@emilypi emilypi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mpickering - this is clear and even tests!

@bgamari
Copy link
Contributor

bgamari commented Apr 7, 2021

For what it's worth, I agree with @phadej that the current naming is confusing; I struggled to figure out its semantics when I first wrote the patch as well. It would be quite reasonable to carry out @phadej's proposed renaming in a follow-up patch.

@mpickering
Copy link
Collaborator Author

Anyone want to merge this?

@emilypi
Copy link
Member

emilypi commented Apr 14, 2021

As long as we're agreed there will be a follow up for @phadej's commentary, yes @mpickering - consider it merged

@emilypi emilypi merged commit 6c1d954 into haskell:master Apr 14, 2021
@phadej
Copy link
Collaborator

phadej commented Apr 14, 2021

Can we have an issue for

I struggled to figure out its semantics when I first wrote the patch as well. It would be quite reasonable to carry out @phadej's proposed renaming in a follow-up patch.

Just to remind us when this code is touched another time.

@bgamari
Copy link
Contributor

bgamari commented Apr 14, 2021

@emilypi, can you also backport to the 3.6 branch?

@fgaz
Copy link
Member

fgaz commented Apr 14, 2021

@bgamari There is no 3.6 branch yet

@fgaz
Copy link
Member

fgaz commented Apr 14, 2021

* [x]  Any changes that could be relevant to users have been recorded in the changelog (add file to `changelog.d` directory).

The changelog entry isn't there. @mpickering or @bgamari could you add one in a follow-up pr?

@bgamari
Copy link
Contributor

bgamari commented Apr 14, 2021

@bgamari There is no 3.6 branch yet

Ahh, I see. Cabal hasn't forked yet; support for GHC 9.2 has merely been added.

The changelog entry isn't there. @mpickering or @bgamari could you add one in a follow-up pr?

Sure.

bgamari added a commit to bgamari/cabal that referenced this pull request Apr 15, 2021
emilypi added a commit that referenced this pull request Apr 20, 2021
* GHC: Rename cLikeFiles -> cLikeSources

* changelog: Add entry for #7252

* Add name change convention for c-like objects

Co-authored-by: Emily Pillmore <emilypi@cohomolo.gy>
hololeap pushed a commit to hololeap/cabal that referenced this pull request Apr 24, 2022
* GHC: Rename cLikeFiles -> cLikeSources

* changelog: Add entry for haskell#7252

* Add name change convention for c-like objects

Co-authored-by: Emily Pillmore <emilypi@cohomolo.gy>
hololeap pushed a commit to hololeap/cabal that referenced this pull request Apr 24, 2022
* GHC: Rename cLikeFiles -> cLikeSources

* changelog: Add entry for haskell#7252

* Add name change convention for c-like objects

Co-authored-by: Emily Pillmore <emilypi@cohomolo.gy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmm-sources are not included in shared object linking
5 participants