[PATCH] [lld] Teach LLD how to parse complete linker scripts

Rafael Auler rafaelauler at gmail.com
Sat Oct 25 01:51:11 PDT 2014


Addressed Sean's concerns and tested the dump'ed scripts. This required adjusting some cosmetic issues to make dump'ed scripts 100% parseable by GNU ld. Also added other missing features to parse other kernel linker scripts: unary negation, fill expressions that can be indefinitely large ( =0x909090909090909090909090) and parsing symbol assignments outside SECTIONS.

Sanity checks performed: I tested SPEC userland programs linked by GNU ld, using the linker script dump'ed by this parser, and everything went fine. 
I then tested linking the FreeBSD kernel with a dump'ed linker script, installed the new kernel and booted it, everything went fine.

Successfully parsed all linker scripts from the FreeBSD kernel, except ldscript.mips.cfe and ldscript.mips.octeon, which requires the PHDRS command (not implemented yet).

Things not tested:  embedded scenarios, since this parser currently does not support the MEMORY command, common in these scenarios.

http://reviews.llvm.org/D5852

Files:
  include/lld/ReaderWriter/LinkerScript.h
  lib/ReaderWriter/LinkerScript.cpp
  test/LinkerScript/expr-precedence.test
  test/LinkerScript/incomplete-ternary.test
  test/LinkerScript/linker-script-outputformat.test
  test/LinkerScript/linker-script.test
  test/LinkerScript/missing-entry-symbol.test
  test/LinkerScript/missing-input-file-name.test
  test/LinkerScript/missing-input-sections.test
  test/LinkerScript/missing-operand.test
  test/LinkerScript/missing-output-section-name.test
  test/LinkerScript/missing-symbol.test
  test/LinkerScript/sections.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5852.15451.patch
Type: text/x-patch
Size: 98040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141025/c1866054/attachment.bin>


More information about the llvm-commits mailing list