Commit graph

8 commits

Author SHA1 Message Date
bit-aloo
99aa4ed85f
replace config.toml to bootstrap.toml in src/ci, src/etc/* and tests/run-make 2025-03-17 12:56:49 +05:30
Noratrieb
a954c51280 Support raw-dylib link kind on ELF
raw-dylib is a link kind that allows rustc to link against a library
without having any library files present.
This currently only exists on Windows. rustc will take all the symbols
from raw-dylib link blocks and put them in an import library, where they
can then be resolved by the linker.

While import libraries don't exist on ELF, it would still be convenient
to have this same functionality. Not having the libraries present at
build-time can be convenient for several reasons, especially
cross-compilation. With raw-dylib, code linking against a library can be
cross-compiled without needing to have these libraries available on the
build machine. If the libc crate makes use of this, it would allow
cross-compilation without having any libc available on the build
machine. This is not yet possible with this implementation, at least
against libc's like glibc that use symbol versioning.
The raw-dylib kind could be extended with support for symbol versioning
in the future.

This implementation is very experimental and I have not tested it very
well. I have tested it for a toy example and the lz4-sys crate, where it
was able to successfully link a binary despite not having a
corresponding library at build-time.
2025-02-26 19:09:51 +01:00
jyn
97311a8969 Downgrade linker-warnings to allow-by-default
This needs more time to bake before we turn it on. Turning it on early risks people silencing the warning indefinitely, before we have the chance to make it less noisy.
2025-01-26 22:57:20 -05:00
jyn
c1b4ab0e73 Shorten linker output even more when --verbose is not present
- Don't show environment variables. Seeing PATH is almost never useful, and it can be extremely long.
- For .rlibs in the sysroot, replace crate hashes with a `"-*"` string. This will expand to the full crate name when pasted into the shell.
- Move `.rlib` to outside the glob.
- Abbreviate the sysroot path to `<sysroot>` wherever it appears in the arguments.

This also adds an example of the linker output as a run-make test. Currently it only runs on x86_64-unknown-linux-gnu, because each platform has its own linker arguments. So that it's stable across machines, pass BUILD_ROOT as an argument through compiletest through to run-make tests.

- Only use linker-flavor=gnu-cc if we're actually going to compare the output. It doesn't exist on MacOS.
2025-01-25 16:04:52 -05:00
jyn
26708aa941 Don't require --verbose to show linker stdout 2025-01-20 16:46:47 -05:00
jyn
b757663a00 don't ICE when emitting linker errors during -Z link-only
note that this still ICEs when passed `-Z link-only --error-format json` because i can't be bothered to fix it right now
2025-01-20 16:46:45 -05:00
jyn
c0822ed9b8 show linker warnings even if it returns 0 2025-01-20 16:46:00 -05:00
jyn
a4ef751e26 don't show the full linker args unless --verbose is passed
the linker arguments can be *very* long, especially for crates with many dependencies. some parts of them are not very useful. unless specifically requested:
- omit object files specific to the current invocation
- fold rlib files into a single braced argument (in shell expansion format)

this shortens the output significantly without removing too much information.
2024-12-14 20:38:46 -05:00