> Hmm,  doesn't gcc/llvm have a command line flag to take a C file and output 
> assembly?
> Maybe they could take the minimal hello.c file from that blog and run
>
> gcc --output-this-c-file-to-assembly hello.c

-S, but the main problem on OpenBSD is not so much there as it is to
build it into a valid ELF file with all the magics in it so it
actually starts.

Running clang with -v shows all flags used at the assembly and linking steps:

$ cc -v -O2 -pipe -o hello  hello2.s
OpenBSD clang version 16.0.6
Target: aarch64-unknown-openbsd7.7
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/cc" -cc1as -triple aarch64-unknown-openbsd7.7 -filetype obj
-main-file-name hello2.s -target-cpu generic -target-feature +neon
-target-feature +v8a -target-feature +strict-align
-fdebug-compilation-dir=/root/src/hello -dwarf-debug-producer "OpenBSD
clang version 16.0.6" -dwarf-version=2 -mrelocation-model pic -o
/tmp/hello2-a7ddcd.o hello2.s
 "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker
/usr/libexec/ld.so -o hello /usr/lib/crt0.o /usr/lib/crtbegin.o
-L/usr/lib /tmp/hello2-a7ddcd.o -lcompiler_rt -lc -lcompiler_rt
/usr/lib/crtend.o

I'm sure not all are 100% needed, but you still save a lot of time and
effort if you let obsd use it's defaults.
Perhaps someone can dream up a set of magic incantations to shorten
this, but if your goal was really to code arm64 asm then doing it this
way for a while should be enough to get you started.

-- 
May the most significant bit of your life be positive.

Reply via email to