diff options
author | Richard Mitton <richard@codersnotes.com> | 2013-08-16 18:54:26 +0000 |
---|---|---|
committer | Richard Mitton <richard@codersnotes.com> | 2013-08-16 18:54:26 +0000 |
commit | ad6d349fbcb2f9ced3c57b5b61231315175bcb47 (patch) | |
tree | 90d1d0f7f64bb48477a6df968b07371693d4cb0c /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | |
parent | d40542213ca06a4ab7db86fbd80bffa721cc8ceb (diff) | |
download | bcm5719-llvm-ad6d349fbcb2f9ced3c57b5b61231315175bcb47.tar.gz bcm5719-llvm-ad6d349fbcb2f9ced3c57b5b61231315175bcb47.zip |
Fixed RuntimeDyldELF absolute relocations.
If an ELF relocation is pointed at an absolute address, it will have a symbol ID of zero.
RuntimeDyldELF::processRelocationRef was not previously handling this case, and was instead trying to handle it as a section-relative fixup.
I think this is the right fix here, but my elf-fu is poor on some of the more exotic platforms, so I'd appreciate it if anyone with greater knowledge could verify this.
llvm-svn: 188572
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index 501959e10d0..16fd52de590 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -843,6 +843,13 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID, case SymbolRef::ST_Unknown: { Value.SymbolName = TargetName.data(); Value.Addend = Addend; + + // Absolute relocations will have a zero symbol ID (STN_UNDEF), which + // will manifest here as a NULL symbol name. + // We can set this as a valid (but empty) symbol name, and rely + // on addRelocationForSymbol to handle this. + if (!Value.SymbolName) + Value.SymbolName = ""; break; } default: @@ -1068,7 +1075,10 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID, RelocationEntry RE(SectionID, Offset, RelType, Value.Addend); // Extra check to avoid relocation againt empty symbols (usually // the R_PPC64_TOC). - if (Value.SymbolName && !TargetName.empty()) + if (SymType != SymbolRef::ST_Unknown && TargetName.empty()) + Value.SymbolName = NULL; + + if (Value.SymbolName) addRelocationForSymbol(RE, Value.SymbolName); else addRelocationForSection(RE, Value.SectionID); |