diff --git a/llvm/docs/CommandGuide/llvm-readelf.rst b/llvm/docs/CommandGuide/llvm-readelf.rst --- a/llvm/docs/CommandGuide/llvm-readelf.rst +++ b/llvm/docs/CommandGuide/llvm-readelf.rst @@ -52,7 +52,7 @@ Display the dynamic table. -.. option:: --elf-cg-profile +.. option:: --cg-profile Display the callgraph profile section. diff --git a/llvm/docs/CommandGuide/llvm-readobj.rst b/llvm/docs/CommandGuide/llvm-readobj.rst --- a/llvm/docs/CommandGuide/llvm-readobj.rst +++ b/llvm/docs/CommandGuide/llvm-readobj.rst @@ -168,7 +168,7 @@ Display the dynamic table. -.. option:: --elf-cg-profile +.. option:: --cg-profile Display the callgraph profile section. diff --git a/llvm/test/MC/ELF/cgprofile.ll b/llvm/test/MC/ELF/cgprofile.ll --- a/llvm/test/MC/ELF/cgprofile.ll +++ b/llvm/test/MC/ELF/cgprofile.ll @@ -1,6 +1,6 @@ ; RUN: llc -filetype=asm %s -o - -mtriple x86_64-pc-linux-gnu | FileCheck %s ; RUN: llc -filetype=obj %s -o %t -mtriple x86_64-pc-linux-gnu -; RUN: llvm-readobj --elf-cg-profile %t | FileCheck %s --check-prefix=OBJ +; RUN: llvm-readobj --cg-profile %t | FileCheck %s --check-prefix=OBJ declare void @b() diff --git a/llvm/test/MC/ELF/cgprofile.s b/llvm/test/MC/ELF/cgprofile.s --- a/llvm/test/MC/ELF/cgprofile.s +++ b/llvm/test/MC/ELF/cgprofile.s @@ -1,4 +1,4 @@ -# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -S --symbols --sd --elf-cg-profile | FileCheck %s +# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -S --symbols --sd --cg-profile | FileCheck %s .section .test,"aw",@progbits a: .word b diff --git a/llvm/test/Object/multiple-sections.yaml b/llvm/test/Object/multiple-sections.yaml --- a/llvm/test/Object/multiple-sections.yaml +++ b/llvm/test/Object/multiple-sections.yaml @@ -1,5 +1,5 @@ # RUN: yaml2obj %s -o %t.o -# RUN: llvm-readobj -a --elf-cg-profile --addrsig %t.o | FileCheck %s +# RUN: llvm-readobj -a --cg-profile --addrsig %t.o | FileCheck %s # Test that multiple sections with the same type does not trigger an error. diff --git a/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test b/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test --- a/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test +++ b/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test @@ -1,6 +1,8 @@ ## This test checks how we handle the --elf-cg-profile option. # RUN: yaml2obj %s -o %t.o +# RUN: llvm-readobj %t.o --cg-profile | FileCheck %s --check-prefix=LLVM +# RUN: llvm-readelf %t.o --cg-profile | FileCheck %s --check-prefix=GNU # RUN: llvm-readobj %t.o --elf-cg-profile | FileCheck %s --check-prefix=LLVM # RUN: llvm-readelf %t.o --elf-cg-profile | FileCheck %s --check-prefix=GNU diff --git a/llvm/test/tools/llvm-readobj/ELF/demangle.test b/llvm/test/tools/llvm-readobj/ELF/demangle.test --- a/llvm/test/tools/llvm-readobj/ELF/demangle.test +++ b/llvm/test/tools/llvm-readobj/ELF/demangle.test @@ -5,20 +5,20 @@ ## Check LLVM output style. # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \ -# RUN: --elf-section-groups --elf-cg-profile --addrsig \ +# RUN: --elf-section-groups --cg-profile --addrsig \ # RUN: --demangle %t.so > %t.llvm.long # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \ -# RUN: --elf-section-groups --elf-cg-profile --addrsig \ +# RUN: --elf-section-groups --cg-profile --addrsig \ # RUN: -C %t.so > %t.llvm.short # RUN: FileCheck %s --input-file %t.llvm.long --check-prefixes=LLVM-COMMON,LLVM-DEMANGLE # RUN: diff %t.llvm.long %t.llvm.short ## Check that default is no demangling. # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \ -# RUN: --elf-section-groups --elf-cg-profile --addrsig \ +# RUN: --elf-section-groups --cg-profile --addrsig \ # RUN: %t.so > %t.llvm.default # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \ -# RUN: --elf-section-groups --elf-cg-profile --addrsig \ +# RUN: --elf-section-groups --cg-profile --addrsig \ # RUN: --demangle=false %t.so > %t.llvm.nodemangle # RUN: FileCheck %s --input-file %t.llvm.default --check-prefixes=LLVM-COMMON,LLVM-MANGLED # RUN: diff %t.llvm.default %t.llvm.nodemangle diff --git a/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml b/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml --- a/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml +++ b/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml @@ -3,13 +3,13 @@ ## Test that the content of SHT_LLVM_CALL_GRAPH_PROFILE sections ## for 32/64-bit little/big endian targets is correct. # RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=LSB %s -o %t.le64 -# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le64 | FileCheck %s --check-prefixes=BASIC,BASIC-LE +# RUN: llvm-readobj --cg-profile --sections --section-data %t.le64 | FileCheck %s --check-prefixes=BASIC,BASIC-LE # RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=MSB %s -o %t.be64 -# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be64 | FileCheck %s --check-prefixes=BASIC,BASIC-BE +# RUN: llvm-readobj --cg-profile --sections --section-data %t.be64 | FileCheck %s --check-prefixes=BASIC,BASIC-BE # RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=LSB %s -o %t.le32 -# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le32 | FileCheck %s --check-prefixes=BASIC,BASIC-LE +# RUN: llvm-readobj --cg-profile --sections --section-data %t.le32 | FileCheck %s --check-prefixes=BASIC,BASIC-LE # RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=MSB %s -o %t.be32 -# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE +# RUN: llvm-readobj --cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE # BASIC: Name: .llvm.call-graph-profile # BASIC-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE @@ -111,7 +111,7 @@ ## Check we can refer to symbols by name. # RUN: yaml2obj --docnum=4 %s -o %t.sym -# RUN: llvm-readobj --elf-cg-profile %t.sym | FileCheck %s --check-prefix=SYMBOL-NAMES +# RUN: llvm-readobj --cg-profile %t.sym | FileCheck %s --check-prefix=SYMBOL-NAMES # SYMBOL-NAMES: CGProfile [ # SYMBOL-NAMES-NEXT: CGProfileEntry { diff --git a/llvm/tools/llvm-readobj/llvm-readobj.cpp b/llvm/tools/llvm-readobj/llvm-readobj.cpp --- a/llvm/tools/llvm-readobj/llvm-readobj.cpp +++ b/llvm/tools/llvm-readobj/llvm-readobj.cpp @@ -345,8 +345,11 @@ cl::desc("Alias for --elf-hash-histogram"), cl::aliasopt(HashHistogram)); - // --elf-cg-profile - cl::opt CGProfile("elf-cg-profile", cl::desc("Display callgraph profile section")); + // --cg-profile + cl::opt CGProfile("cg-profile", + cl::desc("Display callgraph profile section")); + cl::alias ELFCGProfile("elf-cg-profile", cl::desc("Alias for --cg-profile"), + cl::aliasopt(CGProfile)); // -addrsig cl::opt Addrsig("addrsig",