[PATCH] D45851: [llvm-objcopy] Fix sh_link for more types of sections

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 05:03:03 PDT 2018


jakehehrlich added inline comments.


================
Comment at: tools/llvm-objcopy/Object.cpp:370
 
-bool SectionWithStrTab::classof(const SectionBase *S) {
-  return isa<DynamicSymbolTableSection>(S) || isa<DynamicSection>(S);
+bool Section::classof(const SectionBase *S) {
+  return S->Type == ELF::SHT_DYNSYM || S->Type == ELF::SHT_DYNAMIC ||
----------------
no  additional fields are exposed by Section so there is no reason to use this cast. Additionally getting this method right seems hard/impossible to me. The point of this class is to be a catch-all for the cases we don't have specified behavior for so it really shouldn't ever make sense to cast it out to something more specific. Can we just remove method instead of trying to implement it correctly? I think I made a mistake in not removing SectionWithStrTab at some point in the code (it was needed at one point but I'm not sure it is needed any longer).


Repository:
  rL LLVM

https://reviews.llvm.org/D45851





More information about the llvm-commits mailing list