2012-06-01 06:34:00 +08:00
|
|
|
add_subdirectory(ELF)
|
|
|
|
add_subdirectory(MachO)
|
|
|
|
add_subdirectory(Native)
|
|
|
|
add_subdirectory(PECOFF)
|
|
|
|
add_subdirectory(YAML)
|
2014-02-26 14:28:09 +08:00
|
|
|
|
|
|
|
set(LLVM_LINK_COMPONENTS object)
|
|
|
|
|
2012-06-01 06:34:00 +08:00
|
|
|
add_lld_library(lldReaderWriter
|
2013-08-07 06:31:59 +08:00
|
|
|
CoreLinkingContext.cpp
|
2013-12-06 12:43:01 +08:00
|
|
|
FileArchive.cpp
|
2013-03-01 08:03:36 +08:00
|
|
|
LinkerScript.cpp
|
2012-06-01 06:34:00 +08:00
|
|
|
Reader.cpp
|
2013-03-01 08:03:36 +08:00
|
|
|
Writer.cpp
|
[lld] Introduce registry and Reference kind tuple
The main changes are in:
include/lld/Core/Reference.h
include/lld/ReaderWriter/Reader.h
Everything else is details to support the main change.
1) Registration based Readers
Previously, lld had a tangled interdependency with all the Readers. It would
have been impossible to make a streamlined linker (say for a JIT) which
just supported one file format and one architecture (no yaml, no archives, etc).
The old model also required a LinkingContext to read an object file, which
would have made .o inspection tools awkward.
The new model is that there is a global Registry object. You programmatically
register the Readers you want with the registry object. Whenever you need to
read/parse a file, you ask the registry to do it, and the registry tries each
registered reader.
For ease of use with the existing lld code base, there is one Registry
object inside the LinkingContext object.
2) Changing kind value to be a tuple
Beside Readers, the registry also keeps track of the mapping for Reference
Kind values to and from strings. Along with that, this patch also fixes
an ambiguity with the previous Reference::Kind values. The problem was that
we wanted to reuse existing relocation type values as Reference::Kind values.
But then how can the YAML write know how to convert a value to a string? The
fix is to change the 32-bit Reference::Kind into a tuple with an 8-bit namespace
(e.g. ELF, COFFF, etc), an 8-bit architecture (e.g. x86_64, PowerPC, etc), and
a 16-bit value. This tuple system allows conversion to and from strings with
no ambiguities.
llvm-svn: 197727
2013-12-20 05:58:00 +08:00
|
|
|
FileArchive.cpp
|
2012-06-01 06:34:00 +08:00
|
|
|
)
|
2012-12-05 05:09:04 +08:00
|
|
|
|
2014-02-26 14:53:16 +08:00
|
|
|
target_link_libraries(lldReaderWriter ${cmake_2_8_12_INTERFACE}
|
2012-12-05 05:09:04 +08:00
|
|
|
lldCore
|
2013-09-02 17:33:06 +08:00
|
|
|
lldPasses
|
2012-12-05 05:09:04 +08:00
|
|
|
)
|