[PATCH v1 4/7] ld.texi: Add ASCII to info file

Jan Beulich jbeulich@suse.com
Mon Jul 8 11:40:39 GMT 2024


On 08.07.2024 13:29, Ulf Samuelsson wrote:
> 
> Den 2024-07-08 kl. 13:18, skrev Andreas Schwab:
>> On Jul 08 2024, Ulf Samuelsson wrote:
>>
>>> Given *ASCII 16, "This is 16 bytes*"  size == 16 and strlen("This is 16
>>> bytes") == 16,
>>> the linker should add a 16 byte area without a terminating NUL,
>>>
>>> If the string is shorter, then the linker should pad with NUL.
>>>
>>> If the string is longer, then the linker should truncate the string adding
>>> a NUL
>>> at the end, still fitting in the area. A warning should be issued.
>> This inonsistency is confusing.  The directive should either always use
>> the first size characters from the string, only padding with nulls when
>> the string is shorter, or reject longer strings at all.
>>
> I do not see that the user can be confused if the user reads the warning 
> message:
> 
> "warning: ASCII string does not fit in allocated space, truncated"

Well, paying attention to this warning is just one thing. Yet even if you
do, you still won't know _how_ the truncation was carried out. And for a
directive named ASCII I for one would expect "plain" truncation. Much
like you also do not warn when size == len.

Jan


More information about the Binutils mailing list