Created attachment 221349 [details]
hello.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
ELF binary type "0" not known.
brandelf -t FreeBSD hello
see attached patch for a proposed fix.
Submitter is committer
On Linux, e_ident[EI_OSABI] is ELFOSABI_NONE if no GNU extension is used.
On FreeBSD, x86-64/powerpc/etc have "_fbsd" emulations which set default as/ld output to ELFOSABI_FREEBSD,
e.g. after https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6afcdeb3581e99e2d4ce06d0034c7c47292aeec1
"PR26667, Add powerpc64le-*-freebsd* support", powerpc64le default to ELFOSABI_FREEBSD.
However, ELFOSABI_FREEBSD is unnecessary. Bdragon reported that ELFOSABI_GNU object files can be linked into ELFOSABI_FREEBSD executable and the important thing is the FreeBSD specific SHT_NOTE section to mark the executable as FreeBSD specific.
So "_fbsd" emulations are not going to be useful.
See also https://sourceware.org/pipermail/binutils/2021-February/115185.html
(In reply to maskray from comment #2)
I'm not sure I understand all of this, what needs to be done exactly?
(In reply to Mikael Urankar from comment #3)
Nothing; this is not a bug. For whatever reason you managed to produce a binary without the FreeBSD ELF note present in the C start-up files that should have been linked in; that's the way binaries get branded for the recent arm64 and riscv ports (with ELFOSABI_FREEBSD continuing to be set and recognised for older ports for backwards compatibility).