[U-Boot] [PATCH RFC 3/3] arm920t: do not relocate NULL pointer
Joakim Tjernlund
joakim.tjernlund at transmode.se
Tue Nov 30 10:41:19 CET 2010
Albert ARIBAUD <albert at aribaud.net> wrote on 2010/11/30 10:02:45:
>
> Le 30/11/2010 09:47, Joakim Tjernlund a écrit :
> >>
> >> Le 30/11/2010 08:06, Andreas Bießmann a écrit :
> >>> Signed-off-by: Andreas Bießmann<andreas.devel at googlemail.com>
> >>
> >>> + cmp r1, #0 /* symbol == NULL ? */
> >>> + beq fixnext
> >>
> >> Nak. Don't hide a null pointer. NULL pointers are *not* relocated, since
> >> they are a constant. If a NULL ends up in relocation tables, that is
> >> because of a corruption *or* because it was to be relocated, and should
> >> thus never be ignored.
> >
> > Depends, if the same routine is used for relocating fixups you need
> > this test. Undefined weaks will generate a NULL fixup entry.
>
> Understood.
note that I don't know how this routine is used so if just
relocates the GOT you don't need to test for NULL.
>
> Weren't there an effort to not use weak symbols any more?
ehh, not what I am aware of. Just that we should not use(ATM)
undefined weaks.
>
> If not, then a comment *must* be added to indicate that weak symbols can
> cause zero-filled reloc entries (I would suggest saying 'zero-filled'
> rather than 'NULL', because obviously readers will think of stdio's NULL).
zero-filled/NULL fixup entries. The GOT never holds NULL
>
> We could possibly even send out a diagnostic message, but that'll be
> when the relocation code is turned to C language; I don't want to see
> asm code that calls printf.
No need really.
More information about the U-Boot
mailing list