[PATCH v1 4/7] ld.texi: Add ASCII to info file
Andreas Schwab
schwab@suse.de
Mon Jul 8 11:48:12 GMT 2024
On Jul 08 2024, 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"
That does not tell the whole truth. ASCII 4, "foob" gives you a 4 byte
string, but ASCII 4, "foobar" gives you a three byte string.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the Binutils
mailing list