[PATCH] D69313: Handle more crt*.o filename variants.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 15:45:05 PDT 2019


ruiu added inline comments.


================
Comment at: lld/ELF/OutputSections.cpp:390
+// Returns true if S is in one of the many forms the driver may
+// pass crtbegin and crtend files.
+//
----------------
Please remove the mention about crtend.


================
Comment at: lld/ELF/OutputSections.cpp:392
+//
+// Gcc uses any of crt[begin|end][<empty>|S|T].o.
+// Clang uses Gcc's plus clang_rt.crt[begin|end][<empty>|S|T][-<arch>|<empty>].o.
----------------
ditto


================
Comment at: lld/ELF/OutputSections.cpp:397
+  s = llvm::sys::path::filename(s);
+  std::regex re(R"(^(clang_rt.)?crtbegin[ST]?[\-.*]?\.o$)");
+  return std::regex_match(s.data(), re);
----------------
Add `static` so that the regex is compiled only once.


================
Comment at: lld/ELF/OutputSections.cpp:397
+  s = llvm::sys::path::filename(s);
+  std::regex re(R"(^(clang_rt.)?crtbegin[ST]?[\-.*]?\.o$)");
+  return std::regex_match(s.data(), re);
----------------
ruiu wrote:
> Add `static` so that the regex is compiled only once.
Escaping dot?

^(clang_rt\.)?

Also I blieve [\-.*]? has to be

(-.*)?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D69313





More information about the llvm-commits mailing list