diff options
author | Petr Hosek <phosek@chromium.org> | 2017-08-30 23:13:31 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2017-08-30 23:13:31 +0000 |
commit | 8231133535b1b2101126be6ed2d1bbb65c2a81be (patch) | |
tree | 64b0e2baf984100216fd164425abf44f15f6edba /lib/ObjectYAML | |
parent | a678116cfb8402da77486060b47f4a0de9623852 (diff) |
[yaml2obj][ELF] Make symbols optional for relocations
Some kinds of relocations do not have symbols, like R_X86_64_RELATIVE
for instance. I would like to test this case in D36554 but currently
can't because symbols are required by yaml2obj. The other option is
using the empty symbol but that doesn't seem quite right to me.
This change makes the Symbol field of Relocation optional and in the
case where the user does not specify a symbol name the Symbol index is 0.
Patch by Jake Ehrlich
Differential Revision: https://reviews.llvm.org/D37276
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ObjectYAML')
-rw-r--r-- | lib/ObjectYAML/ELFYAML.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ObjectYAML/ELFYAML.cpp b/lib/ObjectYAML/ELFYAML.cpp index fd0aa49445f..cf0a943a880 100644 --- a/lib/ObjectYAML/ELFYAML.cpp +++ b/lib/ObjectYAML/ELFYAML.cpp @@ -853,7 +853,7 @@ void MappingTraits<ELFYAML::Relocation>::mapping(IO &IO, assert(Object && "The IO context is not initialized"); IO.mapRequired("Offset", Rel.Offset); - IO.mapRequired("Symbol", Rel.Symbol); + IO.mapOptional("Symbol", Rel.Symbol); if (Object->Header.Machine == ELFYAML::ELF_EM(ELF::EM_MIPS) && Object->Header.Class == ELFYAML::ELF_ELFCLASS(ELF::ELFCLASS64)) { |