Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Makefile b/Makefile
- index cbfcd13..25273c4 100644
- --- a/Makefile
- +++ b/Makefile
- @@ -15,7 +15,7 @@ BIN := kernel.mod
- include $(shell pwd)/scripts/target-$(TARGETL).mk
- WARNINGS := -Wall -Wextra -Wno-unused-parameter
- -DEFS := $(INCLUDEDIR) -fbuiltin -DGITREV="\"$(GIT_REV)\""
- +CFLAGS := $(INCLUDEDIR) -fbuiltin -DGITREV="\"$(GIT_REV)\""
- HELPER_MK := $(shell pwd)/scripts/helper.mk
- MK_FLAGS := --no-print-directory -s
- @@ -27,7 +27,7 @@ OBJECTS := $(shell for dir in $(SUBDIRS); do\
- done;)
- ifeq ($(CONFIG_TESTING),y)
- - DEFS += -DTEST_HARNESS=1
- + CFLAGS += -DTEST_HARNESS=1
- endif
- OBJECTS := $(patsubst %.o,$(BUILD)/%.o,$(OBJECTS))
- @@ -40,13 +40,12 @@ all: $(BUILD)/apollo.iso
- $(BUILD)/%.c.o: %.c
- @printf "\033[1mCC\033[0m $<\n"
- @mkdir -p $(@D)
- - @$(CC) -c $< -o $@ $(DEFS) $(TARGET_DEFS) $(WARNINGS)
- + @$(CC) -c $< -o $@ $(CFLAGS) $(TARGET_CFLAGS) $(WARNINGS)
- $(BUILD)/apollo/$(BIN): $(OBJECTS)
- @printf "\033[1mLINK\033[0m $@\n"
- @mkdir -p $(BUILD)/apollo
- - @$(CC) $(DEFS) $(WARNINGS) $(LDFLAGS) $(TARGET_LDFLAGS) \
- - -o $(BUILD)/apollo/$(BIN) $(OBJECTS)
- + @$(CC) $(LDFLAGS) $(TARGET_LDFLAGS) -o $(BUILD)/apollo/$(BIN) $(OBJECTS)
- link: $(BUILD)/apollo/$(BIN)
- diff --git a/scripts/target-rpi4.mk b/scripts/target-rpi4.mk
- index 3e22197..d019d66 100644
- --- a/scripts/target-rpi4.mk
- +++ b/scripts/target-rpi4.mk
- @@ -9,8 +9,8 @@ SHELL := $(shell which bash)
- CC := $(shell command -v aarch64-elf-gcc)
- OBJCOPY := $(shell command -v aarch64-elf-objcopy)
- -TARGET_DEFS := -DRPI4=1 -ffreestanding -nostdlib -O2
- -TARGET_LDFLAGS ?= -Tsrc/arch/rpi4/link.ld -nostdlib -lgcc -n
- +TARGET_CFLAGS := -DRPI4=1 -ffreestanding -nostdlib -O2
- +TARGET_LDFLAGS ?= -Tsrc/arch/rpi4/link.ld -nostdlib -lgcc
- $(BUILD)/%.S.o: %.S
- @printf "\033[1mAS\033[0m $<\n"
- diff --git a/scripts/target-x86.mk b/scripts/target-x86.mk
- index cdca081..97c071b 100644
- --- a/scripts/target-x86.mk
- +++ b/scripts/target-x86.mk
- @@ -21,8 +21,8 @@ endif
- AS := nasm
- ASFLAGS := -felf -dGITREV="'$(GIT_REV)'"
- -TARGET_DEFS := -DX86=1 -m32 -masm=intel -ffreestanding -nostdlib -Os
- -TARGET_LDFLAGS ?= -m32 -Tsrc/arch/x86/link.ld -nostdlib -lgcc -n
- +TARGET_CFLAGS := -DX86=1 -m32 -masm=intel -ffreestanding -nostdlib -Os
- +TARGET_LDFLAGS ?= -m32 -Tsrc/arch/x86/link.ld -nostdlib -lgcc
- $(BUILD)/%.s.o: %.s
- @printf "\033[1mAS\033[0m $<\n"
- diff --git a/src/arch/rpi4/link.ld b/src/arch/rpi4/link.ld
- index 871b7a8..4c89dee 100644
- --- a/src/arch/rpi4/link.ld
- +++ b/src/arch/rpi4/link.ld
- @@ -11,7 +11,6 @@ SECTIONS
- .text ALIGN(4096) :
- {
- - *(.init)
- *(.text.unlikely .text.*_unlikely)
- *(.text.exit .text.exit.*)
- *(.text.startup text.startup.*)
- @@ -20,13 +19,13 @@ SECTIONS
- *(.gnu.warning)
- }
- - . += CONSTANT(COMMONPAGESIZE);
- -
- .rodata ALIGN(4096):
- {
- - *(.data .data.* .gnu.linkonce.r*)
- + *(.rodata .rodata.* .gnu.linkonce.r*)
- }
- + . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
- +
- .data ALIGN(4096):
- {
- PROVIDE (__startup_begin = .);
- diff --git a/src/arch/x86/link.ld b/src/arch/x86/link.ld
- index bb3cbdf..cb8cab6 100644
- --- a/src/arch/x86/link.ld
- +++ b/src/arch/x86/link.ld
- @@ -29,7 +29,7 @@ SECTIONS
- *(.gnu.warning)
- }
- - . += CONSTANT(COMMONPAGESIZE);
- + . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
- .rodata ALIGN(4096) : AT(ADDR(.rodata) - 0xC0000000)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement