[GSOC2013] Dynamic object file loading
chrisj at rtems.org
Thu Apr 18 23:04:09 UTC 2013
Peng Fan wrote:
> There are symbols in main.c that understand the tar file. Is
> something wrong with them ?
> I looked insight into the code and found that
> the fs-root.tar is untared by setup_rootfs->Untar_FromMemory.
> Is it becasue the tar version on my host pc does not match Untar_* in
> I follow the compilation log to clarify how waf works and how
> fs-root.tar is compiled into rtld.look at the following:
> 1. shell-init libx.a -> fs-root.tar -> fs-root-tarfile.o
Yes using objcopy.
> 2. init.c.5.o main.c.5.o fs-root-tarfile.o -lrtl -> rtld.prelink
Link it together.
> 3. nm rtld.prelink -> rtld-gsyms.c
Get the symbols present in the base image.
> 4. init.c main.c rtld-gsyms.c xa.c x-long-name...-in-archive.c
> -> x.rap
Create the RAP app.
> 5. shell-init libx.a x.rap -> fs-root.tar -> fs-root-tarfile.o
Build the tar file.
> 6. init.c.10.o main.c.10.o fs-root-tarfile.o rtld-gsyms.10.o -lrtl -> rtld
Relink with the symbol table generated so the base image has its own
> I also objdump the code to see if any address is wrong, but all is ok.
> Now what I doubt is only verison mismatch.
> A question that I want your answer, is the rtld.prelink only used for
> generating rtld-gsymcs.c? I think it is, but not sure.
Yes. You need to perform a link so the needed symbols are pulled into
the kernel. Once you have these symbols you can generate a symbol table
and then relink. The original base image has a weak symbol which is
overridden with the real symbol table.
> When modified the rtems.py with "d.endswith('-rtems*eabi*' + version)",
The RTEMS tools are arm-rtems4.11. As far as I know there is no need for
'eabi' to be present in the tools any more.
> It tells "error: libelf:elf_getdata: .ARM.attributes(xa.c.8.o): Invalid
> section descriptor"
This is the bug.
> I may dig into rtl-host code to figure out why and this may be part of
> the work that I should focus on
Thanks. It will be in the ELF section parsing somewhere.
> The project need work to implement more architectures. I am
> traveling at the moment and will be back later in the week. A
> proposal to work on these other archs would be welcome.
> I want to implement arm support first. If time permits, I will implement
> mips too.
> Now I can not evaluate the workload whether I can finish one, two or
> more. I am preparing the proposal and it'll be finished soon.
More information about the devel