This is an archive of the discontinued LLVM Phabricator instance.

[LinkerScript] Support decimal values for filler
ClosedPublic

Authored by davide on Jul 29 2016, 2:41 PM.

Details

Reviewers
ruiu
Summary

Discussed with Rui on IRC

Diff Detail

Event Timeline

davide updated this revision to Diff 66176.Jul 29 2016, 2:41 PM
davide retitled this revision from to [LinkerScript] Support decimal values for filler.
davide updated this object.
davide added a reviewer: ruiu.
davide added a subscriber: llvm-commits.
ruiu added inline comments.Jul 29 2016, 2:45 PM
ELF/LinkerScript.cpp
805

Flip this condition so that you can do early return like this.

if (Tok.startswith("=0x")) {
  next();
  return parseHex(Tok.substr(3));
}
815–818

This can be return { Value }, no?

davide updated this revision to Diff 66181.Jul 29 2016, 3:01 PM
davide updated this revision to Diff 66183.Jul 29 2016, 3:12 PM

Correct patch (missed one of your comments).

ruiu accepted this revision.Jul 29 2016, 3:20 PM
ruiu edited edge metadata.

LGTM with a few nits.

ELF/LinkerScript.cpp
802

At this point, we determined we consume a token whether it's a hexadecimal or decimal, so let's move next() here, so that you can remove the following two next()s.

808

This should be an unsigned int. Otherwise Value > 255 is always false.

809

This can be Tok.substr(1).getAsInteger

This revision is now accepted and ready to land.Jul 29 2016, 3:20 PM
davide closed this revision.Jul 29 2016, 3:29 PM
davide added inline comments.
ELF/LinkerScript.cpp
38

Ignore this #include, it's a leftover from a previous experiment.