ELF Interpreter stub

This commit is contained in:
Alex 2022-12-25 22:47:47 +02:00
parent 40410cba41
commit 6eb4bdd6f5
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 7 additions and 2 deletions

View File

@ -29,12 +29,12 @@ else ifeq ($(OSARCH), i686)
ASM_ARCH := elf32
endif
CFLAGS := -fPIC -I$(INCLUDE)
CFLAGS := -fPIC -fPIE -I$(INCLUDE)
build: $(OBJECT_NAME)
$(OBJECT_NAME): $(OBJ)
$(CC) -nostdlib -static -fPIC -fPIE -Wl,-soname,$(SO_NAME) $(SYSROOT) $(OBJ) -o $(OUTPUT_DIR)$@
$(CC) -static -fPIC -fPIE -Wl,-soname,$(SO_NAME) $(SYSROOT) $(OBJ) -o $(OUTPUT_DIR)$@
$(OBJDUMP) -d $(OUTPUT_DIR)$@ > file_dump.map
%.o: %.c

View File

@ -1,7 +1,12 @@
#include "ld.h"
/* TODO: Implement ELF interpreter. Currently it's implemented in the kernel. */
int main(int argc, char *argv[], char *envp[])
{
__asm__ __volatile__("syscall"
:
: "a"(1), "D"('H'), "S"(0)
: "rcx", "r11", "memory");
if (argc < 2)
return -1;