-
Notifications
You must be signed in to change notification settings - Fork 81
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
Link C libraries statically if possible on linkstatic = True binaries #587
Commits on Jan 17, 2019
-
Move is_static/shared_lib to path_utils
So these can be used in other `.bzl` files.
Configuration menu - View commit details
-
Copy full SHA for 36b22f5 - Browse repository at this point
Copy the full SHA 36b22f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for bcf15fe - Browse repository at this point
Copy the full SHA bcf15feView commit details -
Prefer static C libraries on static Haskell binary
I.e. when building a Haskell binary with `linkstatic = True`, then link statically against Haskell and C library dependencies where possible. GHC's default behaviour (following from the linker's behaviour) is to prefer dynamic libraries over static libraries for C library dependencies, even when linking statically against Haskell libraries. By only passing static library versions (unless on static library is available) of C library dependencies as inputs to the linking action, the linker has no choice but to link statically. Closes #580
Configuration menu - View commit details
-
Copy full SHA for f1cb907 - Browse repository at this point
Copy the full SHA f1cb907View commit details -
Regression tests binary-linkstatic-flag
Test that a Haskell binary compiled with `linkstatic = True`, will only link to static library dependencies (where available), and that a Haskell binary compiled with `linkstatic = False`, will link all its library dependencies dynamically (where available). The test cases assume that for each library dependency both a dynamic and a static version are available, i.e. the default of `linkstatic = False` for library dependencies. Uses `haskell_test` in place of `haskell_binary` to ensure that the resulting binaries can be executed without any runtime linker errors.
Configuration menu - View commit details
-
Copy full SHA for b64d064 - Browse repository at this point
Copy the full SHA b64d064View commit details -
Skip test-binary-dynamic-only on dbg mode
dbg mode enforces static linking in which case the test case for dynamic linking will fail.
Configuration menu - View commit details
-
Copy full SHA for a1b55aa - Browse repository at this point
Copy the full SHA a1b55aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8e994ec - Browse repository at this point
Copy the full SHA 8e994ecView commit details
Commits on Jan 18, 2019
-
Fix //tests/binary-linkstatic-flag for MacOS
`objdump` is not available on the MacOS build. Furthermore, on MacOS only direct library dependencies are listed under the shared library dependencies. Also, on MacOS the dynamic library dependency listed in the binary's header uses the library ID instead of the mangled library path as on Linux. This changes and simplifies the binary-linkstatic-flag tests to work on both Linux and MacOS seemlessly. First, we turn the indirect C library dependency into a direct dependency. Second, instead of checking for shared library dependencies, we directly check for the `value` and `*HsLib_value_closure` symbols. In a statically linked binary both those symbols will be defined directly in the binary. In a dynamically linked binary both symbols will be listed as undefined. The `nm` tool is available on both the Linux and MacOS builds and can list all undefined symbols in the binary.
Configuration menu - View commit details
-
Copy full SHA for b0a7bd7 - Browse repository at this point
Copy the full SHA b0a7bd7View commit details