ld no longer works

I know there was an import into FreeBSD (lld), but I'm unsure why it's not completely backwards compatible.

Take for instance this simple program:

=========================
BITS 64
DEFAULT rel

global _start:function

SECTION .text

_start:
mov eax, 1
xor edi, edi
syscall
=========================

You used to be able to compile and link this with the following:

# nasm -f elf64 -o porcupine.o porcupine.s
# ld -s -o porcupine porcupine.o

This would result in a binary that was perfectly capable of executing on FreeBSD <= 11.3.
With FreeBSD 12, it no longer runs and results in:

# ./porcupine
ELF binary type "0" not known.
./porcupine: Exec format error. Binary file not executable.

Two questions:
1) What has to change in order for this to run successfully?
2) Why isn't that a default?

Thanks in Advance.

Edit:

I've answered my first question. `-m elf_amd64_fbsd` is required.
My second question still remains however.

Thanks Again in Advance.
 
Back
Top