JuliaPackaging / BinaryBuilder.jl

Binary Dependency Builder for Julia
https://binarybuilder.org
Other
391 stars 99 forks source link

Check for a branded ELF note when OS/ABI is NONE #1344

Open ararslan opened 2 weeks ago

ararslan commented 2 weeks ago

Currently the auditor is only checking for the correct OS/ABI and producing a warning on FreeBSD when it doesn't match. This warning is incorrect on AArch64 though, as FreeBSD instead uses an ELF note to declare the OS/ABI. The change implemented here looks for such a note when the OS/ABI in the ELF header is NONE.

Note that there are no tests added... I'd be interested in any suggestions for how best to test this given that the functions I modified are not currently tested, at least directly (AFAICT).

giordano commented 2 weeks ago

I haven't looked at the implementation yet, but I want to quickly answer the question

Note that there are no tests added... I'd be interested in any suggestions for how best to test this given that the functions I modified are not currently tested, at least directly (AFAICT).

Yeah, the problem is that we don't know (or forgot? who knows) how libraries with the wrong OS/ABI field were generated on FreeBSD. An alternative should be to compile a simple dummy library (something like echo '' | cc -x c - -shared -fPIC -o libdummy.${dlext}) and then patchelf --set-os-abi it

ararslan commented 2 weeks ago

Ah rip, the patchelf we ship is old and doesn't have --set-os-abi

giordano commented 2 weeks ago

Sigh, never mind the test then, we can't upgrade patchelf because newer version is broken (https://github.com/JuliaPackaging/Yggdrasil/pull/7728#issuecomment-1830964109, caused by https://github.com/NixOS/patchelf/issues/492)