aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2017-08-30 23:13:31 +0000
committerPetr Hosek <phosek@chromium.org>2017-08-30 23:13:31 +0000
commit5aa80f166389452ca66589b8c07b423fcf95cb8d (patch)
treec19f2162596f7be26f306a2c357edb081e8370f9 /llvm/lib/ObjectYAML
parentc61fec25946133af71a4d8efb0a375915e1f8573 (diff)
downloadllvm-5aa80f166389452ca66589b8c07b423fcf95cb8d.zip
llvm-5aa80f166389452ca66589b8c07b423fcf95cb8d.tar.gz
llvm-5aa80f166389452ca66589b8c07b423fcf95cb8d.tar.bz2
[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 llvm-svn: 312192
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/ELFYAML.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index fd0aa49..cf0a943 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/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)) {