From 9d713862521f70c610b687d1629ee8fc4fb1e5ce Mon Sep 17 00:00:00 2001 From: Qiu Chaofan Date: Wed, 28 Feb 2024 17:41:12 +0800 Subject: [PATCH] Add profiling support to AIX AIX ld needs special option to merge objects with profiling. Also, profiler_builtins should include builtins for AIX from compiler-rt. --- compiler/rustc_codegen_ssa/src/back/linker.rs | 4 +++- library/profiler_builtins/build.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 1f3383815e226..e52efd8695558 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1631,7 +1631,9 @@ impl<'a> Linker for AixLinker<'a> { fn optimize(&mut self) {} - fn pgo_gen(&mut self) {} + fn pgo_gen(&mut self) { + self.cmd.arg("-bdbg:namedsects:ss"); + } fn control_flow_guard(&mut self) {} diff --git a/library/profiler_builtins/build.rs b/library/profiler_builtins/build.rs index 8e7b72f837220..9d1c1ba305bc5 100644 --- a/library/profiler_builtins/build.rs +++ b/library/profiler_builtins/build.rs @@ -26,6 +26,7 @@ fn main() { "InstrProfilingMerge.c", "InstrProfilingMergeFile.c", "InstrProfilingNameVar.c", + "InstrProfilingPlatformAIX.c", "InstrProfilingPlatformDarwin.c", "InstrProfilingPlatformFuchsia.c", "InstrProfilingPlatformLinux.c",