--wrap ld functionality does not work with Init RTEMS function

Joel Sherrill joel.sherrill at OARcorp.com
Tue Apr 8 17:53:55 UTC 2008


Thomas Dörfler wrote:
> Hi,
>
> Joel Sherrill schrieb:
>   
>> Aitor.Viana.Sanchez at esa.int wrote:
>>
>>     
>>> Hi all,
>>>
>>> does anybody knows why when trying to wrap the Init RTEMS function
>>> with the ld --wrap functionality everything compiles well but
>>> eventually the wrapper function is not executed?
>>>
>>> Maybe I am missing something, but is taking me a while to discover why.
>>>
>>>
>>>       
>> Init is a task/thread and threads will not return to the wrapper.
>> They are entered but exit via rtems_task_delete or pthread_exit.
>>
>> I would expect the wrapper to be entered, then Init but no return
>> from Init.
>>
>>     
> Normally Init will be referenced from within the same module: The
> "init.c" module contains the first task AND the default list in init
> tasks (somehwere deep down in system.h -> confdefs.h). And therefore I
> would expect that the pointer in the list of init tasks will point to
> the REAL function, no matter how it might have been renamed.
>
> Does this make sense?
>   
Hmmm.. that is also a distinct possibility.  I wonder if --wrap
takes into account indirect function pointers.

It does appear to work though.  See the attachment I compiled
natively like this:

gcc -o wrapped wrapped.c -Wl,--wrap=malloc && ./wrapped

I think wrapping thread bodies is the issue.  No execution flow
out of the body.

--joel
> wkr,
> Thomas.
>
>   
>>> Regards,
>>>
>>> Aitor
>>>
>>>       
>>
>>     
>
>
> --
> --------------------------------------------
> embedded brains GmbH
> Thomas Doerfler           Obere Lagerstr. 30
> D-82178 Puchheim          Germany
> Tel. : +49-89-18 90 80 79-2
> Fax  : +49-89-18 90 80 79-9
> email: Thomas.Doerfler at embedded-brains.de
> PGP public key available on request
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>   


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985


-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrapped.c
Type: text/x-csrc
Size: 584 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20080408/dfa1ada8/attachment.bin>


More information about the users mailing list