[PATCH] D87469: [LLD][ELF] Optimize linker script filename glob pattern matching NFC

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 10:20:34 PDT 2020


andrewng created this revision.
andrewng added reviewers: MaskRay, grimar.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
andrewng requested review of this revision.

Optimize the filename glob pattern matching in
LinkerScript::computeInputSections() and LinkerScript::shouldKeep().

Add InputFile::getNameForScript() which gets and if required caches the
Inputfile's name used for linker script matching. This avoids the
overhead of name creation that was in getFilename() in LinkerScript.cpp.

Add InputSectionDescription::matchesFile() and
SectionPattern::excludesFile() which perform the glob pattern matching
for an InputFile and make use of a cache of the previous result.

These changes have been seen to reduce link time with --gc-sections by
up to ~40% with linker scripts that contain KEEP filename glob patterns
such as "*crtbegin*.o".


https://reviews.llvm.org/D87469

Files:
  lld/ELF/InputFiles.cpp
  lld/ELF/InputFiles.h
  lld/ELF/LinkerScript.cpp
  lld/ELF/LinkerScript.h
  lld/include/lld/Common/Strings.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87469.291019.patch
Type: text/x-patch
Size: 5138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/5908b5d8/attachment.bin>


More information about the llvm-commits mailing list