[PATCH] D37915: [llvm-objcopy] Add support for dynamic relocations
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 15 11:46:28 PDT 2017
jakehehrlich created this revision.
This change adds support for dynamic relocations (allocated SHT_REL/SHT_RELA sections with a dynamic symbol table as their link).
There's a bit of code duplication with RelocationSections which is unfortunate. I'm not sure how to get rid of the duplication right now. If we make RelocationSection and DynamicRelocationSection have a common base class then they wind up not really having make sure that SymbolTableSection and DynamicSymbolTableSection also have a common base class. That would be fine with me except that RelocationSection::setSymTab would have to do a cast to expose the proper methods of SymbolTableSection anyway. If we go this route then there's the cast in RelocationSection::setSymTab plus a tiny bit of code duplication with Section. If we go the route I've uploaded here we duplicate a tiny bit of code in RelocationSection but we have a bit of heavier code duplication in Object::readSectionHeaders. I wasn't really sure what the best trade off was here. I settled on this but I could still be swayed to the other way. Ideally I'd like something better than either of the ways I've proposed.
Repository:
rL LLVM
https://reviews.llvm.org/D37915
Files:
test/tools/llvm-objcopy/Inputs/dynrel.elf
test/tools/llvm-objcopy/dynamic-relocations.test
tools/llvm-objcopy/Object.cpp
tools/llvm-objcopy/Object.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37915.115440.patch
Type: text/x-patch
Size: 5461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170915/07622395/attachment.bin>
More information about the llvm-commits
mailing list