[rtems-tools]rtems-ld issue?

Chris Johns chrisj at rtems.org
Thu Aug 31 05:39:43 UTC 2023


On 31/8/2023 3:12 pm, zhengxiaojun wrote:
> 
> 
> 在 2023/8/31 6:05, Chris Johns 写道:
>> On 31/8/2023 12:48 am, zhengxiaojun wrote:
>>> Hi,
>>>     I use the latest rtems-tools to generate RAP file, I found the object file
>>> become too small(elf,2184bytes==>rap,736bytes) and the file loaded failed, error
>>> message like this "load app.out error:offset past end of file: offset=736
>>> size=736 error."
>>
>> What arch and BSP?
>>
>>>     I reverted the rtl-rap.cpp commit( 0ad4aaafc20afcb5aacb7a82b0b3a8150b638975
>>> linker/rap: Ignore relocation records with no section), the rap file can be
>>> loaded.
>>
>> I think the commit has the wrong ticket id, it should be 4069 ...
>>
>> https://devel.rtems.org/ticket/4069
>>
>> My guess is the length includes the relocs that have been dropped because they
>> do not have a symbol section. A reloc without a symbol section cannot be located
>> because you do not know the section to locate it against.
>>
>> Are you able to review the rtems-ld code for the issue?
>>
> I found something suspicious, get_relocations(s) return all the count of
> relocation and write to rap file, but actual count is less, because ignore the
> reloc with section=0.

Right, this aligns with my guess. That value should the number written out and
it should not assume all are written.

> This issue is similar to ticket #4781, maybe the same.

Yeah it could. It would be nice if it is.

> reduce count or write all relocs in rap ? I do not know which is the right
> solution.

I am not sure. If relocs are needed then we have to have them and the patch you
isolated is wrong or needs more understanding to know why it is there. I suspect
an arch had an issue and this was the solution but that is guess on my part.

Chris


More information about the devel mailing list