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

psx: work-around hsc2hs linking issue #60

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion psx/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

* Update vendored sources.

* Support `tasty ^>=1.5`
* Support `tasty ^>=1.5`.

* Fix build on platforms where a `hsc2hs` build links in `libgcc` which relies on
`sigfillset`. This requires the Cabal format version to be bumped to 3.6.

## 0.1.1.1 -- 2023-02-28

Expand Down
5 changes: 4 additions & 1 deletion psx/psx.cabal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cabal-version: 2.2
cabal-version: 3.6
build-type: Simple
name: psx
version: 0.1.1.1
Expand Down Expand Up @@ -35,6 +35,7 @@ extra-source-files:
cbits/hs-psx.h
cbits/psx/psx_syscall.h
test/detect-psx.h
test/hsc2hs-stubs.c

tested-with:
GHC ==8.10.7
Expand Down Expand Up @@ -113,6 +114,7 @@ test-suite psx-test-threaded
main-is: psx-test-threaded.hs
other-modules: TestCases
c-sources: test/detect-psx.c
hsc2hs-options: -i hsc2hs-stubs.c
include-dirs: test
build-depends:
, async ^>=2.2.3
Expand All @@ -131,6 +133,7 @@ test-suite psx-test
main-is: psx-test.hs
other-modules: TestCases
c-sources: test/detect-psx.c
hsc2hs-options: -i hsc2hs-stubs.c
include-dirs: test
build-depends:
, async ^>=2.2.3
Expand Down
20 changes: 20 additions & 0 deletions psx/test/hsc2hs-stubs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Stubs for linking `hsc2hs` programs to succeed.
*
* For some reason, `cabal` passes a library's `ld-options` to the C compiler
* when building `hsc2hs` C files. However, in our case, these flags request
* wrapping of (e.g.) `sigfillset`. On some platforms, `libgcc` gets linked in
* as well, and on some platforms this `libgcc` relies on `sigfillset`, hence
* linking fails unless `__wrap_sigfillset` is declared.
*
* This module relays calls to the underlying `__real_*` implementation.
*
* See https://github.com/haskell/cabal/issues/8824
*/

#include <signal.h>

extern int __real_sigfillset(sigset_t *set);

int __wrap_sigfillset(sigset_t *set) {
return __real_sigfillset(set);
}
Loading