[U-Boot] [PATCH RFC] armv7: fixloop: don't fixup if location is NULL

Wolfgang Denk wd at denx.de
Mon Jan 10 13:14:53 CET 2011


Dear Minkyu Kang,

In message <AANLkTimgBjOSE8c+_6AsUon5KnNR1_UKNqc=Wf_UD2+J at 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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Without followers, evil cannot spread.
	-- Spock, "And The Children Shall Lead", stardate 5029.5


More information about the U-Boot mailing list