[PATCH] D34577: [COFF] Improve synthetic symbol handling
    Rui Ueyama via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Jun 23 15:39:41 PDT 2017
    
    
  
ruiu added a comment.
Overall looking good, a few minor comments.
================
Comment at: lld/COFF/Symbols.h:170
   uint32_t getValue() { return Sym->Value; }
+  uint64_t getSecrel();
 
----------------
Why is it 64 bit?
================
Comment at: lld/COFF/Writer.cpp:785-786
     return;
-  if (auto *T = dyn_cast<DefinedRelative>(Config->SEHTable->body()))
-    T->setRVA(SEHTable->getRVA());
-  if (auto *C = dyn_cast<DefinedAbsolute>(Config->SEHCount->body()))
-    C->setVA(SEHTable->getSize() / 4);
+  Symbol *T = Symtab->findUnderscore("__safe_se_handler_table");
+  Symbol *C = Symtab->findUnderscore("__safe_se_handler_count");
+  replaceBody<DefinedSynthetic>(T, T->body()->getName(), SEHTable);
----------------
Since we always add "___safe_se_handler_table" and "___safe_se_handler_count" (three underscores), I think you can use `Symtab->find` instead of `Symtab->findUnderscore`.
Please add comment why you want to change the type of the symbol from Absolute to Synthetic.
https://reviews.llvm.org/D34577
    
    
More information about the llvm-commits
mailing list