<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff -rupN llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h llvm.patched/include/llvm/LTO/legacy/LTOCodeGenerator.h
--- llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h	2020-12-17 14:40:56.237723537 +0000
+++ llvm.patched/include/llvm/LTO/legacy/LTOCodeGenerator.h	2020-12-17 14:40:36.357460477 +0000
@@ -95,6 +95,10 @@ struct LTOCodeGenerator {
   void setCpu(StringRef MCpu) { this-&gt;MCpu = std::string(MCpu); }
   void setAttr(StringRef MAttr) { this-&gt;MAttr = std::string(MAttr); }
   void setOptLevel(unsigned OptLevel);
+  void setFunctionSections(bool Value) { this-&gt;Options.FunctionSections = Value; }
+  void setDataSections(bool Value) { this-&gt;Options.DataSections = Value; }
+  void setFloatingABIType(FloatABI::ABIType Value) { this-&gt;Options.FloatABIType = Value; }
+  void setNoExceptions(bool Value) { this-&gt;Options.NoExceptions = Value; }
 
   void setShouldInternalize(bool Value) { ShouldInternalize = Value; }
   void setShouldEmbedUselists(bool Value) { ShouldEmbedUselists = Value; }
diff -rupN llvm/include/llvm/Target/TargetOptions.h llvm.patched/include/llvm/Target/TargetOptions.h
--- llvm/include/llvm/Target/TargetOptions.h	2020-12-17 14:40:56.157722487 +0000
+++ llvm.patched/include/llvm/Target/TargetOptions.h	2020-12-17 14:46:45.270321202 +0000
@@ -121,6 +121,7 @@ namespace llvm {
           EnableFastISel(false), EnableGlobalISel(false), UseInitArray(false),
           DisableIntegratedAS(false), RelaxELFRelocations(false),
           FunctionSections(false), DataSections(false),
+          NoExceptions(false),
           UniqueSectionNames(true), UniqueBasicBlockSectionNames(false),
           TrapUnreachable(false), NoTrapAfterNoreturn(false), TLSSize(0),
           EmulatedTLS(false), ExplicitEmulatedTLS(false), EnableIPRA(false),
@@ -232,6 +233,9 @@ namespace llvm {
     /// Emit data into separate sections.
     unsigned DataSections : 1;
 
+    /// No Exceptions
+    unsigned NoExceptions : 1;
+
     unsigned UniqueSectionNames : 1;
 
     /// Use unique names for basic block sections.
diff -rupN llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm.patched/lib/CodeGen/LLVMTargetMachine.cpp
--- llvm/lib/CodeGen/LLVMTargetMachine.cpp	2020-12-17 14:40:56.665729155 +0000
+++ llvm.patched/lib/CodeGen/LLVMTargetMachine.cpp	2020-12-17 14:40:36.357460477 +0000
@@ -67,7 +67,7 @@ void LLVMTargetMachine::initAsmInfo() {
 
   TmpAsmInfo-&gt;setRelaxELFRelocations(Options.RelaxELFRelocations);
 
-  if (Options.ExceptionModel != ExceptionHandling::None)
+  if (Options.ExceptionModel != ExceptionHandling::None || Options.NoExceptions)
     TmpAsmInfo-&gt;setExceptionsType(Options.ExceptionModel);
 
   AsmInfo.reset(TmpAsmInfo);
diff -rupN llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm.patched/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp	2020-12-17 14:40:56.685729418 +0000
+++ llvm.patched/lib/CodeGen/TargetLoweringObjectFileImpl.cpp	2020-12-17 15:20:58.509312977 +0000
@@ -573,18 +573,20 @@ static unsigned getEntrySizeForKind(Sect
 /// Return the section prefix name used by options FunctionsSections and
 /// DataSections.
 static StringRef getSectionPrefixForGlobal(SectionKind Kind) {
+  extern const char *bssName, *textName, *dataName, *rodataName;
+
   if (Kind.isText())
-    return ".text";
+    return textName;
   if (Kind.isReadOnly())
-    return ".rodata";
+    return rodataName;
   if (Kind.isBSS())
-    return ".bss";
+    return bssName;
   if (Kind.isThreadData())
     return ".tdata";
   if (Kind.isThreadBSS())
     return ".tbss";
   if (Kind.isData())
-    return ".data";
+    return dataName;
   if (Kind.isReadOnlyWithRel())
     return ".data.rel.ro";
   llvm_unreachable("Unknown section kind");
diff -rupN llvm/lib/MC/MCObjectFileInfo.cpp llvm.patched/lib/MC/MCObjectFileInfo.cpp
--- llvm/lib/MC/MCObjectFileInfo.cpp	2020-12-17 14:40:56.417725900 +0000
+++ llvm.patched/lib/MC/MCObjectFileInfo.cpp	2020-12-17 14:40:36.357460477 +0000
@@ -22,6 +22,11 @@
 
 using namespace llvm;
 
+const char *bssName = ".bss";
+const char *textName = ".text";
+const char *dataName = ".data";
+const char *rodataName = ".rodata";
+
 static bool useCompactUnwind(const Triple &amp;T) {
   // Only on darwin.
   if (!T.isOSDarwin())
@@ -345,17 +350,17 @@ void MCObjectFileInfo::initELFMCObjectFi
     EHSectionFlags |= ELF::SHF_WRITE;
 
   // ELF
-  BSSSection = Ctx-&gt;getELFSection(".bss", ELF::SHT_NOBITS,
+  BSSSection = Ctx-&gt;getELFSection(bssName, ELF::SHT_NOBITS,
                                   ELF::SHF_WRITE | ELF::SHF_ALLOC);
 
-  TextSection = Ctx-&gt;getELFSection(".text", ELF::SHT_PROGBITS,
+  TextSection = Ctx-&gt;getELFSection(textName, ELF::SHT_PROGBITS,
                                    ELF::SHF_EXECINSTR | ELF::SHF_ALLOC);
 
-  DataSection = Ctx-&gt;getELFSection(".data", ELF::SHT_PROGBITS,
+  DataSection = Ctx-&gt;getELFSection(dataName, ELF::SHT_PROGBITS,
                                    ELF::SHF_WRITE | ELF::SHF_ALLOC);
 
   ReadOnlySection =
-      Ctx-&gt;getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
+      Ctx-&gt;getELFSection(rodataName, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
 
   TLSDataSection =
       Ctx-&gt;getELFSection(".tdata", ELF::SHT_PROGBITS,
diff -rupN llvm/tools/clang/include/clang/Driver/Options.td llvm.patched/tools/clang/include/clang/Driver/Options.td
--- llvm/tools/clang/include/clang/Driver/Options.td	2020-12-17 14:40:54.125695817 +0000
+++ llvm.patched/tools/clang/include/clang/Driver/Options.td	2020-12-17 14:40:36.361460530 +0000
@@ -4338,6 +4338,19 @@ def fno_cuda_host_device_constexpr : Fla
   HelpText&lt;"Don't treat unattributed constexpr functions as __host__ __device__."&gt;;
 
 //===----------------------------------------------------------------------===//
+// Section Naming Options
+//===----------------------------------------------------------------------===//
+
+def mbss_EQ : Joined&lt;["-"], "mbss="&gt;,
+  HelpText&lt;"name the .bss section"&gt;;
+def mdata_EQ : Joined&lt;["-"], "mdata="&gt;,
+  HelpText&lt;"name the .data section"&gt;;
+def mrodata_EQ : Joined&lt;["-"], "mrodata="&gt;,
+  HelpText&lt;"name the .rodata section"&gt;;
+def mtext_EQ : Joined&lt;["-"], "mtext="&gt;,
+  HelpText&lt;"name the .text section"&gt;;
+
+//===----------------------------------------------------------------------===//
 // OpenMP Options
 //===----------------------------------------------------------------------===//
 
diff -rupN llvm/tools/clang/lib/CodeGen/BackendUtil.cpp llvm.patched/tools/clang/lib/CodeGen/BackendUtil.cpp
--- llvm/tools/clang/lib/CodeGen/BackendUtil.cpp	2020-12-17 14:40:56.057721175 +0000
+++ llvm.patched/tools/clang/lib/CodeGen/BackendUtil.cpp	2020-12-17 14:40:36.361460530 +0000
@@ -476,6 +476,8 @@ static void initTargetOptions(Diagnostic
     Options.ExceptionModel = llvm::ExceptionHandling::WinEH;
   if (LangOpts.DWARFExceptions)
     Options.ExceptionModel = llvm::ExceptionHandling::DwarfCFI;
+  if (!LangOpts.Exceptions &amp;&amp; !LangOpts.CXXExceptions &amp;&amp; !CodeGenOpts.UnwindTables)
+    Options.NoExceptions = true;
   if (LangOpts.WasmExceptions)
     Options.ExceptionModel = llvm::ExceptionHandling::Wasm;
 
diff -rupN llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp llvm.patched/tools/clang/lib/Frontend/CompilerInvocation.cpp
--- llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	2020-12-17 14:40:56.009720545 +0000
+++ llvm.patched/tools/clang/lib/Frontend/CompilerInvocation.cpp	2020-12-17 14:40:36.361460530 +0000
@@ -261,6 +261,11 @@ static void getAllNoBuiltinFuncValues(Ar
   Funcs.insert(Funcs.end(), Values.begin(), Values.end());
 }
 
+extern const char *bssName;
+extern const char *textName;
+extern const char *dataName;
+extern const char *rodataName;
+
 static bool ParseAnalyzerArgs(AnalyzerOptions &amp;Opts, ArgList &amp;Args,
                               DiagnosticsEngine &amp;Diags) {
   bool Success = true;
@@ -1360,6 +1365,19 @@ static bool ParseCodeGenArgs(CodeGenOpti
     NeedLocTracking = true;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_mbss_EQ)) {
+    bssName = A-&gt;getValue();
+  }
+  if (Arg *A = Args.getLastArg(OPT_mdata_EQ)) {
+    dataName = A-&gt;getValue();
+  }
+  if (Arg *A = Args.getLastArg(OPT_mrodata_EQ)) {
+    rodataName = A-&gt;getValue();
+  }
+  if (Arg *A = Args.getLastArg(OPT_mtext_EQ)) {
+    textName = A-&gt;getValue();
+  }
+
   if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
     Opts.OptimizationRemarkPattern =
         GenerateOptimizationRemarkRegex(Diags, Args, A);
diff -rupN llvm/tools/lto/lto.cpp llvm.patched/tools/lto/lto.cpp
--- llvm/tools/lto/lto.cpp	2020-12-17 14:40:56.141722278 +0000
+++ llvm.patched/tools/lto/lto.cpp	2020-12-17 14:40:36.365460584 +0000
@@ -57,6 +57,10 @@ static cl::opt&lt;bool&gt; EnableFreestanding(
     "lto-freestanding", cl::init(false),
     cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"));
 
+static cl::opt&lt;bool&gt; NoExceptions(
+    "no-exceptions", cl::init(false),
+    cl::desc("Do not generate exception tables"));
+
 #ifdef NDEBUG
 static bool VerifyByDefault = false;
 #else
@@ -168,6 +172,11 @@ static void lto_add_attrs(lto_code_gen_t
     report_fatal_error("Optimization level must be between 0 and 3");
   CG-&gt;setOptLevel(OptLevel - '0');
   CG-&gt;setFreestanding(EnableFreestanding);
+  CG-&gt;setFunctionSections(codegen::getFunctionSections());
+  CG-&gt;setDataSections(codegen::getDataSections());
+  CG-&gt;setFloatingABIType(codegen::getFloatABIForCalls());
+  CG-&gt;setNoExceptions(NoExceptions);
+  if (auto FT = codegen::getExplicitFileType()) CG-&gt;setFileType(FT.getValue());
 }
 
 extern const char* lto_get_version() {
</pre></body></html>