[llvm] [llvm-objcopy][test] Use llvm-readelf instead for clearer visualization (PR #79874)
Yi Kong via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 31 18:36:54 PST 2024
https://github.com/kongy updated https://github.com/llvm/llvm-project/pull/79874
>From ec5551ace7b7c10a5e78455bb47783fcb730808a Mon Sep 17 00:00:00 2001
From: Yi Kong <yikong at google.com>
Date: Tue, 30 Jan 2024 02:51:01 +0900
Subject: [PATCH 1/3] [llvm-objcopy][test] Use llvm-readelf instead for clearer
visualization
NFCI.
---
.../llvm-objcopy/ELF/prefix-symbols.test | 60 ++++---------------
1 file changed, 10 insertions(+), 50 deletions(-)
diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
index 8c6503d4c8e09..ac8f4bc1a684f 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
@@ -1,8 +1,8 @@
# RUN: yaml2obj %s -o %t
# RUN: llvm-objcopy --prefix-symbols prefix %t %t2
-# RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefixes=COMMON,BASIC
+# RUN: llvm-readelf --symbols %t2 | FileCheck %s --check-prefixes=COMMON,BASIC
# RUN: llvm-objcopy --redefine-sym bar=baz --prefix-symbols prefix %t %t3
-# RUN: llvm-readobj --symbols %t3 | FileCheck %s --check-prefixes=COMMON,REDEF
+# RUN: llvm-readelf --symbols %t3 | FileCheck %s --check-prefixes=COMMON,REDEF
## Show that an empty string is permitted as the argument to
## --prefix-symbols.
@@ -40,51 +40,11 @@ Symbols:
- Name: undef
Binding: STB_GLOBAL
-# COMMON: Symbols [
-# COMMON-NEXT: Symbol {
-# COMMON-NEXT: Name:
-# COMMON-NEXT: Value: 0x0
-# COMMON-NEXT: Size: 0
-# COMMON-NEXT: Binding: Local
-# COMMON-NEXT: Type: None
-# COMMON-NEXT: Other: 0
-# COMMON-NEXT: Section: Undefined
-# COMMON-NEXT: }
-# COMMON-NEXT: Symbol {
-# COMMON-NEXT: Name: foo
-# COMMON-NEXT: Value: 0x0
-# COMMON-NEXT: Size: 0
-# COMMON-NEXT: Binding: Local
-# COMMON-NEXT: Type: Section
-# COMMON-NEXT: Other: 0
-# COMMON-NEXT: Section: .text
-# COMMON-NEXT: }
-# COMMON-NEXT: Symbol {
-# BASIC-NEXT: Name: prefixbar
-# REDEF-NEXT: Name: prefixbaz
-# COMMON-NEXT: Value: 0x0
-# COMMON-NEXT: Size: 0
-# COMMON-NEXT: Binding: Local
-# COMMON-NEXT: Type: File
-# COMMON-NEXT: Other: 0
-# COMMON-NEXT: Section: .text
-# COMMON-NEXT: }
-# COMMON-NEXT: Symbol {
-# COMMON-NEXT: Name: prefixfoobar
-# COMMON-NEXT: Value: 0x0
-# COMMON-NEXT: Size: 0
-# COMMON-NEXT: Binding: Global
-# COMMON-NEXT: Type: Function
-# COMMON-NEXT: Other: 0
-# COMMON-NEXT: Section: .text
-# COMMON-NEXT: }
-# COMMON-NEXT: Symbol {
-# COMMON-NEXT: Name: prefixundef
-# COMMON-NEXT: Value: 0x0
-# COMMON-NEXT: Size: 0
-# COMMON-NEXT: Binding: Global
-# COMMON-NEXT: Type: None
-# COMMON-NEXT: Other: 0
-# COMMON-NEXT: Section: Undefined
-# COMMON-NEXT: }
-# COMMON-NEXT:]
+#COMMON: Symbol table '.symtab' contains 5 entries:
+#COMMON-NEXT: Num: Value Size Type Bind Vis Ndx Name
+#COMMON-NEXT: 0: {{.*}} 0 NOTYPE LOCAL {{.*}}
+#COMMON-NEXT: 1: {{.*}} 0 SECTION LOCAL {{.*}} foo
+#BASIC-NEXT: 2: {{.*}} 0 FILE LOCAL {{.*}} prefixbar
+#REDEF-NEXT: 2: {{.*}} 0 FILE LOCAL {{.*}} prefixbaz
+#COMMON-NEXT: 3: {{.*}} 0 FUNC GLOBAL {{.*}} prefixfoobar
+#COMMON-NEXT: 4: {{.*}} 0 NOTYPE GLOBAL {{.*}} prefixundef
\ No newline at end of file
>From f2e660e814f467959c34ef4c943a4e8633d0f60c Mon Sep 17 00:00:00 2001
From: Yi Kong <yikong at google.com>
Date: Tue, 30 Jan 2024 02:56:06 +0900
Subject: [PATCH 2/3] Add back EOL at EOF
---
llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
index ac8f4bc1a684f..5a2055e297595 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
@@ -47,4 +47,4 @@ Symbols:
#BASIC-NEXT: 2: {{.*}} 0 FILE LOCAL {{.*}} prefixbar
#REDEF-NEXT: 2: {{.*}} 0 FILE LOCAL {{.*}} prefixbaz
#COMMON-NEXT: 3: {{.*}} 0 FUNC GLOBAL {{.*}} prefixfoobar
-#COMMON-NEXT: 4: {{.*}} 0 NOTYPE GLOBAL {{.*}} prefixundef
\ No newline at end of file
+#COMMON-NEXT: 4: {{.*}} 0 NOTYPE GLOBAL {{.*}} prefixundef
>From 4ad4c6c1a2a830b482d6eea29cde260bd82db603 Mon Sep 17 00:00:00 2001
From: Yi Kong <yikong at google.com>
Date: Thu, 1 Feb 2024 11:36:34 +0900
Subject: [PATCH 3/3] Address comments
---
.../tools/llvm-objcopy/ELF/prefix-symbols.test | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
index 5a2055e297595..4f221687d573a 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test
@@ -40,11 +40,11 @@ Symbols:
- Name: undef
Binding: STB_GLOBAL
-#COMMON: Symbol table '.symtab' contains 5 entries:
-#COMMON-NEXT: Num: Value Size Type Bind Vis Ndx Name
-#COMMON-NEXT: 0: {{.*}} 0 NOTYPE LOCAL {{.*}}
-#COMMON-NEXT: 1: {{.*}} 0 SECTION LOCAL {{.*}} foo
-#BASIC-NEXT: 2: {{.*}} 0 FILE LOCAL {{.*}} prefixbar
-#REDEF-NEXT: 2: {{.*}} 0 FILE LOCAL {{.*}} prefixbaz
-#COMMON-NEXT: 3: {{.*}} 0 FUNC GLOBAL {{.*}} prefixfoobar
-#COMMON-NEXT: 4: {{.*}} 0 NOTYPE GLOBAL {{.*}} prefixundef
+# COMMON: Symbol table '.symtab' contains 5 entries:
+# COMMON-NEXT: Num: Value Size Type Bind Vis Ndx Name
+# COMMON-NEXT: 0: [[#]] 0 NOTYPE LOCAL {{.*}}
+# COMMON-NEXT: 1: [[#]] 0 SECTION LOCAL {{.*}} foo
+# BASIC-NEXT: 2: [[#]] 0 FILE LOCAL {{.*}} prefixbar
+# REDEF-NEXT: 2: [[#]] 0 FILE LOCAL {{.*}} prefixbaz
+# COMMON-NEXT: 3: [[#]] 0 FUNC GLOBAL {{.*}} prefixfoobar
+# COMMON-NEXT: 4: [[#]] 0 NOTYPE GLOBAL {{.*}} prefixundef
More information about the llvm-commits
mailing list