[PATCH] D37710: [LLD] [MinGW] Pass the undecorated entry point name to the COFF linker

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 09:42:24 PDT 2017


ruiu accepted this revision.
ruiu added a comment.

LGTM



================
Comment at: MinGW/Driver.cpp:131
+  if (auto *A = Args.getLastArg(OPT_entry)) {
+    if (Args.getLastArgValue(OPT_m) == "i386pe" && A->getValue()[0] == '_')
+      Add("-entry:" + StringRef(A->getValue()).substr(1));
----------------
A->getValue() could be an empty string if you specify `-e ''`, so you want to guard against it. I'd do

  if (auto *A = Args.getLastArg(OPT_entry)) {
    StringRef S = A->getValue();
    if (Args.getLastArgValue(OPT_m) == "i386pe" && S.startswith('_'))


https://reviews.llvm.org/D37710





More information about the llvm-commits mailing list