Skip to content

fix(Cabal): Consistently translate -Wl, in ld-options when invoking ld directly - #12321

Closed
zlonast wants to merge 4 commits into
haskell:masterfrom
zlonast:zlonast/inconsistent-ld-options
Closed

zlonast wants to merge 4 commits into
haskell:masterfrom
zlonast:zlonast/inconsistent-ld-options

Conversation

@zlonast

@zlonast zlonast commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

fix: #10789

Main idea #9801 (comment)

IMHO, cc-options (and ld-options and cpp-options and ...) should be always passed when invoking GHC, similarly as ghc-options should be always used when invoking ghc - regardless of what is the intention of a particular GHC-call. GHC might use or not use the options, Cabal cannot know and should not guess.

  $ cabal build -v3
  Running: /usr/bin/ld --help
  Running: /usr/bin/ar -r dist/build/libHSpkg-0.1-inplace.a '@dist/tmp/ar.rsp'
- Running: /usr/bin/ld -x -r -o dist/build/libHSpkg-0.1-inplace.o '@dist/tmp/ld.rsp' -Wl,--allow-multiple-definition
- x86_64-linux-gnu-ld.bfd: unrecognized option '-Wl,--allow-multiple-definition'
- x86_64-linux-gnu-ld.bfd: use the --help option for usage information
- Error: [Cabal-7125]
- Failed to build pkg-0.1-inplace.
+ Running: /usr/bin/ld -x -r -o dist/build/libHSpkg-0.1-inplace.o '@dist/tmp/ld.rsp' --allow-multiple-definition
  Running: ghc --make ... -pgmc /usr/bin/gcc -optl-Wl,--allow-multiple-definition ... -o dist/build/pkg/pkg
+ Linking dist/build/pkg/pkg ...

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@zlonast zlonast added attention: needs-review re: ghc-options Concerning passing options to GHC labels Sep 5, 2026
@zlonast

zlonast commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

I think I’ve changed my mind now and believe that direct ld calls shouldn't exist.

@zlonast zlonast closed this Sep 9, 2026
@zlonast
zlonast deleted the zlonast/inconsistent-ld-options branch September 9, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attention: needs-review re: ghc-options Concerning passing options to GHC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent use of ld-options

1 participant