On Thu, May 26, 2022, Dan Cross wrote: > Change x86/Makefile.common to invoke the linker directly instead > of using the C compiler as a linker driver. > > This supports building on illumos, allowing the user to use > gold instead of the Solaris linker. Tested on Linux and illumos. > > Signed-off-by: Dan Cross <cross@xxxxxxxxxxxxxxxxx> > --- > x86/Makefile.common | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/x86/Makefile.common b/x86/Makefile.common > index b903988..0a0f7b9 100644 > --- a/x86/Makefile.common > +++ b/x86/Makefile.common > @@ -62,7 +62,7 @@ else > .PRECIOUS: %.elf %.o > > %.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o) > - $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,$(SRCDIR)/x86/flat.lds \ > + $(LD) -T $(SRCDIR)/x86/flat.lds -nostdlib -o $@ \ > $(filter %.o, $^) $(FLATLIBS) > @chmod a-x $@ > > @@ -98,8 +98,8 @@ test_cases: $(tests-common) $(tests) > $(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/x86 -I lib > > $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o > - $(CC) -m32 -nostdlib -o $@ -Wl,-m,elf_i386 \ > - -Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^ > + $(LD) -m elf_i386 -nostdlib -o $@ \ > + -T $(SRCDIR)/$(TEST_DIR)/realmode.lds $^ AFAICT, this is functionally a nop, and both 32-bit and 64-bit are happy, so, Reviewed-and-tested-by: Sean Christopherson <seanjc@xxxxxxxxxx>