Index: llvm/lib/LTO/LTOCodeGenerator.cpp =================================================================== --- llvm/lib/LTO/LTOCodeGenerator.cpp +++ llvm/lib/LTO/LTOCodeGenerator.cpp @@ -261,13 +261,18 @@ } } + // Setup the LDR_CNTRL variable + std::string LDR_CNTRL_var = "LDR_CNTRL=MAXDATA32=0xA0000000@DSA"; + if (Optional V = sys::Process::GetEnv("LDR_CNTRL")) + LDR_CNTRL_var += ("@" + *V); + // Prepare inputs for the assember. const auto &Triple = TargetMach->getTargetTriple(); const char *Arch = Triple.isArch64Bit() ? "-a64" : "-a32"; std::string ObjectFileName(AssemblyFile); ObjectFileName[ObjectFileName.size() - 1] = 'o'; SmallVector Args = { - "/bin/env", "LDR_CNTRL=MAXDATA32=0x80000000@${LDR_CNTRL}", + "/bin/env", LDR_CNTRL_var, AssemblerPath, Arch, "-many", "-o", ObjectFileName, AssemblyFile};