
Dear Minkyu Kang,
In message AANLkTimgBjOSE8c+_6AsUon5KnNR1_UKNqc=Wf_UD2+J@mail.gmail.com you wrote:
int (*test_func)(void);
This results in a symbol in bss segment, right?
And then, set to NULL at arch_cpu_init()
Such an assignment is illegal then. Bss has not been initalized before relocation, and must not be accessed (neither read nor write).
Illegal? as a result, yes.
No, illegal as an action. You MUST NOT access any symbols in BSS before relocation (more precisely, before bss has been initialized).
And you MUST NOT write any symbols in data segment before relocation, either.
In both cases, the result of such actions is undefined behaviour.
But we do many things before the reloaction as arch init, board init and so on.
Of course, but as mentioned we must not read or write to symbols in bss, and we must not write to symbols in data segment.
How about lcd_setmem function? panel_info is located at bss area, but lcd_setmem access this structure. Is it illegal?
This must not be done before relocation.
Best regards,
Wolfgang Denk