to update my current linking script, I'm "playing" with the section stuff
There is something I couldn't find a good explanation about :
With C based code, I should code this way
1/ on file.c file
Code: Select all
void func1(void) __attribute__((section(".hack")));
Code: Select all
.hack 0x000FFB20:
{
/* nothing here, if I add file.o, it won't work */
} >rom =0xFF
while with asm based code, I should write
1/ on file.asm file
Code: Select all
.section hack
.globl func1
func1:
; insert code here
Code: Select all
.hack 0x000FFB20:
{
file.o
/* if I omit file.o, like for c file, it won't work
} >rom =0xFF
so
in C : __attribut__((section())) and nothing on .ld
in asm : .section and file added to section on .ld
what does the C compiler do to avoid the file.o on .ld ?!
it'd prefer to use the file.o on .ld on C too, it would avoid to declare every function and vars of a file with __attribute__((section()))
any GCC guru ?