Makefile: add dependency for linker scripts
This commit is contained in:
parent
fe84c58450
commit
84051a9071
4 changed files with 9 additions and 9 deletions
8
Makefile
8
Makefile
|
@ -89,7 +89,7 @@ CFLAGS += -O2 -MMD -Wall -Werror $(INCFLAGS) \
|
|||
-Wno-main -U_FORTIFY_SOURCE -fvisibility=hidden
|
||||
CXXFLAGS += $(CFLAGS) -ffreestanding -fno-rtti -fno-exceptions
|
||||
ASFLAGS += -MMD $(INCFLAGS)
|
||||
LDFLAGS += -z noexecstack
|
||||
LDFLAGS += -z noexecstack $(addprefix -T, $(LDSCRIPTS))
|
||||
|
||||
## 4. Arch-Specific Configurations
|
||||
|
||||
|
@ -123,13 +123,13 @@ $(LIBS): %:
|
|||
@$(MAKE) -s -C $(AM_HOME)/$* archive
|
||||
|
||||
### Rule (link): objects (`*.o`) and libraries (`*.a`) -> `IMAGE.elf`, the final ELF binary to be packed into image (ld)
|
||||
$(IMAGE).elf: $(LINKAGE)
|
||||
$(IMAGE).elf: $(LINKAGE) $(LDSCRIPTS)
|
||||
@echo \# Creating image [$(ARCH)]
|
||||
@echo + LD "->" $(IMAGE_REL).elf
|
||||
ifneq ($(filter $(ARCH),native),)
|
||||
$(CXX) -o $@ -Wl,--whole-archive $^ -Wl,-no-whole-archive $(LDFLAGS_CXX)
|
||||
$(CXX) -o $@ -Wl,--whole-archive $(LINKAGE) -Wl,-no-whole-archive $(LDFLAGS_CXX)
|
||||
else
|
||||
@$(LD) $(LDFLAGS) -o $@ --start-group $^ --end-group
|
||||
@$(LD) $(LDFLAGS) -o $@ --start-group $(LINKAGE) --end-group
|
||||
endif
|
||||
|
||||
### Rule (archive): objects (`*.o`) -> `ARCHIVE.a` (ar)
|
||||
|
|
|
@ -9,8 +9,8 @@ AM_SRCS := platform/nemu/trm.c \
|
|||
|
||||
CFLAGS += -fdata-sections -ffunction-sections
|
||||
CFLAGS += -I$(AM_HOME)/am/src/platform/nemu/include
|
||||
LDFLAGS += -T $(AM_HOME)/scripts/linker.ld \
|
||||
--defsym=_pmem_start=0x80000000 --defsym=_entry_offset=0x0
|
||||
LDSCRIPTS += $(AM_HOME)/scripts/linker.ld
|
||||
LDFLAGS += --defsym=_pmem_start=0x80000000 --defsym=_entry_offset=0x0
|
||||
LDFLAGS += --gc-sections -e _start
|
||||
NEMUFLAGS += -l $(shell dirname $(IMAGE).elf)/nemu-log.txt
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ AM_SRCS := riscv/npc/start.S \
|
|||
platform/dummy/mpe.c
|
||||
|
||||
CFLAGS += -fdata-sections -ffunction-sections
|
||||
LDFLAGS += -T $(AM_HOME)/scripts/linker.ld \
|
||||
--defsym=_pmem_start=0x80000000 --defsym=_entry_offset=0x0
|
||||
LDSCRIPTS += $(AM_HOME)/scripts/linker.ld
|
||||
LDFLAGS += --defsym=_pmem_start=0x80000000 --defsym=_entry_offset=0x0
|
||||
LDFLAGS += --gc-sections -e _start
|
||||
|
||||
MAINARGS_MAX_LEN = 64
|
||||
|
|
|
@ -10,7 +10,7 @@ AM_SRCS := riscv/spike/trm.c \
|
|||
platform/dummy/mpe.c \
|
||||
|
||||
CFLAGS += -fdata-sections -ffunction-sections
|
||||
LDFLAGS += -T $(AM_HOME)/am/src/riscv/spike/linker.ld
|
||||
LDSCRIPTS += $(AM_HOME)/am/src/riscv/spike/linker.ld
|
||||
LDFLAGS += --gc-sections -e _start
|
||||
|
||||
CFLAGS += -DMAINARGS=\"$(mainargs)\"
|
||||
|
|
Loading…
Add table
Reference in a new issue