[PATCH] D88637: [LLD] Set alignment as part of Characteristics in TLS table.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 09:22:59 PDT 2020


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

Looks good, suggestions optional.



================
Comment at: lld/COFF/Writer.cpp:2054-2055
+void Writer::fixTlsAlignment() {
+  if (Symbol *sym = symtab->findUnderscore("_tls_used")) {
+    if (Defined *b = dyn_cast<Defined>(sym)) {
+      OutputSection *sec = b->getChunk()->getOutputSection();
----------------
I have some optional nitty suggestions here. You could do something like this to return early and reduce indentation:
  Defined *b = dyn_cast_or_null<Defined>(symtab->findUnderscore("_tls_used"));
  if (!b)
    return;
  ...

Also, I'm not sure `b` is the most descriptive name. `sym`, `tlsSym`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88637/new/

https://reviews.llvm.org/D88637



More information about the llvm-commits mailing list