[PATCH] D34577: [COFF] Improve synthetic symbol handling

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 15:50:57 PDT 2017


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM



================
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);
----------------
ruiu wrote:
> 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.
... so that we can apply secrel relocations against these options?


https://reviews.llvm.org/D34577





More information about the llvm-commits mailing list