diff --git a/kernel/GNUmakefile b/kernel/GNUmakefile index e890637..db2192d 100644 --- a/kernel/GNUmakefile +++ b/kernel/GNUmakefile @@ -26,6 +26,9 @@ NASMFLAGS ?= -F dwarf -g # User controllable linker flags. We set none by default. LDFLAGS ?= +# User controllable preprocessor flags. We set none by default. +CPPFLAGS ?= + # Internal C flags that should not be changed by the user. override INTERNALCFLAGS := \ -I. \ @@ -70,18 +73,18 @@ limine.h: # Link rules for the final kernel executable. $(KERNEL): $(OBJ) - $(CC) $(OBJ) $(LDFLAGS) $(INTERNALLDFLAGS) -o $@ + $(CC) $(CFLAGS) $(INTERNALCFLAGS) $(OBJ) $(LDFLAGS) $(INTERNALLDFLAGS) -o $@ # Include header dependencies. -include $(HEADER_DEPS) # Compilation rules for *.c files. %.o: %.c limine.h - $(CC) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@ # Compilation rules for *.S files. %.o: %.S limine.h - $(CC) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@ # Compilation rules for *.asm (nasm) files. %.o: %.asm diff --git a/kernel/linker.ld b/kernel/linker.ld index 3b0de45..e9e1afa 100644 --- a/kernel/linker.ld +++ b/kernel/linker.ld @@ -36,11 +36,6 @@ SECTIONS /* Move to the next memory page for .data */ . += CONSTANT(MAXPAGESIZE); - /* Not placing this here may cause trouble on some hosts */ - .note.gnu.build-id : { - *(.note.gnu.build-id) - } :data - .data : { *(.data .data.*) } :data @@ -49,4 +44,9 @@ SECTIONS *(COMMON) *(.bss .bss.*) } :data + + /* Discard notes since they may cause issues on some hosts. */ + /DISCARD/ : { + *(.note .note.*) + } }