[U-Boot] [PATCH v2 1/2] arm920t/at91/reset.c: fix weak reset_board()
Joakim Tjernlund
joakim.tjernlund at transmode.se
Thu Nov 4 02:23:25 CET 2010
Graeme Russ <graeme.russ at gmail.com> wrote on 2010/11/04 02:13:44:
>
> On Thu, Nov 4, 2010 at 12:00 PM, Joakim Tjernlund
> <joakim.tjernlund at transmode.se> wrote:
> >
> >>
> >> The arm920t compiler/linker dif not handle weak functions correctely.
> >> Therefore the linker tried to link outside the ELF (isn't that lazy
> >> linking?). This leads to segfault of linker in the end.
> >>
> >> This patch adds a empty stub for weak function reset_board() to catch
> >> that case.
> >
> > I believe this is the wrong approach.
> > Instead you should fix the relocation/fixup routine not to relocate
> > NULL ptrs. NULL ptrs are absolute values and should be left as is.
> >
> > See http://git.denx.de/?p=u-boot.git;a=commit;h=d1e0b10accdbac2e0a8b2cbf7c589645442f87c5
> > for a fix to ppc that went in recently
> >
>
> I seem to recall a discussion some time ago regarding the use of the
> "if (function())" construct versus calls to weakly defined empty functions
> but cannot remember the outcome.
Me neither.
>
> I personally think weak functions are 'cleaner' but may result in slightly
> larger and slower code due to the call overhead (is the optimiser clever
> enough to strip these out if the stub function is empty?)
No idea.
>
> Would converting all instances of "if (function())" to weak functions be
> such a bad thing?
nope, but I still think the reloc routine(s) needs to be fixed.
More information about the U-Boot
mailing list