2

I am new to OS development and I want to compile a kernel to an ELF binary. I have a loader written in assembly (GAS syntax). I compile it on Mac OS X 10.7 using as (Apple Inc version cctools-822, GNU assembler version 1.38).

% as -arch i386 src/loader/x86.S -o src/loader/x86.o

However, % file src/loader/x86.o tells me that it's a Mach-O file.

% file src/loader/x86.o
src/loader/x86.o: Mach-O object i386

I read the man page of as but I cannot find out how to produce an ELF object rather than a Mach-O object. Googling didn't result in anything useful either.

1 Answers1

1

The best approach is to install binutils for x86/x86-64 ELF as described here.

Community
  • 1
  • 1
Brett Hale
  • 21,653
  • 2
  • 61
  • 90