Skip to content

Commit 5fe852e

Browse files
authored
[lld][ELF] Add -plugin-opt=time-trace= as an alias of --time-trace= (#106803)
Time trace profiler support was added into LLVMgold in cd3255a. This patch adds its `-plugin-opt` counterpart, which is just an alias to `--time-trace=`, into LLD for compatibility.
1 parent 357bd61 commit 5fe852e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lld/ELF/Options.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ def: J<"plugin-opt=sample-profile=">,
729729
def: F<"plugin-opt=save-temps">, Alias<save_temps>, HelpText<"Alias for --save-temps">;
730730
def plugin_opt_stats_file: J<"plugin-opt=stats-file=">,
731731
HelpText<"Filename to write LTO statistics to">;
732+
def: J<"plugin-opt=time-trace=">, Alias<time_trace_eq>, HelpText<"Alias for --time-trace=">;
732733
def: F<"plugin-opt=thinlto-emit-imports-files">,
733734
Alias<thinlto_emit_imports_files>,
734735
HelpText<"Alias for --thinlto-emit-imports-files">;

lld/test/ELF/lto/time-trace.ll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; REQUIRES: x86
2+
; RUN: llvm-as %s -o %t.o
3+
; RUN: ld.lld -m elf_x86_64 -shared %t.o -o %t.so --plugin-opt=time-trace=%t.trace.json
4+
; RUN: FileCheck --input-file=%t.trace.json %s
5+
;; Print to stdout
6+
; RUN: ld.lld -m elf_x86_64 -shared %t.o -o %t.so --plugin-opt=time-trace=- | \
7+
; RUN: FileCheck %s
8+
9+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
10+
target triple = "x86_64-unknown-linux-gnu"
11+
12+
; Make sure the content is correct
13+
; CHECK: "traceEvents"
14+
; Make sure LTO events are recorded
15+
; CHECK-SAME: "name":"LTO"
16+
17+
define void @foo() {
18+
ret void
19+
}

0 commit comments

Comments
 (0)