Explorar el Código

Link "id" against the LibC.

We can now produce what should essentially be a runnable Serenity executable.
Andreas Kling hace 6 años
padre
commit
38a621c721
Se han modificado 3 ficheros con 11 adiciones y 3 borrados
  1. 1 1
      LibC/entry.cpp
  2. 2 0
      Userland/.gitignore
  3. 8 2
      Userland/Makefile

+ 1 - 1
LibC/entry.cpp

@@ -2,7 +2,7 @@
 
 extern "C" int main(int, char**);
 
-extern "C" int elf_entry()
+extern "C" int _start()
 {
     // FIXME: Pass appropriate argc/argv.
     main(0, nullptr);

+ 2 - 0
Userland/.gitignore

@@ -0,0 +1,2 @@
+id
+*.o

+ 8 - 2
Userland/Makefile

@@ -1,6 +1,9 @@
 OBJS = \
        id.o
 
+APPS = \
+       id
+
 ARCH_FLAGS =
 STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib
 USERLAND_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
@@ -15,9 +18,12 @@ CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLA
 CXX = g++
 LD = ld
 AR = ar
-LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections --build-id=none -z norelro -z now
+LDFLAGS = --strip-debug -melf_i386 --gc-sections --build-id=none -z norelro -z now
+
+all: $(OBJS) $(APPS)
 
-all: $(OBJS)
+id: id.o
+	$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
 
 .cpp.o:
 	@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<