public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] arm920t/at91/reset.c: fix weak reset_board()
Date: Thu, 04 Nov 2010 11:41:48 +0100	[thread overview]
Message-ID: <4CD28DEC.5090300@gmail.com> (raw)
In-Reply-To: <OF80CA2F2B.E56BBB8C-ONC12577D1.00076C28-C12577D1.0007A321@transmode.se>

Dear all,

Am 04.11.2010 02:23, schrieb Joakim Tjernlund:
> Graeme Russ <graeme.russ@gmail.com> wrote on 2010/11/04 02:13:44:
>>
>> On Thu, Nov 4, 2010 at 12:00 PM, Joakim Tjernlund
>> <joakim.tjernlund@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.

This is ok and should be fixed in reloc routine. But it seems these
undefined weak functions are _not_ null for me (have to check this ...).

>> 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.

It seems my linker do not strip these functions. As Sebastian pointed
out the linker adds .plt sections for these undefined weak functions. Do
we use the linker in right way?

>> 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.

If reloc routine is defective, it will be fixed ... currently the link
of weak functions is the bigger problem. Without the empty stub for
reset_board() my linker segfaults. Can please one test this issue with
e.g. ELDK or other toolchains? CS 2010-q1 is known to be defective too!

To test the described issue use '[PATCH v3] arm920t: implement elf
relocation' and build for at91rm9200ek.

regards

Andreas Bie?mann

  parent reply	other threads:[~2010-11-04 10:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-31  7:11 [U-Boot] ARM: problems with elf relocation on arm920t / maybe toolchain related Andreas Bießmann
2010-10-31  7:25 ` [U-Boot] [PATCH RFC] arm920t: implement elf relocation Andreas Bießmann
2010-10-31  7:28   ` Albert ARIBAUD
2010-10-31  7:39     ` Andreas Bießmann
2010-10-31  7:49       ` Albert ARIBAUD
2010-11-03 23:21 ` [U-Boot] [PATCH v2 1/2] arm920t/at91/reset.c: fix weak reset_board() Andreas Bießmann
2010-11-04  1:00   ` Joakim Tjernlund
2010-11-04  1:13     ` Graeme Russ
2010-11-04  1:23       ` Joakim Tjernlund
2010-11-04  3:27         ` Sebastien Carlier
2010-11-04 10:54           ` Andreas Bießmann
2010-11-04 11:12             ` Sebastien Carlier
2010-11-04 10:41         ` Andreas Bießmann [this message]
2010-11-03 23:21 ` [U-Boot] [PATCH v2 2/2] arm920t: implement elf relocation Andreas Bießmann
2010-11-03 23:29   ` [U-Boot] [PATCH v3] " Andreas Bießmann
2010-11-04  6:14     ` Albert ARIBAUD
2010-11-04 10:15       ` Andreas Bießmann
2010-11-04 12:37         ` Albert ARIBAUD
     [not found]   ` <sebastien.carlier@2d91f447722561d137e769820c0e333bcce282ff>
2010-11-20 11:48     ` [U-Boot] [PATCH v2 2/2] " Andreas Bießmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CD28DEC.5090300@gmail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox