Code: Select all
m68k-elf-gcc -n -T /opt/toolchains/gen/ldscripts/md.ld -nostdlib out/sega.o @out/cmd_ /opt/toolchains/gen/m68k-elf/lib/libmd.a /opt/toolchains/gen/m68k-elf/lib/gcc/m68k-elf/4.5.2/libgcc.a -o out/rom.out
/opt/toolchains/gen/m68k-elf/lib/libmd.a(memory.o): In function `MEM_init':
memory.c:(.text+0x2): undefined reference to `_bend'
collect2: ld returned 1 exit status
make: *** [out/rom.out] Error 1
Code: Select all
$ m68k-elf-nm $GDK/m68k-elf/lib/libmd.a
[...]
memory.o:
00000064 T MEM_alloc
00000052 T MEM_free
00000028 T MEM_getFree
00000000 T MEM_init
U _bend
000001b0 T fastMemcpy
000001cc T fastMemcpyU16
000001ea T fastMemcpyU32
00000154 T fastMemset
00000174 T fastMemsetU16
00000194 T fastMemsetU32
00000000 b free
00000004 b heap
U memcpy
00000116 T memcpyU16
00000134 T memcpyU32
U memset
U memsetU16
U memsetU32
[...]
Code: Select all
// end of bss segment --> start of heap
extern u32 _bend;
Code: Select all
.bss 0xFF0000 + SIZEOF (.data) :
{
_start = . ;
*(.shbss)
*(.bss .bss.*)
*(COMMON)
_bend = . ;
} > ram
If anyone wants to test the Makefile, you can find it here. You will also have to overwrite the md.ld linker file using the one from SGDK sources, and copy the src directory from SGDK to $GDK/src. I have also used $GDK variable to point to the toolchain instead of the one the build script initially set up ($GENDEV).