diff --git a/libmaxsi/Makefile b/libmaxsi/Makefile index 27114d45..df6f59d5 100644 --- a/libmaxsi/Makefile +++ b/libmaxsi/Makefile @@ -17,6 +17,7 @@ ifeq ($(CPU),x64) CPULDFLAGS=-melf_x86_64 CPUASFLAGS=-64 CPUNASMFLAGS=-felf64 + LIBMAXSI_NO_SHARED=1 # This doesn't work yet endif DEFINES=-DLIBMAXSI_LIBRARY -DSORTIX $(CPUDEFINES) @@ -52,6 +53,7 @@ process.o \ thread.o \ io.o \ init.o \ +start.o \ HEADERS=\ error.h \ @@ -70,19 +72,25 @@ sortix-keyboard.h \ sortix-sound.h \ OBJS:=$(LIBMAXSIOBJS) -BINS:=libmaxsi.so +BINS:= + +ifndef LIBMAXSI_NO_SHARED + BINS:=$(BINS) libmaxsi.so +endif ifndef LIBMAXSI_NO_STATIC BINS:=$(BINS) libmaxsi.a endif ifndef LIBMAXSI_NO_SORTIX - BINS:=$(BINS) libmaxsi-sortix.a start.o + BINS:=$(BINS) libmaxsi-sortix.a endif ifndef LIBMAXSI_NO_LIBC OBJS:=$(OBJS) $(COBJS) - BINS:=$(BINS) libc.so + ifndef LIBMAXSI_NO_SHARED + BINS:=$(BINS) libc.so + endif ifndef LIBMAXSI_NO_STATIC BINS:=$(BINS) libc.a endif @@ -114,6 +122,9 @@ libc.a: libmaxsi.a libc.so: libmaxsi.so ln -sf $< $@ +start.o: $(CPU)/start.o + ln -sf $< $@ + # libmaxsi *.cpp: $(HEADERS) @@ -155,5 +166,5 @@ sortix/%.o: sortix/%.cpp g++ -c $< -o $@ $(SORTIXFLAGS) clean: - rm -f *.o sortix/*.o c/*.o *.a *.so $(CHEADERS) $(HEADERS) + rm -f *.o sortix/*.o c/*.o x86/*.o x64/*.o *.a *.so $(CHEADERS) $(HEADERS) diff --git a/libmaxsi/x64/start.s b/libmaxsi/x64/start.s new file mode 100644 index 00000000..e3aeafda --- /dev/null +++ b/libmaxsi/x64/start.s @@ -0,0 +1,41 @@ +/****************************************************************************** + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. + + This file is part of LibMaxsi. + + LibMaxsi is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with LibMaxsi. If not, see . + + start.s + A stub for linking to the C runtime on Sortix. + +******************************************************************************/ + +.globl _start + +.section .text + +.type _start, @function +_start: + + call initialize_standard_library + + # Run main + # TODO: Sortix should set the initial values before this point! + call main + + # Terminate the process with main's exit code. + movl %eax, %edi + call exit + diff --git a/libmaxsi/start.s b/libmaxsi/x86/start.s similarity index 100% rename from libmaxsi/start.s rename to libmaxsi/x86/start.s