Отв.: Shared library link

Chris Johns chrisj at rtems.org
Sun Sep 25 22:48:33 UTC 2011


On 24/09/11 4:01 PM, Oleg Moroz wrote:
> Okay. The reason why i want extract functions from shared or static
> library is dynamical achange parts of code.

In the traditional definition dynamic and static libraries are not the 
same type of code. They can varying depending on the specific method 
used by the operating system. As Joel stated RTEMS is a single address 
space or processes and will not support the Unix (ELF) shared library 
model. It adds overhead for no gain. Given this I am not sure I 
understand your sentence. For example have you built shared RTEMS 
libraries (the tools will let you do this) and static libraries and are 
you attempting to mix the results ?

> Now i have small app than
> can parse elf file and extract machine code of ever Task (or another
> functions).

I suggest you take a look at:

  http://www.rtems.org/ftp/pub/rtems/people/chrisj/rtl/

I have a host based linker in development. I thought I had a copy on the 
server but I do not. I will upload a version soon.

The path I have taken to create a runtime link editor in RTEMS that can 
load ELF relocatable object files directly or from archive files and 
resolve any external symbols as well as export any suitable symbols. 
This is all via the dlopen call. I have an RTEMS linker in development 
which handles the dependence resolution providing a suitable meta-data 
format. This project is still in development.

Note, this RTEMS project uses waf so check the README.

> Problem is what the addresses of all functions in the
> recompiled project (with some bug fixes or functionality added) are not
> the same with original project.

The object files are relocatable. You need a link editor to locate the 
object files and fix up the addresses.

> I must fix it manually, but this is the
> easiest way to make an error. I think than i can create the library with
> all functions. and addresses of that funcs are constant.

What happens when the size of the code changes ?

> after this i
> could link it with my extracted updated task. extract task again,
> and overwrite it on working RTEMS. Maybe linker or compiler has some
> command switch? Something like - Ttext=0x40100000

Sorry, but I do not understand this.

Chris



More information about the users mailing list