rtems-rtl for powerpc

Aleksandr Platonov pam at oktetlabs.ru
Tue Mar 19 14:33:55 UTC 2013


On Tue, 2013-03-19 at 08:04 +1100, Chris Johns wrote:
> Aleksandr Platonov wrote:
> > I am currently trying to add support for powerpc in my local copy
> > (copied some files from netbsd sources into libbsd/include/arch/powerpc
> > directory, patched rtl-mdreloc-powerpc.c, etc)
> 
> Great.
> 
> > But I got the following error at waf -v -v
> > 13:42:09 runner ['/home/pam/trans/rtems_powerpc/gcc-ppc/bin/rtems-ld',
> > '--base', 'rtld.prelink', '--entry', 'my_main', '--cc',
> > '/home/pam/trans/rtems_powerpc/gcc-ppc/bin/powerpc-rtems-gcc',
> > 'xa.c.7.o', 'x-long-name-to-create-gnu-extension-in-archive.c.7.o',
> > '-o', '/home/pam/trans/rtems-rtl/build/powerpc-rtems-mpc5200/x.rap',
> > '-Wl,-Bstatic']
> > error: libelf:elf_getdata: .gnu.attributes(xa.c.7.o): Invalid section
> > descriptor
> >
> 
> Hmm, are you able to put the rtl-host sources (diffs) and object files 
> somewhere I can download ?
I have no local changes in rtl-host (except updated libelf).
My xa.c.7.o and x-long-name-to-create-gnu-extension-in-archive.c.7.o
could be found here: http://oktetlabs.ru/~pam/rtems-rtl/
Also there could be found modified rtl-mdreloc-powerpc.c and headers
which I added into into libbsd/include/arch/powerpc (in powerpc.tgz)

> What happens if you use a different output format, ie script ?
Changing output format does not help. The problem happens at
cache.open() call in rtems-ld.cpp.

> > When I run readelf -a x.c.7.o I have no errors and see the
> > following .gnu.attributes section information:
> > Section Headers:
> >    [Nr] Name              Type            Addr     Off    Size   ES Flg
> > Lk Inf Al
> >    [19] .gnu.attributes   LOOS+ffffff5    00000000 000ee7 000014 00
> > 0   0  1
> 
> I am not sure we need this type of section. I have not looked into the 
> PowerPC in detail.
So, if we do not need sections with this type then patch could be like
this:
diff --git a/rld-elf.cpp b/rld-elf.cpp
index c8e7aa1..596bf61 100644
--- a/rld-elf.cpp
+++ b/rld-elf.cpp
@@ -179,7 +179,7 @@ namespace rld
       if (!::gelf_getshdr (scn, &shdr))
         libelf_error ("gelf_getshdr: " + file_.name ());
 
-      if (shdr.sh_type != SHT_NULL)
+      if (shdr.sh_type != SHT_NULL && shdr.sh_type <= SHT_SYMTAB_SHNDX)
       {
         name_ = file_.get_string (shdr.sh_name);
         data_ = ::elf_getdata (scn, 0);

> >
> > Is rtems-ld (rtl-host) should be build with some extra flags when target
> > arch differs with host arch? I have no such error with the same rtems-ld
> > when running waf command for i386-rtems.
> >
> 
> The i386 is one of the platforms I have been testing on.
> 
> > I have updated libelf for rtl-host in my local copy but this does not
> > help.
> 
> It is in the rtems-ld code somewhere. It may in the generation of the 
> RAP format file.
> 
> Chris





More information about the users mailing list