[PATCH] D39739: [HCC] Add flag to Import Weak Functions in Function Importer

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 10:09:52 PST 2017


yaxunl added inline comments.


================
Comment at: lib/Transforms/IPO/FunctionImport.cpp:107
+static cl::opt<bool, true>
+ForceImportWeak("force-import-weak", cl::Hidden,
+                cl::desc("Allow weak functions to be imported"),
----------------
AlexVlx wrote:
> yaxunl wrote:
> > Is it possible not to expose this option through extern? Generally these options should be kept static.
> This seems to suggest that it is not utterly unacceptable: http://llvm.org/docs/CommandLine.html#internal-vs-external-storage, and the use case described there maps pretty closely to this, since the flag itself must be accessible from two different TUs. Am I missing something?
OK. I did not notice that it is also used byFunctionImportUtils.cpp.


================
Comment at: lib/Transforms/Utils/FunctionImportUtils.cpp:153
     // definition and importing would change the order they are seen by the
     // linker. The module linking caller needs to enforce this.
+    if(!ForceImportWeakFlag)
----------------
If we link three modules, A, B, and C.

A calls function sin, B and C both contains function sin with weak linkage.

Which sin function will be linked?


Repository:
  rL LLVM

https://reviews.llvm.org/D39739





More information about the cfe-commits mailing list