-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
psx: work-around
hsc2hs
linking issue
On some platforms, building a `hsc2hs` program requires `libgcc`, and on some platforms, `libgcc` uses `sigfillset`. For some reason (a bug, I'd say), `cabal` passes `ld-options` to the compiler when building the generated C file. In our case, this causes `sigfillset` to be wrapped (which is desired for the actual `psx` library), but since `__wrap_sigfillset` is never defined, the build fails. This work-around tells `hsc2hs` to include a small C file in its generated sources which defines `__wrap_sigfillset` as a proxy for `__real_sigfillset`. See: haskell/cabal#8824
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
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
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,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); | ||
} |