[lld] r277222 - [LinkerScript] Filler can have a decimal value.
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 2 15:27:41 PDT 2016
On 2 August 2016 at 18:03, Davide Italiano <davide at freebsd.org> wrote:
> On Tue, Aug 2, 2016 at 5:59 AM, Rafael EspĂndola
> <rafael.espindola at gmail.com> wrote:
>>> + next();
>>> + if (Tok.startswith("=0x"))
>>> + return parseHex(Tok.substr(3));
>>
>> This is missing the error check for Value below.
>>
>
> My understanding is that we support arbitrary hex values, the
> restriction is only for decimal.
Why?
>>> + // This must be a decimal.
>>> + unsigned int Value;
>>> + if (Tok.substr(1).getAsInteger(10, Value)) {
>>> + setError("filler should be a decimal/hexadecimal value");
>>> return {};
>>> }
>>> - Tok = Tok.substr(3);
>>> - next();
>>> - return parseHex(Tok);
>>> + if (Value > 255)
>>> + setError("only single bytes decimal are supported for the filler now");
>>
>> I think you can just pass a base of 0 to getAsInteger and it will
>> detect the base.
>>
>
> I'm fine with this, but at this point we can also accept octals, and
> I'm not sure we want to do that. Does this make sense?
A quick check shows that both bfd and gold do support octal. Since
that actually makes the code simpler, I would be for it.
Thanks,
Rafael
More information about the llvm-commits
mailing list