Skip to content

Commit c72fc0c

Browse files
authored
Merge pull request #1 from Thar0/makefile-changes
Makefile changes: Remove objcopy hack and allow building with WSL
2 parents c5e2415 + 1b91cd8 commit c72fc0c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ ifneq ($(findstring MSYS,$(shell uname)),)
55
WINDOWS := 1
66
endif
77

8+
WSLENV ?= ok
9+
ifndef WSLENV
10+
WINDOWS := 1
11+
endif
12+
813
#-------------------------------------------------------------------------------
914
# Files
1015
#-------------------------------------------------------------------------------
@@ -37,7 +42,7 @@ O_FILES := $(INIT_O_FILES) $(EXTAB_O_FILES) $(EXTABINDEX_O_FILES) $(TEXT_O_FILES
3742
# Tools
3843
#-------------------------------------------------------------------------------
3944

40-
MWCC_VERSION := 1.2.5
45+
MWCC_VERSION := 3.0
4146

4247
# Programs
4348
ifeq ($(WINDOWS),1)
@@ -104,7 +109,7 @@ tools:
104109
$(ELF): $(O_FILES) $(LDSCRIPT)
105110
$(LD) $(LDFLAGS) -o $@ -lcf $(LDSCRIPT) $(O_FILES)
106111
# The Metrowerks linker doesn't generate physical addresses in the ELF program headers. This fixes it somehow.
107-
$(OBJCOPY) $@ $@
112+
# $(OBJCOPY) $@ $@
108113

109114
$(BUILD_DIR)/%.o: %.s
110115
$(AS) $(ASFLAGS) -o $@ $<

tools/elf2dol.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void read_elf_segments(DOL_map *map, const char *elf, uint32_t sdata_pdhr, uint3
234234
for(i=0; i<phnum; i++) {
235235
if(swap32(phdrs[i].p_type) == PT_LOAD) {
236236
uint32_t offset = swap32(phdrs[i].p_offset);
237-
uint32_t paddr = swap32(phdrs[i].p_paddr);
237+
uint32_t paddr = swap32(phdrs[i].p_vaddr);
238238
uint32_t filesz = swap32(phdrs[i].p_filesz);
239239
uint32_t memsz = swap32(phdrs[i].p_memsz);
240240
uint32_t flags = swap32(phdrs[i].p_flags);

0 commit comments

Comments
 (0)