<div><div><br></div><div>On 12/10/18 10:05 am, Joel Sherrill wrote:</div><div>>> </div><div>>> </div><div>>> On Thu, Oct 11, 2018 at 11:45 PM jameszxj <jameszxj@gmail.com</div><div>>> <mailto:jameszxj@gmail.com>> wrote:</div><div>>> </div><div>>>     HI,</div><div>>>         I run RTEMS on my xilinx z7k board and dynamic load application(RAP</div><div>>>     format) from shell.</div><div>>>     In recent update, i encount a link error when link the RAP file.</div><div>>>     Here is the command and output message:</div><div>>>                     rtems-ld -n -e PT_Init --base rtems-nsa.elf</div><div>>>     wsp/build/nssys.elf -o wsp/build/nssys.out</div><div>>>                     error: rap::object: Section index '65522' not found:</div><div>>>     wsp/build/nssys.elf</div><div>>> </div><div>>>         At last I found the bsp_spec file has been modified,  "*link:%{!qrtems:</div><div>>>     %(old_link)} %{qrtems: -dc -dp -N}" was removed</div><div>>>     from the bsp_spec file.  Add this line to the file, ld is OK.</div><div>>>        Why removed these lines?</div><div>>> </div><div>>> </div><div>>> The long-term goal is to remove the bsp_specs. I made a sweep making them more</div><div>>> consistent and have a set of patches against gcc master which eliminates them on</div><div>>> many architectures. Working so the details are implied by GCC.</div><div>>> </div><div>>> So let's look at the options and see which one has an impact which mattered that</div><div>>> I didn't catch. This is the description of these options from ld's man page:</div><div>>> </div><div>>>       -N</div><div>>>        --omagic</div><div>>>            Set the text and data sections to be readable and writable.  Also,</div><div>>>            do not page-align the data segment, and disable linking against</div><div>>>            shared libraries.  If the output format supports Unix style magic</div><div>>>            numbers, mark the output as "OMAGIC". Note: Although a writable</div><div>>>            text section is allowed for PE-COFF targets, it does not conform to</div><div>>>            the format specification published by Microsoft.</div><div>>> </div><div>>>       -d</div><div>>>       -dc</div><div>>>        -dp These three options are equivalent; multiple forms are supported</div><div>>>            for compatibility with other linkers.  They assign space to common</div><div>>>            symbols even if a relocatable output file is specified (with -r).</div><div>>>            The script command "FORCE_COMMON_ALLOCATION" has the same effect.</div><div>>> </div><div>>> I'm going to guess that it is -dc/-dp but have no idea how this would impact RAP</div><div>>> except to confuse the code. </div><div>>> </div><div>>> Can you try adding adding the options one at a time until you make it work? Then</div><div>>> Chris can figure out why it breaks RAP.></div><div><br></div><div>I have tried this,just add -dc/-dp do not make it work.</div><div><br></div><div>>I suspect there is a section that is present which is needed that is not being</div><div>>handled in the RAP toolkit code. That RAP format merges some sections in rtems-ld.></div><div><br></div><div>Probably like this, and I just test it use just one simple source file, uninitialized variable</div><div>cause this error. If I initialize the variable, link is fine.</div><div><br></div><div>>James, if you can make a test file that generates the error then create a ticket</div><div>>and attach the code I can take a look.></div><div><br></div><div>>> </div><div>>>        Does the newest RTEMS support the loading of incrementally linked ELF</div><div>>>     files? RAP format runs OK, but the link needs BSP image, this</div><div>>>     make BSP's development and APP's development not so independent. a little</div><div>>>     pity, :)</div><div>>> </div><div>>> This is a Chris question.</div><div>>> </div><div>>James, if you do not provide a base image, ie no --base option, what happens?></div><div><br></div><div>I am trying to figure out the problem, it maybe has sth. to do with the --nostdlib option,</div><div>I need to do more tests. I shall describe the problem more clear later on.</div><div><br></div><div>>Chris</div></div>