================
@@ -599,11 +599,18 @@ void baremetal::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   const Driver &D = getToolChain().getDriver();
   const llvm::Triple::ArchType Arch = TC.getArch();
   const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
+  const bool IsStaticPIE = getStaticPIE(Args, TC);
 
   if (!D.SysRoot.empty())
     CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
   CmdArgs.push_back("-Bstatic");
+  if (IsStaticPIE) {
+    CmdArgs.push_back("-pie");
+    CmdArgs.push_back("--no-dynamic-linker");
----------------
lenary wrote:

I think @petrhosek was asking specifically about the "--no-dynamic-linker" 
flag. 

I think for gnu ld it is necessary as it's possible to mix -static and -shared 
according to the manpage. I presume this ensures that you get an error in that 
case rather than a statically linked shared library. 

https://github.com/llvm/llvm-project/pull/147589
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to