-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Support dynamically-linked and/or native musl targets #40113
Commits on Aug 22, 2017
-
Remove incorrect special case of mips-musl
The libdl/librt/libpthread provided by musl are no-op (empty static libraries) on all architectures, mips included.
Configuration menu - View commit details
-
Copy full SHA for 15c141c - Browse repository at this point
Copy the full SHA 15c141cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1757a87 - Browse repository at this point
Copy the full SHA 1757a87View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8606782 - Browse repository at this point
Copy the full SHA 8606782View commit details -
Copy musl startup objects before building std
They are required for linking it, even though it is a library, because crtn.o in post_link_objects, as hardcoded in src/librustc_back/target/ linux_musl_base.rs, is added to the linker command line for both executables and libraries.
Configuration menu - View commit details
-
Copy full SHA for 0c7a0e9 - Browse repository at this point
Copy the full SHA 0c7a0e9View commit details -
Introduce crt_static target option in config.toml
This controls the value of the crt-static feature used when building the standard library for a target, as well as the compiler itself when that target is the host.
Configuration menu - View commit details
-
Copy full SHA for 4b09dc6 - Browse repository at this point
Copy the full SHA 4b09dc6View commit details -
Inline crt-static choice for pc-windows-msvc
This avoids the possibility of a duplicate or conflicting crt-static command line option sent to rustc.
Configuration menu - View commit details
-
Copy full SHA for 5283243 - Browse repository at this point
Copy the full SHA 5283243View commit details -
Factor out a helper for the getting C runtime linkage
This commit makes no functional changes.
Configuration menu - View commit details
-
Copy full SHA for 3cb9878 - Browse repository at this point
Copy the full SHA 3cb9878View commit details -
Introduce temporary target feature crt_static_respected
This feature allows targets to opt in to full support of the crt-static feature. Currently, crt-static is allowed on all targets, even those that really can't or really shouldn't support it. This works because it is very loose in the specification of its effects. Changing the behavior of crt-static to be more strict in how it chooses libraries and links executables would likely cause compilation to fail on these platforms. To avoid breaking existing uses of crt-static, whitelist targets that support the new, stricter behavior. For all other targets, this changes crt-static from being "mostly a no-op" to "explicitly a no-op".
Configuration menu - View commit details
-
Copy full SHA for beb8abe - Browse repository at this point
Copy the full SHA beb8abeView commit details -
Introduce target feature crt_static_allows_dylibs
Most UNIX-like platforms do not allow shared libraries to statically link their own libc, as libc expects to have consistent process-global state. On those platforms, when we do not have a shared libc available, we must not attempt to link dylibs or cdylibs. On Windows, however, it is expected to statically link the CRT into dynamic libraries. This feature is only relevant for targets that support both fully-static and fully-dynamic linkage, such as musl on Linux.
Configuration menu - View commit details
-
Copy full SHA for 12ceed0 - Browse repository at this point
Copy the full SHA 12ceed0View commit details -
Disable PIE when linking statically
Static PIE support, while supported on musl, requires a patch to GCC. Until/unless it is merged, adding '-pie' to the linker command line will override '-static' and create a binary that requires a dynamic interpreter (ld.so).
Configuration menu - View commit details
-
Copy full SHA for 054f310 - Browse repository at this point
Copy the full SHA 054f310View commit details -
Tell the linker when we want to link a static executable
If the C runtime is linked statically, explicitly tell the linker that the executable should be static.
Configuration menu - View commit details
-
Copy full SHA for bab6911 - Browse repository at this point
Copy the full SHA bab6911View commit details -
Update libunwind dependencies for musl
Use libgcc_s when linking dynamically. Convert the static libunwind to static-nobundle, as libunwind.a is copied from musl_root and available in the library search path.
Configuration menu - View commit details
-
Copy full SHA for c964567 - Browse repository at this point
Copy the full SHA c964567View commit details -
Support dynamic linking for musl-based targets
Note that this commit does not affect mips-musl targets, as they do not inherit from linux_musl_base.
Configuration menu - View commit details
-
Copy full SHA for 565a863 - Browse repository at this point
Copy the full SHA 565a863View commit details -
Update ignored tests for dynamic musl
Now that musl supports dynamic libraries (although not by default) enable the tests that now pass. Additional currently-ignored tests will pass if rustc is built with crt_static=false in config.toml.
Configuration menu - View commit details
-
Copy full SHA for e6cd941 - Browse repository at this point
Copy the full SHA e6cd941View commit details