about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-25 20:17:01 +0000
committerbors <bors@rust-lang.org>2023-09-25 20:17:01 +0000
commit6f13ea0d1a0687073d36b5b1f7dd0e41e67665fb (patch)
tree11ed12ebafb5e26e678a52ca47605dfb3af46186 /compiler/rustc_llvm/llvm-wrapper
parent7bf47a47926126a80b1a101b0b4b0e15eb7bed0d (diff)
parent91544e6a937b4c2c7181578533e6d10991559c14 (diff)
downloadrust-6f13ea0d1a0687073d36b5b1f7dd0e41e67665fb.tar.gz
rust-6f13ea0d1a0687073d36b5b1f7dd0e41e67665fb.zip
Auto merge of #115704 - nebulark:s_object, r=nagisa
Pass name of object file to LLVM so it can correctly emit S_OBJNAME in pdb files on Windows

This should be the remaining fix to close https://github.com/rust-lang/rust/issues/96475
Setting ObjectFilenameForDebug in llvm::TargetOptions, so llvm it can emit S_OBJNAME  in pdb files on Windows.

Without a proper pdb parsing I am not able to add a unit test for this. The string is already appearing in the pdb file so I cannot just use grep.

`@rustbot` label: +A-debuginfo
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index 461b5290e69..b729c40228b 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -416,6 +416,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
     bool RelaxELFRelocations,
     bool UseInitArray,
     const char *SplitDwarfFile,
+    const char *OutputObjFile,
     const char *DebugInfoCompression,
     bool ForceEmulatedTls,
     const char *ArgsCstrBuff, size_t ArgsCstrBuffLen) {
@@ -448,6 +449,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
   if (SplitDwarfFile) {
       Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
   }
+  if (OutputObjFile) {
+      Options.ObjectFilenameForDebug = OutputObjFile;
+  }
 #if LLVM_VERSION_GE(16, 0)
   if (!strcmp("zlib", DebugInfoCompression) && llvm::compression::zlib::isAvailable()) {
     Options.CompressDebugSections = DebugCompressionType::Zlib;