Slight cleanup and fixed SSP

This commit is contained in:
2026-03-22 14:55:37 +01:00
parent 8cbe050f35
commit eca7c957e2
7 changed files with 14 additions and 148 deletions
+8 -8
View File
@@ -9,24 +9,24 @@ OBJS_C = $(patsubst $(SRC)/%.c, $(BIN)/%.c.o, $(SRCS_C))
OBJS_S = $(patsubst $(SRC)/%.s, $(BIN)/%.s.o, $(SRCS_S))
OUT = $(SYSROOT)/boot/kernel.elf
LINKER = ./linker.ld
# Stack Canary
SSP := 0x$(shell openssl rand -hex 8)
CCFLAGS += -DSTACK_CHK_GUARD=$(SSP)
SSP = ./.ssp
.PHONY: all clean
all: $(OUT)
$(OUT): $(OBJS_C) $(OBJS_S)
$(LD) $(LDFLAGS) -T$(LINKER) -o $@ $^
$(BIN)/%.c.o: $(SRC)/%.c
$(BIN)/%.c.o: $(SRC)/%.c $(SSP)
@mkdir -p $(dir $@)
$(CC) $(CCFLAGS) -I$(INC) -c -o $@ $^
$(CC) $(CCFLAGS) -DSTACK_CHK_GUARD=$(shell cat $(SSP)) -I$(INC) -c -o $@ $<
$(BIN)/%.s.o: $(SRC)/%.s
@mkdir -p $(dir $@)
$(AS) $(ASFLAGS) -o $@ $^
$(AS) $(ASFLAGS) -o $@ $<
$(SSP):
echo "0x$$(openssl rand -hex 8)UL" > $(SSP)
clean:
rm -fr $(BIN) $(OUT)
rm -fr $(BIN) $(OUT) $(SSP)