[PATCH] D37440: [ELF] - Linkerscript: do not hang linker on infinite nested INCLUDE command.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 4 08:25:58 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

It was easy to hang LLD when INCLUDE command included itself.

Documentation says that nesting up to 10 levels is allowed:

INCLUDE filename
Include the linker script filename at this point. The file will be searched for in
the current directory, and in any directory specified with the ā€˜-Lā€™ option. You
can nest calls to INCLUDE up to 10 levels deep.

Patch stores nesting level for each MemoryBufferRef we create,
so it is possible to error out when limit of 10 levels is reached.


https://reviews.llvm.org/D37440

Files:
  ELF/ScriptLexer.cpp
  ELF/ScriptLexer.h
  test/ELF/linkerscript/linkerscript.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37440.113759.patch
Type: text/x-patch
Size: 3287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170904/42f6f222/attachment.bin>


More information about the llvm-commits mailing list