Re: [rtems-tools]rtems-ld issue?

2023-09-03 Thread zhengxiaojun



在 2023/8/31 13:39, Chris Johns 写道:

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.


I tried to make the length fit the relocs write to rap file, the file 
can not be loaded, it crashed. So the relocs(reloc.symsect == 0) can not 
be ignored, at least in arm.




In addition, I saw a loader complaint "rtl: unsupported section:..." 
about .ARM.attributes, the arm linkcmds always keep it.

Should it be dealt with?




Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [rtems-tools]rtems-ld issue?

2023-09-03 Thread Chris Johns
On 4/9/2023 4:50 pm, zhengxiaojun wrote:
> 
> 
> 在 2023/8/31 13:39, Chris Johns 写道:
>> 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.
> 
> I tried to make the length fit the relocs write to rap file, the file can not 
> be
> loaded, it crashed. So the relocs(reloc.symsect == 0) can not be ignored, at
> least in arm.

Can you please open a ticket and can you please add the code to build into the
RAP with the commands you are using? A script would help.

> In addition, I saw a loader complaint "rtl: unsupported section:..." about
> .ARM.attributes, the arm linkcmds always keep it.
> Should it be dealt with?

The RTL may need to be taught to ignore the section.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel