All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilko Iliev <iliev@ronetix.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] at91: board specific lowlevel_init.S
Date: Wed, 22 Oct 2008 17:49:25 +0200	[thread overview]
Message-ID: <48FF4B85.7010004@ronetix.at> (raw)
In-Reply-To: <20081022150656.GC15487@game.jcrosoft.org>

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 16:01 Wed 22 Oct     , Ilko Iliev wrote:
>   
>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>     
>>> On 15:07 Wed 22 Oct     , Ilko Iliev wrote:
>>>   
>>>       
>>>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>>     
>>>>         
>>>>> On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Dear Mr. Denk,
>>>>>>
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> Dear Ilko Iliev,
>>>>>>>
>>>>>>> In message <48FDFCA0.4090608@ronetix.at> you wrote:
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>>>>> Maybe instead of adding mor #ifdef'ery here, we can turn
>>>>>>>>> lowlevel_init() into a "weak" function that can be redefined by board
>>>>>>>>> specific code?
>>>>>>>>>                 
>>>>>>>>>               
>>>>>>>>>                   
>>>>>>>> The lowlevel_init() is an assembler function called from another  
>>>>>>>> assembler function and the attribute .weak doesn't work.
>>>>>>>>             
>>>>>>>>             
>>>>>>>>                 
>>>>>>> What do you mean by "attribute .weak doesn't work" ?
>>>>>>>
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>>>> There are no assembler file in the U-BOOT tree which use weak functions.
>>>>>>>> Do you know how can I make an assembler function weak?
>>>>>>>>             
>>>>>>>>             
>>>>>>>>                 
>>>>>>> Well, if you don't know, then don't ask me, ask your compiler - he
>>>>>>> knows how to do this.
>>>>>>>
>>>>>>> For example, common/cmd_boot.c has this code snippet right at the
>>>>>>> beginning:
>>>>>>>
>>>>>>>  30
>>>>>>>  31 /* Allow ports to override the default behavior */
>>>>>>>  32 __attribute__((weak))
>>>>>>>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
>>>>>>>  34 {
>>>>>>>  35         return entry (argc, argv);
>>>>>>>  36 }
>>>>>>>
>>>>>>> Compile this with -S option, and you get this:
>>>>>>>
>>>>>>>  12 .Ltext0:
>>>>>>>  13         .align 2
>>>>>>>  14         .weak   do_go_exec
>>>>>>>  15         .type   do_go_exec, @function
>>>>>>>  16 do_go_exec:
>>>>>>>  17 .LFB87:
>>>>>>>  18         .file 1 "cmd_boot.c"
>>>>>>>  19         .loc 1 34 0
>>>>>>>  20 .LVL0:
>>>>>>>  21         mflr 0
>>>>>>>  22 .LCFI0:
>>>>>>>  23         stwu 1,-16(1)
>>>>>>> ...
>>>>>>>
>>>>>>>
>>>>>>> So to me it seems as if the attribute .weak is supposed to work just fine.
>>>>>>>
>>>>>>> What exactly is not working for you?
>>>>>>>
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>> With ".weak lowlevel_init" the function is marked as weak (I can see  
>>>>>> this in the ELF file) but it is not overwritten from the another  
>>>>>> lowlevel_init().
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> try
>>>>>       
>>>>>           
>>>   
>>>       
>>>>>   
>>>>>       
>>>>>           
>>>> I tried and the result is:
>>>> lowlevel_init.S:32: Error: junk at end of line, first unrecognized  
>>>> character is `='
>>>>
>>>>     
>>>>         
>>> 	sorry try this
>>>
>>> 	.global __default_lowlevel_init
>>> 		.....
>>> 	.weak	lowlevel_init
>>> 	.set	lowlevel_init,__default_lowlevel_init
>>>
>>> 	after in the other asm
>>> 	.global lowlevel_init
>>> 		.......
>>>
>>> Best Regards,
>>> J.
>>>   
>>>       
>> Still doesn't work - the lowlevel_init is weak, but not overwritten.
>>
>> It works only if the second (strong) function is in the same archive.
>> Maybe this is a bug of the linker.
>>
>>     
> Do you specify that the 2 is type "func"
>   
The following variants don't work:

Variant A:
.globl lowlevel_init
.weak  lowlevel_init
.type  lowlevel_init,function
lowlevel_init:
   .......

Variant B:
.globl __default_lowlevel_init
.weak    lowlevel_init
.set    lowlevel_init,__default_lowlevel_init
.type   __default_lowlevel_init,function
lowlevel_init:
   .......


-- 
Mit freundlichen Gr??en/With best regards,
Ilko Iliev
Ronetix Development Tools GmbH
Waidhausenstrasse 13/5
1140 Vienna, Austria
Tel: +43 1 956 3138 
Tel: +43 720 500 315
Fax: +43 1 8174 955 3464 
E-Mail: iliev at ronetix.at
Web: www.ronetix.at
VAT: ATU63916016
Ronetix GmbH - 1140 Vienna - Gesch?ftsf?hrer: Ilko Iliev
Registergericht: HG Vienna, FN 304979z

  reply	other threads:[~2008-10-22 15:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 13:41 [U-Boot] [PATCH] at91: board specific lowlevel_init.S Ilko Iliev
2008-10-21 13:58 ` Wolfgang Denk
2008-10-21 16:00   ` Ilko Iliev
2008-10-21 16:43     ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-21 19:08     ` Wolfgang Denk
2008-10-22 11:12       ` Ilko Iliev
2008-10-22 12:41         ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-22 13:07           ` Ilko Iliev
2008-10-22 13:22             ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-22 14:01               ` Ilko Iliev
2008-10-22 15:06                 ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-22 15:49                   ` Ilko Iliev [this message]
2008-10-27 15:52                   ` Ilko Iliev
2008-10-27 16:27                     ` Ben Warren
2008-10-27 16:43                       ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-27 17:44                         ` Ilko Iliev
2008-10-27 21:27                           ` Wolfgang Denk
2008-10-27 21:20                         ` Wolfgang Denk
2008-10-28  6:24                           ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-28 11:45                             ` Ilko Iliev
2008-10-30 20:47                               ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-05 17:29                                 ` Ilko Iliev
2008-11-05 17:37                                   ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-05 21:33                                     ` Wolfgang Denk
2008-11-06 15:03                                     ` Ilko Iliev
2008-11-06 15:07                                     ` Ilko Iliev

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=48FF4B85.7010004@ronetix.at \
    --to=iliev@ronetix.at \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.