[PATCH] [lld][inputGraph] Implement flavor specific resolver

Shankar Kalpathi Easwaran shankarke at gmail.com
Thu Oct 3 20:43:57 PDT 2013


Hi Bigcheese, kledzik, rui314, ruiu, joerg,

Different linkers processes files specified in the command line in specific ways convenient to the flavor and the end users. lld needs to support the same model inorder to retain the same behavior.

The way this is accomplished is by extending/using the InputGraph functionality.

Changes in the patch include :-

(a) InputGraph nodes call into various aspects of parsing the input node

(b) Convenience methods in the InputGraph, insertInputElementAt, insertOneElementAt 

(c) Simplifies handling whole archives

(c) Resolver iterates over the input elements in a flavor specific manner by 

(c.1) Adding new method nextFile() to LinkingContext, which returns a new file from which Resolver should try to resolve undefined symbols. Resolver calls nextFile() repeatedly to link until nextFile() returns no more files need to be processed.

(c.2) Resolver will notify Linking Context on the status of the resolver when it deals with the current file, The Linking Context will do whatever it thinks appropriate for the event notification.

Removes files that are not being used (InputFiles, LinkerInputs, ReaderArchive).

Future changes which the model would support are 

a) Handling --start-group/--end-group

PS : Sorry for the big patch, All of these changes are trying to handle the way the resolver handles flavor specific behavior of linking.

http://llvm-reviews.chandlerc.com/D1830

Files:
  include/lld/Core/Error.h
  include/lld/Core/InputFiles.h
  include/lld/Core/LinkerInput.h
  include/lld/Core/LinkingContext.h
  include/lld/Core/Resolver.h
  include/lld/Core/SharedLibraryFile.h
  include/lld/Driver/CoreInputGraph.h
  include/lld/Driver/DarwinInputGraph.h
  include/lld/Driver/GnuLdInputGraph.h
  include/lld/Driver/InputGraph.h
  include/lld/Driver/WinLinkInputGraph.h
  include/lld/ReaderWriter/CoreLinkingContext.h
  include/lld/ReaderWriter/ELFLinkingContext.h
  include/lld/ReaderWriter/MachOLinkingContext.h
  include/lld/ReaderWriter/PECOFFLinkingContext.h
  include/lld/ReaderWriter/Reader.h
  include/lld/ReaderWriter/ReaderArchive.h
  include/lld/ReaderWriter/ReaderLinkerScript.h
  include/lld/ReaderWriter/Writer.h
  lib/Core/CMakeLists.txt
  lib/Core/Error.cpp
  lib/Core/InputFiles.cpp
  lib/Core/LinkingContext.cpp
  lib/Core/Resolver.cpp
  lib/Core/SymbolTable.cpp
  lib/Driver/CMakeLists.txt
  lib/Driver/CoreDriver.cpp
  lib/Driver/DarwinLdDriver.cpp
  lib/Driver/Driver.cpp
  lib/Driver/GnuLdDriver.cpp
  lib/Driver/InputGraph.cpp
  lib/Driver/WinLinkDriver.cpp
  lib/ReaderWriter/CMakeLists.txt
  lib/ReaderWriter/CoreLinkingContext.cpp
  lib/ReaderWriter/ELF/DefaultTargetHandler.h
  lib/ReaderWriter/ELF/DynamicLibraryWriter.h
  lib/ReaderWriter/ELF/ELFLinkingContext.cpp
  lib/ReaderWriter/ELF/ExecutableWriter.h
  lib/ReaderWriter/ELF/File.h
  lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
  lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h
  lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
  lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
  lib/ReaderWriter/ELF/OutputELFWriter.h
  lib/ReaderWriter/ELF/Reader.cpp
  lib/ReaderWriter/ELF/TargetHandler.h
  lib/ReaderWriter/ELF/Writer.h
  lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
  lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h
  lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
  lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h
  lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lib/ReaderWriter/MachO/WriterMachO.cpp
  lib/ReaderWriter/Native/ReaderNative.cpp
  lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
  lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
  lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
  lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
  lib/ReaderWriter/ReaderArchive.cpp
  lib/ReaderWriter/ReaderLinkerScript.cpp
  lib/ReaderWriter/Writer.cpp
  lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  test/Driver/libsearch-inputGraph.test
  test/Driver/undef-basic.objtxt
  test/elf/X86_64/dynlib-search.test
  test/elf/X86_64/undef.test
  test/elf/dynamic.test
  test/elf/ifunc.test
  test/elf/undef-from-main-dso.test
  unittests/DriverTests/DriverTest.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1830.1.patch
Type: text/x-patch
Size: 127345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131003/b06a73e0/attachment.bin>


More information about the llvm-commits mailing list