[PATCH] D37489: Linker script handing of file patterns with COMMON defs

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 17:07:11 PDT 2017


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

LGTM with these changes.



================
Comment at: lld/ELF/SyntheticSections.cpp:58-60
+  std::vector<InputSection *> Ret;
   if (!Config->DefineCommon)
+    return Ret;
----------------
I believe this is slightly more readable.

  if (!Config->DefineCommon)
    return {};

  std::vector<InputSection *> Ret;
  for (Symbol *S : ...) {


================
Comment at: lld/ELF/Writer.cpp:305-306
 
-  InX::Common = createCommonSection<ELFT>();
-  if (InX::Common)
-    Add(InX::Common);
+  auto Commons = createCommonSections();
+  for (auto S : Commons)
+    Add(S);
----------------
In lld, we don't use `auto` unless it is obvious in a very local context (typically RHS). This is not the case.

  for (InputSection *S : createCommonSections())
    add(S)


https://reviews.llvm.org/D37489





More information about the llvm-commits mailing list