add gc-sections

This also fixes filename ordering in the iso9660 structure when the source file
is in a subdirectory relative to where mkisofs is called.
This commit is contained in:
Zack Buhman 2023-01-27 00:08:53 -08:00
parent 0f99452759
commit 0eac09e58a
2 changed files with 5 additions and 4 deletions

View File

@ -3,8 +3,9 @@ OPT ?= -Og
AARCH = --isa=sh2 --big AARCH = --isa=sh2 --big
AFLAGS = -g -gdwarf-4 AFLAGS = -g -gdwarf-4
CFLAGS += -ffunction-sections -fshort-enums -ffreestanding -nostdlib CFLAGS += -ffunction-sections -fdata-sections -fshort-enums -ffreestanding -nostdlib
CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -g -gdwarf-4 $(OPT) CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable -g -gdwarf-4 $(OPT)
LDFLAGS = --gc-sections --no-warn-rwx-segment --print-memory-usage --entry=_start
CXXFLAGS = -fno-exceptions -fno-rtti CXXFLAGS = -fno-exceptions -fno-rtti
CARCH = -m2 -mb CARCH = -m2 -mb
@ -50,7 +51,7 @@ SYS_IP_OBJ += $(LIB)/smpsys.o
$< $@ $< $@
%.elf: %.elf:
$(LD) --no-warn-rwx-segment --print-memory-usage -T $(LIB)/sh2.lds $^ -o $@ $(LD) $(LDFLAGS) -T $(LIB)/sh2.lds $^ -o $@
sys_ip.elf: $(SYS_IP_OBJ) sys_ip.elf: $(SYS_IP_OBJ)
$(LD) --print-memory-usage -T $(LIB)/sys_ip.lds $^ -o $@ $(LD) --print-memory-usage -T $(LIB)/sys_ip.lds $^ -o $@
@ -87,7 +88,7 @@ sys_ip.elf: $(SYS_IP_OBJ)
-G sys_ip.bin \ -G sys_ip.bin \
-o $@ \ -o $@ \
-graft-points \ -graft-points \
/0${<}=./${<} \ /0$(notdir ${<})=./${<} \
/=$(LIB)/segasmp/smp_cpy.txt \ /=$(LIB)/segasmp/smp_cpy.txt \
/=$(LIB)/segasmp/smp_abs.txt \ /=$(LIB)/segasmp/smp_abs.txt \
/=$(LIB)/segasmp/smp_bib.txt /=$(LIB)/segasmp/smp_bib.txt

View File

@ -11,7 +11,7 @@ SECTIONS
.text ALIGN(4) : SUBALIGN(4) .text ALIGN(4) : SUBALIGN(4)
{ {
*(.text.start) KEEP(*(.text.start))
*(.text) *(.text)
*(.text.*) *(.text.*)
} > work_ram_h } > work_ram_h