methods of loading symbols
chrisj at rtems.org
Thu Aug 3 01:46:46 UTC 2017
On 02/08/2017 17:08, jaeho jo wrote:
> Thank you! You were a huge help.
> but...I have another three question..
> In my process, I had problem when I build base image and RAP
> building base image, I used Untar_FromMemory( ) in init.c and this function
> needed tar file(RAP -> tarfile -> c file) for compile.
This looks OK.
> building RAP, I used this command 'rtems-ld -v --base baseImage -e Test_task
> task.o -o app.rap'. So, rtems-ld requires a base image.
This looks OK. The base image is required so rtems-ld can see the symbols in the
base image. This is related to the way RAP format files can support pulling in
referenced object files in other libraries. It has nothing to do with the
address map of the base image. All you need to do is not remove referenced
symbols in the final link pass. if you do this the RAP file will report resolved
symbols when loaded.
> To build base image, I needed RAP and I needed base image to execute the 'rtems-ld'.
Yes, and as I have just said this is to get the list of symbols in the base
image and nothing more.
> 1. Is it common situation ? if not, Did I make a mistake ?
I do not think so.
> To solve this problem, I make a temp file using 'dd' command-line utility.
> a) At fiest, I roughly set the size of temp file
You could create an empty tar file and it would be ok, for example this works
$ tar -c -T /dev/null -f empty.tar
> b) temp file -> tarfile -> c file
Perform tarfile -> c file
> c) To build base image, Used this file
> d) To build RAP, used base image
> e) take the size of RAP
> f) set the size of temp file to RAP size
I would expect all you need to do is create the tarfile with the RAP file,
create the C file and relink the base image.
> g) rebuild base image...
> I think this way is very bad way but dynamic load is success...
The size of the RAP file should not matter if you embed the symbol table in the
base image using the '-e' or '--embedded' option. See
> 2. Is it possible to change address map in base image when I build base image
> using temp file ?
> 3. Without tempfile , How to solve that dependency proboem between building base
> image and RAP ?
A work flow could be:
1. Create empty tarfile.
2. Create C file from tarfile.
3. Create base image (you will need the C file from the tarfile)
4. Create base image symbols.
3. Compile RAP object files.
4. Create RAP file (using base image).
5. Create tarfile from RAP
6. Create C file from tarfile and build tarfile object file.
7. Relink base image with the symbols object file and tarfile object file.
8. Repeat 4 to 7 as you debug your dynamically loaded code.
a. There is little actual different doing this and directly linking the code in
the RAP file to the base image, unless of course you have other reasons.
b. You do not need to use a tarfile. You could convert the RAP file to C and
link that to the baseimage and have some code that writes that data to the IMFS.
More information about the users