[PATCH] D106378: RISCV: relax the ABI mismatch checking
Jérémie Courrèges-Anglas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 4 04:46:11 PST 2022
jca added a comment.
In D106378#2891051 <https://reviews.llvm.org/D106378#2891051>, @jrtc27 wrote:
> In D106378#2891003 <https://reviews.llvm.org/D106378#2891003>, @MaskRay wrote:
>
>> This needs linker&psABI discussions on what the best path forward.
>>
>> If we do need the lld/ELF change, we need to change `error` to `errorOrWarn` so that `--noinhibit-exec` without `--fatal-warnings` will be a warning...
>
> The right path forward is to not use tools that create ELF files that don't adhere to the psABI (i.e. say they use one ABI when you mean for them to be another ABI). Whether that's by changing the tools to support specifying the ABI for the output file, or by using existing alternative tools (clang + .incbin / gcc + as + .incbin) that don't suffer from those shortcomings, I don't really care, but I see this as a tooling issue not an ABI issue.
Regarding "tools that create ELF files that don't adhere to the psABI": it's not just about objcopy. Another well-known way to embed binary data in object files is to use ld -b binary. With lld, such object files end up with e_flags equal to 0 (https://reviews.llvm.org/D71101), and that triggers the fatal error in the code discussed here. There is no way to create object files with a more precise ABI/e_flags using -m (https://reviews.llvm.org/D95755).
I agree that this looks like a tooling issue, and I would love a way to solve or work around this problem ; without resorting to patching the build system of other projects to use lower-level alternatives like .incbin, which may be rejected by upstreams.
My experience comes from building packages for the OpenBSD/riscv64 architecture, and the upstream projects which hit this failure are, so far: mupdf (embeds font files), postgresql-lua, eduke32, nblood (all three want to embed lua bytecode) and utox.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106378/new/
https://reviews.llvm.org/D106378
More information about the llvm-commits
mailing list