diff -rupN llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h llvm.patched/include/llvm/LTO/legacy/LTOCodeGenerator.h
--- llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h	2023-06-06 11:13:20.193255720 +0100
+++ llvm.patched/include/llvm/LTO/legacy/LTOCodeGenerator.h	2023-06-06 11:15:26.358769671 +0100
@@ -100,6 +100,10 @@ struct LTOCodeGenerator {
   void setCpu(StringRef MCpu) { Config.CPU = std::string(MCpu); }
   void setAttrs(std::vector<std::string> MAttrs) { Config.MAttrs = MAttrs; }
   void setOptLevel(unsigned OptLevel);
+  void setFunctionSections(bool Value) { Config.Options.FunctionSections = Value; }
+  void setDataSections(bool Value) { Config.Options.DataSections = Value; }
+  void setFloatingABIType(FloatABI::ABIType Value) { Config.Options.FloatABIType = Value; }
+  void setNoExceptions(bool Value) { Config.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	2023-06-06 11:13:20.217256005 +0100
+++ llvm.patched/include/llvm/Target/TargetOptions.h	2023-06-06 11:15:26.366769768 +0100
@@ -133,7 +133,7 @@ namespace llvm {
           LowerGlobalDtorsViaCxaAtExit(false), DisableIntegratedAS(false),
           RelaxELFRelocations(true), FunctionSections(false),
           DataSections(false), IgnoreXCOFFVisibility(false),
-          XCOFFTracebackTable(true), UniqueSectionNames(true),
+          XCOFFTracebackTable(true), NoExceptions(false), UniqueSectionNames(true),
           UniqueBasicBlockSectionNames(false), TrapUnreachable(false),
           NoTrapAfterNoreturn(false), TLSSize(0), EmulatedTLS(false),
           ExplicitEmulatedTLS(false), EnableIPRA(false),
@@ -271,6 +271,9 @@ namespace llvm {
     /// Emit XCOFF traceback table.
     unsigned XCOFFTracebackTable : 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	2023-06-06 11:13:20.321257238 +0100
+++ llvm.patched/lib/CodeGen/LLVMTargetMachine.cpp	2023-06-06 11:15:26.378769914 +0100
@@ -76,7 +76,7 @@ void LLVMTargetMachine::initAsmInfo() {
 
   TmpAsmInfo->setRelaxELFRelocations(Options.RelaxELFRelocations);
 
-  if (Options.ExceptionModel != ExceptionHandling::None)
+  if (Options.ExceptionModel != ExceptionHandling::None || Options.NoExceptions)
     TmpAsmInfo->setExceptionsType(Options.ExceptionModel);
 
   AsmInfo.reset(TmpAsmInfo);
diff -rupN llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm.patched/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
--- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp	2023-06-06 11:13:20.341257475 +0100
+++ llvm.patched/lib/CodeGen/TargetLoweringObjectFileImpl.cpp	2023-06-06 11:15:26.386770011 +0100
@@ -630,18 +630,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	2023-06-06 11:13:20.409258281 +0100
+++ llvm.patched/lib/MC/MCObjectFileInfo.cpp	2023-06-06 11:15:26.394770108 +0100
@@ -27,6 +27,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 &T) {
   // Only on darwin.
   if (!T.isOSDarwin())
@@ -376,17 +381,17 @@ void MCObjectFileInfo::initELFMCObjectFi
     EHSectionFlags |= ELF::SHF_WRITE;
 
   // ELF
-  BSSSection = Ctx->getELFSection(".bss", ELF::SHT_NOBITS,
+  BSSSection = Ctx->getELFSection(bssName, ELF::SHT_NOBITS,
                                   ELF::SHF_WRITE | ELF::SHF_ALLOC);
 
-  TextSection = Ctx->getELFSection(".text", ELF::SHT_PROGBITS,
+  TextSection = Ctx->getELFSection(textName, ELF::SHT_PROGBITS,
                                    ELF::SHF_EXECINSTR | ELF::SHF_ALLOC);
 
-  DataSection = Ctx->getELFSection(".data", ELF::SHT_PROGBITS,
+  DataSection = Ctx->getELFSection(dataName, ELF::SHT_PROGBITS,
                                    ELF::SHF_WRITE | ELF::SHF_ALLOC);
 
   ReadOnlySection =
-      Ctx->getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
+      Ctx->getELFSection(rodataName, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
 
   TLSDataSection =
       Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
diff -rupN llvm/tools/lto/lto.cpp llvm.patched/tools/lto/lto.cpp
--- llvm/tools/lto/lto.cpp	2023-06-06 11:13:19.789250932 +0100
+++ llvm.patched/tools/lto/lto.cpp	2023-06-06 11:15:26.394770108 +0100
@@ -43,6 +43,10 @@ static cl::opt<bool> EnableFreestanding(
     "lto-freestanding", cl::init(false),
     cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"));
 
+static cl::opt<bool> NoExceptions(
+    "no-exceptions", cl::init(false),
+    cl::desc("Do not generate exception tables"));
+
 #ifdef NDEBUG
 static bool VerifyByDefault = false;
 #else
@@ -155,6 +159,11 @@ static void lto_add_attrs(lto_code_gen_t
   CG->setOptLevel(OptLevel - '0');
   CG->setFreestanding(EnableFreestanding);
   CG->setDisableVerify(DisableVerify);
+  CG->setFunctionSections(codegen::getFunctionSections());
+  CG->setDataSections(codegen::getDataSections());
+  CG->setFloatingABIType(codegen::getFloatABIForCalls());
+  CG->setNoExceptions(NoExceptions);
+  if (auto FT = codegen::getExplicitFileType()) CG->setFileType(*FT);
 }
 
 extern const char* lto_get_version() {
diff -rupN clang/include/clang/Driver/Options.td clang.patched/include/clang/Driver/Options.td
--- clang/include/clang/Driver/Options.td	2023-06-02 00:59:18.000000000 +0100
+++ clang.patched/include/clang/Driver/Options.td	2023-06-06 11:15:26.398770156 +0100
@@ -6439,6 +6439,23 @@ def fno_cuda_host_device_constexpr : Fla
 } // let Flags = [CC1Option, NoDriverOption]
 
 //===----------------------------------------------------------------------===//
+// Section Naming Options
+//===----------------------------------------------------------------------===//
+
+let Flags = [CC1Option, NoDriverOption] in {
+
+def mbss_EQ : Joined<["-"], "mbss=">,
+  HelpText<"name the .bss section">;
+def mdata_EQ : Joined<["-"], "mdata=">,
+  HelpText<"name the .data section">;
+def mrodata_EQ : Joined<["-"], "mrodata=">,
+  HelpText<"name the .rodata section">;
+def mtext_EQ : Joined<["-"], "mtext=">,
+  HelpText<"name the .text section">;
+
+} // let Flags = [CC1Option, NoDriverOption]
+
+//===----------------------------------------------------------------------===//
 // OpenMP Options
 //===----------------------------------------------------------------------===//
 
diff -rupN clang/lib/CodeGen/BackendUtil.cpp clang.patched/lib/CodeGen/BackendUtil.cpp
--- clang/lib/CodeGen/BackendUtil.cpp	2023-06-02 00:59:18.000000000 +0100
+++ clang.patched/lib/CodeGen/BackendUtil.cpp	2023-06-06 11:15:26.398770156 +0100
@@ -392,6 +392,8 @@ static bool initTargetOptions(Diagnostic
     Options.ExceptionModel = llvm::ExceptionHandling::WinEH;
   if (LangOpts.hasDWARFExceptions())
     Options.ExceptionModel = llvm::ExceptionHandling::DwarfCFI;
+  if (!LangOpts.Exceptions && !LangOpts.CXXExceptions && !CodeGenOpts.UnwindTables)
+    Options.NoExceptions = true;
   if (LangOpts.hasWasmExceptions())
     Options.ExceptionModel = llvm::ExceptionHandling::Wasm;
 
diff -rupN clang/lib/Frontend/CompilerInvocation.cpp clang.patched/lib/Frontend/CompilerInvocation.cpp
--- clang/lib/Frontend/CompilerInvocation.cpp	2023-06-02 00:59:18.000000000 +0100
+++ clang.patched/lib/Frontend/CompilerInvocation.cpp	2023-06-06 11:15:26.402770205 +0100
@@ -890,6 +890,11 @@ static void GenerateAnalyzerArgs(Analyze
   // Nothing to generate for FullCompilerInvocation.
 }
 
+extern const char *bssName;
+extern const char *textName;
+extern const char *dataName;
+extern const char *rodataName;
+
 static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
                               DiagnosticsEngine &Diags) {
   unsigned NumErrorsBefore = Diags.getNumErrors();
@@ -1948,6 +1953,19 @@ bool CompilerInvocation::ParseCodeGenArg
     NeedLocTracking = true;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_mbss_EQ)) {
+    bssName = A->getValue();
+  }
+  if (Arg *A = Args.getLastArg(OPT_mdata_EQ)) {
+    dataName = A->getValue();
+  }
+  if (Arg *A = Args.getLastArg(OPT_mrodata_EQ)) {
+    rodataName = A->getValue();
+  }
+  if (Arg *A = Args.getLastArg(OPT_mtext_EQ)) {
+    textName = A->getValue();
+  }
+
   Opts.OptimizationRemark =
       ParseOptimizationRemark(Diags, Args, OPT_Rpass_EQ, "pass");
 
