================ @@ -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"); ---------------- MaskRay wrote:
`ld.bfd -pie a.o -o a` might have a default linker script like`/lib/ld64.so.1`. --no-dynamic-linker suppresses it. In addition, the option used to have special implication in LLD before 994cea3f0a2d0caf4d66321ad5a06ab330144d89 For compatibility with both linkers, --no-dynamic-linker is recommended for driver -static-pie. 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