[ECOS] RE: eCos Loader

David Bonfrer ecos@bonfrer.com
Thu Apr 28 15:39:00 GMT 2005


Where did it go wrong in your dynamic loader?

I now have the relocation types R_386_GLOB_DAT and R_386_JMP_SLOT 
implemented.

I only used pointers, mallocs and file I/O(read and lseek) so it should 
be usable on all platforms.


Nick Garnett wrote:

>"David Bonfrer" <ecos@bonfrer.com> writes:
>
>  
>
>>The GOT and PLT are no problem, I already have those working,
>>    
>>
>
>I don't know which architecture you are working on, but I suspect you
>have been lucky.
>
>  
>
>>I loaded the
>>following module:
>>
>>----- Begin
>>
>>#include <cyg/infra/diag.h>
>>int a = 1;
>>int b = 2;
>>int c = 3;
>>
>>void optel() {
>>	a += 1;
>>	b += a;
>>	c += b;
>>}
>>
>>void print() {
>>	diag_printf("Testfile: TEST_OK\n");
>>}
>>
>>----- End
>>
>>    
>>
>
>Yep, that's about as far as I got before realizing that there were
>many more hurdles to overcome, particularly the toolchain issues I
>mentioned before.
>
>
>  
>
>>Both optel and print are working. 
>>But diag_printf is hardcoded in my code. 
>>If you put "foo("Testfile: TEST_OK\n");" It does exactly the same now.
>>
>>I was wondering, I do use location = *diag_printf in my code, that uses the
>>symbol table of the main ecos lib. I thought maybe there is a way to access
>>it, and get the right pointer locations from there.
>>    
>>
>
>I'm not really sure what you mean here. You should be resolving any
>symbols in the loaded library against the symbol table in the
>main executable. However, for this to happpen, the main executable
>must have been linked against the load library to build its symbol
>table. 
>
>
>
>
>  
>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list