[U-Boot] [PATCH v2 1/2] arm920t/at91/reset.c: fix weak reset_board()

Graeme Russ graeme.russ at gmail.com
Thu Nov 4 02:13:44 CET 2010


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.

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?)

Would converting all instances of "if (function())" to weak functions be
such a bad thing?

Regards,

Graeme


More information about the U-Boot mailing list