================
@@ -1438,6 +1438,18 @@ void CodeGenAction::executeAction() {
   llvmModule->setTargetTriple(theTriple);
   llvmModule->setDataLayout(theTriple.computeDataLayout(targetOpts.abi));
 
+  // -fno-plt: external calls use the GOT instead of the PLT. The module
+  // requests GOT for compiler-rt, and declarations that are not defined in
+  // this translation unit are marked nonlazybind.
+  if (codeGenOpts.NoPLT) {
+    llvmModule->setRtLibUseGOT();
+    for (llvm::Function &func : *llvmModule) {
+      if (!func.isDeclaration() || func.isIntrinsic())
+        continue;
+      func.addFnAttr(llvm::Attribute::NonLazyBind);
----------------
tarunprabhu wrote:

Could we invert the condition so we add the attribute only if the condition is 
true. IMO, it is more readable than a `continue` followed by an unconditional 
assignment.

https://github.com/llvm/llvm-project/pull/235622
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to