Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
I'm seeing a strange error when trying to link objects generated by sdcc using rgblink.
I'm not sure if this simply isn't supported or if I'm doing something wrong.
Compiling the below C code and linking with rgblink (even with only one linker input) and a basic linkerscript results in the error "FATAL: 'T' lines which don't append to their section are not supported (271 != 273)"
Removing the line marked "bad line" will make the error disappear.
Any insight would be appreciated!
const char some_text[] = "abcdefg\0";
extern void call_asm(char* text);
struct some_struct{
char x;
char y;
const char *text;
};
void some_func(void){
struct some_struct thing = {.x = 5, .y = 5, .text = some_text}; //<-- BAD LINE
call_asm(some_text);
}Offline
With SDCC 4.2.0 and RGBDS 1.0.1, I cannot reproduce this.
The linkerscript, script.link:
ROM0
FLOATING
"_HOME" OPTIONAL
"_BASE" OPTIONAL
"_CODE_0" OPTIONAL
"_LIT_0" OPTIONAL
"_INITIALIZER" OPTIONAL
"_GSINIT" OPTIONAL
"_GSFINAL" OPTIONAL
ROMX FLOATING
FLOATING
"_CODE" OPTIONAL
"_LIT" OPTIONAL
WRAM0
FLOATING
"_DATA" OPTIONAL
"_BSS" OPTIONAL
"_INITIALIZED" OPTIONAL
"_DABS (ABS)" OPTIONALA dummy .asm file for your call_asm function, bar.asm:
section "bar", rom0
_call_asm::
retAnd here's how it builds, no error message:
$ sdcc -c -msm83 -o foo.rel foo.c $ rgbasm -o bar.o bar.asm $ rgblink -l script.link -o rom.gb foo.rel bar.o $ wc -c rom.gb 32768 rom.gb $ xxd rom.gb | grep -v '0000 0000 0000 0000 0000 0000 0000 0000' 00000000: c900 0000 0000 0000 0000 0000 0000 0000 ................ 00004000: e8fc f800 3e05 2222 3e16 2236 4011 1640 ....>."">."6@..@ 00004010: cd00 00e8 04c9 6162 6364 6566 6700 0000 ......abcdefg...
(The order of objects doesn't matter; "bar.o foo.rel" works too.)
For reference, this is the SDCC output, foo.rel:
XL3 H 9 areas 4 global symbols M foo O -msm83 S _call_asm Ref000000 S .__.ABS. Def000000 A _CODE size 1F flags 0 addr 0 S _some_func Def000000 S _some_text Def000016 A _DATA size 0 flags 0 addr 0 A _INITIALIZED size 0 flags 0 addr 0 A _DABS size 0 flags 8 addr 0 A _HOME size 0 flags 0 addr 0 A _GSINIT size 0 flags 0 addr 0 A _GSFINAL size 0 flags 0 addr 0 A _INITIALIZER size 0 flags 0 addr 0 A _CABS size 0 flags 8 addr 0 T 00 00 00 R 00 00 00 00 T 00 00 00 E8 FC F8 00 3E 05 22 22 3E 16 00 00 22 R 00 00 00 00 09 0C 00 00 T 0B 00 00 36 16 00 00 11 16 00 CD 00 00 E8 04 C9 R 00 00 00 00 89 04 00 00 00 08 00 00 02 0B 00 00 T 16 00 00 R 00 00 00 00 T 16 00 00 61 62 63 64 65 66 67 00 00 R 00 00 00 00
Offline