Link RAP file error on zynq BSP

Chris Johns chrisj at rtems.org
Fri Oct 12 22:43:19 UTC 2018



On 12/10/18 10:05 am, Joel Sherrill wrote:
> 
> 
> On Thu, Oct 11, 2018 at 11:45 PM jameszxj <jameszxj at gmail.com
> <mailto:jameszxj at gmail.com>> wrote:
> 
>     HI,
>         I run RTEMS on my xilinx z7k board and dynamic load application(RAP
>     format) from shell.
>     In recent update, i encount a link error when link the RAP file.
>     Here is the command and output message:
>                     rtems-ld -n -e PT_Init --base rtems-nsa.elf
>     wsp/build/nssys.elf -o wsp/build/nssys.out
>                     error: rap::object: Section index '65522' not found:
>     wsp/build/nssys.elf
> 
>         At last I found the bsp_spec file has been modified,  "*link:%{!qrtems:
>     %(old_link)} %{qrtems: -dc -dp -N}" was removed
>     from the bsp_spec file.  Add this line to the file, ld is OK.
>        Why removed these lines?
> 
> 
> The long-term goal is to remove the bsp_specs. I made a sweep making them more
> consistent and have a set of patches against gcc master which eliminates them on
> many architectures. Working so the details are implied by GCC.
> 
> So let's look at the options and see which one has an impact which mattered that
> I didn't catch. This is the description of these options from ld's man page:
> 
>       -N
>        --omagic
>            Set the text and data sections to be readable and writable.  Also,
>            do not page-align the data segment, and disable linking against
>            shared libraries.  If the output format supports Unix style magic
>            numbers, mark the output as "OMAGIC". Note: Although a writable
>            text section is allowed for PE-COFF targets, it does not conform to
>            the format specification published by Microsoft.
> 
>       -d
>       -dc
>        -dp These three options are equivalent; multiple forms are supported
>            for compatibility with other linkers.  They assign space to common
>            symbols even if a relocatable output file is specified (with -r).
>            The script command "FORCE_COMMON_ALLOCATION" has the same effect.
> 
> I'm going to guess that it is -dc/-dp but have no idea how this would impact RAP
> except to confuse the code. 
> 
> Can you try adding adding the options one at a time until you make it work? Then
> Chris can figure out why it breaks RAP.

I suspect there is a section that is present which is needed that is not being
handled in the RAP toolkit code. That RAP format merges some sections in rtems-ld.

James, if you can make a test file that generates the error then create a ticket
and attach the code I can take a look.

> 
>        Does the newest RTEMS support the loading of incrementally linked ELF
>     files? RAP format runs OK, but the link needs BSP image, this
>     make BSP's development and APP's development not so independent. a little
>     pity, :)
> 
> This is a Chris question.
> 
James, if you do not provide a base image, ie no --base option, what happens?

Chris



More information about the devel mailing list