<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	2018-10-02 12:11:12.397838507 +0100
+++ llvm.patched/include/llvm/LTO/legacy/LTOCodeGenerator.h	2018-10-02 12:15:00.021705831 +0100
@@ -186,6 +186,8 @@ struct LTOCodeGenerator {
   void resetMergedModule() { MergedModule.reset(); }
   void DiagnosticHandler(const DiagnosticInfo &amp;DI);
 
+  TargetOptions &amp;getTargetOptions() { return Options; }
+
 private:
   void initializeLTOPasses();
 
diff -rupN llvm/include/llvm/Target/TargetOptions.h llvm.patched/include/llvm/Target/TargetOptions.h
--- llvm/include/llvm/Target/TargetOptions.h	2018-10-02 12:11:12.385838301 +0100
+++ llvm.patched/include/llvm/Target/TargetOptions.h	2018-10-02 12:10:42.409329174 +0100
@@ -105,7 +105,7 @@ namespace llvm {
           HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),
           GuaranteedTailCallOpt(false), StackSymbolOrdering(true),
           EnableFastISel(false), EnableGlobalISel(false), UseInitArray(false),
-          DisableIntegratedAS(false), RelaxELFRelocations(false),
+          DisableIntegratedAS(false), RelaxELFRelocations(false), NoExceptions(false),
           FunctionSections(false), DataSections(false),
           UniqueSectionNames(true), TrapUnreachable(false),
           NoTrapAfterNoreturn(false), EmulatedTLS(false),
@@ -241,6 +241,8 @@ namespace llvm {
     /// Emit address-significance table.
     unsigned EmitAddrsig : 1;
 
+    /// No Exceptions
+    unsigned NoExceptions : 1;
     /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
     /// on the command line. This setting may either be Default, Soft, or Hard.
     /// Default selects the target's default behavior. Soft selects the ABI for
diff -rupN llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm.patched/lib/CodeGen/LLVMTargetMachine.cpp
--- llvm/lib/CodeGen/LLVMTargetMachine.cpp	2018-10-02 12:11:13.929864526 +0100
+++ llvm.patched/lib/CodeGen/LLVMTargetMachine.cpp	2018-10-02 12:10:42.409329174 +0100
@@ -68,7 +68,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 = TmpAsmInfo;
diff -rupN llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm.patched/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp	2018-10-02 12:11:13.921864390 +0100
+++ llvm.patched/lib/CodeGen/TargetLoweringObjectFileImpl.cpp	2018-10-02 12:10:42.409329174 +0100
@@ -406,18 +406,20 @@ MCSection *TargetLoweringObjectFileELF::
 /// 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;
   assert(Kind.isReadOnlyWithRel() &amp;&amp; "Unknown section kind");
   return ".data.rel.ro";
 }
diff -rupN llvm/lib/MC/MCObjectFileInfo.cpp llvm.patched/lib/MC/MCObjectFileInfo.cpp
--- llvm/lib/MC/MCObjectFileInfo.cpp	2018-10-02 12:11:13.917864321 +0100
+++ llvm.patched/lib/MC/MCObjectFileInfo.cpp	2018-10-02 12:10:42.409329174 +0100
@@ -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())
@@ -477,17 +482,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/CC1Options.td llvm.patched/tools/clang/include/clang/Driver/CC1Options.td
--- llvm/tools/clang/include/clang/Driver/CC1Options.td	2018-10-02 12:11:13.117850733 +0100
+++ llvm.patched/tools/clang/include/clang/Driver/CC1Options.td	2018-10-02 12:10:42.409329174 +0100
@@ -808,6 +808,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	2018-10-02 12:11:13.777861943 +0100
+++ llvm.patched/tools/clang/lib/CodeGen/BackendUtil.cpp	2018-10-02 12:10:42.413329241 +0100
@@ -441,6 +441,8 @@ static void initTargetOptions(llvm::Targ
     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;
 
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
diff -rupN llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp llvm.patched/tools/clang/lib/Frontend/CompilerInvocation.cpp
--- llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	2018-10-02 12:11:13.757861603 +0100
+++ llvm.patched/tools/clang/lib/Frontend/CompilerInvocation.cpp	2018-10-02 12:10:42.413329241 +0100
@@ -194,6 +194,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;
@@ -1055,6 +1060,19 @@ static bool ParseCodeGenArgs(CodeGenOpti
   if (!Opts.OptRecordFile.empty())
     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	2018-10-02 12:11:13.797862284 +0100
+++ llvm.patched/tools/lto/lto.cpp	2018-10-02 12:17:11.295933700 +0100
@@ -396,7 +396,20 @@ void lto_codegen_set_assembler_path(lto_
 
 void lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
                                     int nargs) {
-  // In here only for backwards compatibility. We use MC now.
+  LibLTOCodeGenerator *CG = unwrap(cg);
+  TargetOptions &amp;options = CG-&gt;getTargetOptions();
+  for (int i=0;i&lt;nargs;i++)
+    {
+      const char *opt = args[i];
+      if (strcmp(opt, "-float-abi=hard") == 0)
+        options.FloatABIType = FloatABI::Hard;
+      else if (strcmp(opt, "-ffunction-sections") ==  0)
+        options.FunctionSections = true;
+      else if (strcmp(opt, "-fdata-sections") == 0)
+        options.DataSections = true;
+      else if (strcmp(opt, "-fnoexceptions") == 0)
+        options.NoExceptions = true;
+    }
 }
 
 void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg,
</pre></body></html>