This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Linkerscript: do not fail on additional semicolons in linkerscript.
ClosedPublic

Authored by grimar on Jan 30 2017, 3:51 AM.

Details

Summary

Linux kernel linkerscript contains additional semicolon (last line):

.apicdrivers : AT(ADDR(.apicdrivers) - LOAD_OFFSET) {
  __apicdrivers = .;
  *(.apicdrivers);

I checked that both gold and bfd are able to parse something like:

.text : { ;;*(.text);;S = 0;; } }

Patch do the same.

Diff Detail

Event Timeline

grimar created this revision.Jan 30 2017, 3:51 AM
jhenderson added inline comments.
ELF/LinkerScript.cpp
1497

Slight grammar issue here - I think this should say something like "Commands may be surrounded by unnecessary additional semicolons", or better yet something like "Unnecessary semicolons are permitted here, but should be ignored."

grimar updated this revision to Diff 86283.Jan 30 2017, 7:17 AM
  • Addressed review comments.
ELF/LinkerScript.cpp
1497

Fixed, thanks.

This revision was automatically updated to reflect the committed changes.
ruiu added inline comments.Jan 31 2017, 12:48 PM
lld/trunk/ELF/LinkerScript.cpp
1497–1498 ↗(On Diff #86392)

This is indeed better, but I think a more natural description about the grammar is that empty commands are allowed.