[lld] r277222 - [LinkerScript] Filler can have a decimal value.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 15:29:06 PDT 2016


On Tue, Aug 2, 2016 at 3:27 PM, Rafael EspĂ­ndola <
llvm-commits at lists.llvm.org> wrote:

> 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?


In this context 0xbeef is different from 0x0000beef. The former is 2 byte
padding while the latter is 4 bytes.


> >>> +  // 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
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160802/1c4e3eb3/attachment.html>


More information about the llvm-commits mailing list