[llvm] [BOLT] Update LSDA encoding for x86-64 large code model (PR #190685)

Farid Zakaria via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 21:23:07 PDT 2026


================
@@ -259,16 +258,14 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
   std::unique_ptr<MCObjectFileInfo> MOFI(
       TheTarget->createMCObjectFileInfo(*Ctx, IsPIC));
   Ctx->setObjectFileInfo(MOFI.get());
-  // We do not support X86 Large code model. Change this in the future.
+  // Use large code model encoding for AArch64 (always). For X86, this is
+  // updated via updateLSDAEncodingForLargeCodeModel() after detecting .ltext.
+  // Otherwise allow the user to force it via `--large-code-model` flag.
   bool Large = false;
   if (TheTriple.getArch() == llvm::Triple::aarch64)
     Large = true;
-  unsigned LSDAEncoding =
-      Large ? dwarf::DW_EH_PE_absptr : dwarf::DW_EH_PE_udata4;
-  if (IsPIC) {
-    LSDAEncoding = dwarf::DW_EH_PE_pcrel |
-                   (Large ? dwarf::DW_EH_PE_sdata8 : dwarf::DW_EH_PE_sdata4);
-  }
+  if (opts::LargeCodeModel.getNumOccurrences())
----------------
fzakaria wrote:

I renamed it and moved the assignment after BC is created so there is no need for local variable.

https://github.com/llvm/llvm-project/pull/190685


More information about the llvm-commits mailing list