[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Parallella Community • View topic - an elf loader prototype

an elf loader prototype

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

an elf loader prototype

Postby notzed » Fri Sep 27, 2013 5:00 am

I have grander plans but to nut out some details I threw together a basic elf loader this morning. I've only tested it on core 0,0 in a group and it wont handle multi-core elf files but it's still useful in it's current (incomplete) form.

The source drop is available here:


It includes a simple example that works on parallella-16 (at least). It's setup for compiling on-host.

The loader itself is simpler & faster than the srec loader and allows for symbolic resolution as demonstrated by the example. TBH i'm kind of baffled why the current sdk even includes an srec thing since elf is designed specifically to allow for minimal loader code. Last (and only) time i used srec was 20 years ago at uni ...

edit: I moved the location of the file.
Last edited by notzed on Tue Mar 04, 2014 7:35 am, edited 1 time in total.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: an elf loader prototype

Postby ysapir » Fri Sep 27, 2013 2:01 pm

Thanks, @notzed, this is great. I actually started working on a similar loader a couple of days ago, but trying to follow the libelf-by-example tutorial utilizing the libelf library (). The obvious motivation for using this is to have a more future-proof solution than hard-coded pointer references, etc. (think 64-bit Epiphany, for example).

To your question - the reason why we use SREC's is purely legacy. Our previous, PC based EMEK systems used a different e-loader/e-server system and the original developer used the SREC as an intermediate step. When we developed the e-host library (the former incarnation of e-hal), the goal was to get a working interface ASAP - which we thought would be easiest by reusing the bulk of the loader code. At the time I was totally unfamiliar with the ELF system, not knowing the depth of the water, so SREC seems like a good enough compromise.

One thing I am not sure of - in your program you ignore the section headers table. My understanding is that the sections contain data used by the compiler and linker and not by the loader. If this is true, then ignoring those at load time is OK. Well - is this true? Are all loadable data (string tables, initialized static arrays, etc.) located in the program segments pointed to by program headers?
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm

Re: an elf loader prototype

Postby G33KatWork » Fri Sep 27, 2013 4:29 pm

G33KatWork
 
Posts: 4
Joined: Fri Sep 27, 2013 4:23 pm

Re: an elf loader prototype

Postby ysapir » Fri Sep 27, 2013 4:49 pm

Thanks. Seems like we understand the "theory" the same way. I already used readelf to inspect simple Epiphany programs, which seem to adhere to these concepts. Strictly speaking, though, the fact that a couple of examples work well, does not mean that there will be no odd situation where using specific compiler and linker options, or a language other than C, will end up placing loadable data in the sections tables. This was the source of my concern. But I guess it is alright.

BTW, if we decide to go with the direct approach for elf parsing, can I re-use your code?
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm

Re: an elf loader prototype

Postby G33KatWork » Fri Sep 27, 2013 4:58 pm

G33KatWork
 
Posts: 4
Joined: Fri Sep 27, 2013 4:23 pm

Re: an elf loader prototype

Postby notzed » Sat Sep 28, 2013 1:32 am

notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 67 guests