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

Rafael Auler rafaelauler at gmail.com
Fri Oct 17 17:02:50 PDT 2014


Hi Bigcheese, shankarke,

This patch does *not* implement any semantic actions, but it is a first step to
teach LLD how to read complete linker scripts. The additional linker scripts
statements whose parsing is now supported are:

SEARCH_DIR directive
SECTIONS directive
Symbol definitions inside SECTIONS including PROVIDE and PROVIDE_HIDDEN
C-like expressions used in many places in linker scripts
Input to output sections mapping
The goal of this patch was guided towards completely parsing a default GNU ld
linker script and the linker script used to link the FreeBSD kernel. Thus, it
also adds a test case based on the default linker script used in GNU ld for
x86_64 ELF targets.

Note: Sorry for the size of this patch. I started with the goal of incrementally
developing this parser but ultimately failed. On the other side, the logic of the
parser is kind of repetitive, as one would expect, so this patch does not feature
lots of new things.

http://reviews.llvm.org/D5852

Files:
  include/lld/ReaderWriter/LinkerScript.h
  lib/ReaderWriter/LinkerScript.cpp
  test/LinkerScript/sections.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5852.15107.patch
Type: text/x-patch
Size: 97731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141018/4e745038/attachment.bin>


More information about the llvm-commits mailing list