diff --git a/lld/test/ELF/as-needed-no-reloc.s b/lld/test/ELF/as-needed-no-reloc.s index 6cedeec3155d6d..07b291a4940efb 100644 --- a/lld/test/ELF/as-needed-no-reloc.s +++ b/lld/test/ELF/as-needed-no-reloc.s @@ -8,7 +8,7 @@ # There must be a NEEDED entry for each undefined -# CHECK: (NEEDED) Shared library: [{{.*}}as-needed-no-reloc{{.*}}2.so] +# CHECK: (NEEDED) Shared library: {{.*}}as-needed-no-reloc{{.*}}2.so # CHECK: UND bar .globl _start diff --git a/lld/test/ELF/as-needed.s b/lld/test/ELF/as-needed.s index 1623f324892b49..d115c672dda8c4 100644 --- a/lld/test/ELF/as-needed.s +++ b/lld/test/ELF/as-needed.s @@ -32,13 +32,13 @@ // RUN: ld.lld %t.o %t.script -o %t2 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s -// CHECK: NEEDED Shared library: [shared1] -// CHECK: NEEDED Shared library: [shared2] -// CHECK: NEEDED Shared library: [shared3] +// CHECK: NEEDED Shared library: shared1 +// CHECK: NEEDED Shared library: shared2 +// CHECK: NEEDED Shared library: shared3 -// CHECK2: NEEDED Shared library: [shared1] -// CHECK2-NOT: NEEDED Shared library: [shared2] -// CHECK2-NOT: NEEDED Shared library: [shared3] +// CHECK2: NEEDED Shared library: shared1 +// CHECK2-NOT: NEEDED Shared library: shared2 +// CHECK2-NOT: NEEDED Shared library: shared3 .global _start _start: diff --git a/lld/test/ELF/auxiliary.s b/lld/test/ELF/auxiliary.s index 5a74060cc851d7..dd978b0c423a5f 100644 --- a/lld/test/ELF/auxiliary.s +++ b/lld/test/ELF/auxiliary.s @@ -7,8 +7,8 @@ # CHECK: DynamicSection [ # CHECK-NEXT: Tag Type Name/Value -# CHECK-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [aaa] -# CHECK-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [bbb] +# CHECK-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: aaa +# CHECK-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: bbb # RUN: not ld.lld %t.o -f aaa --auxiliary bbb -o /dev/null 2>&1 \ # RUN: | FileCheck -check-prefix=ERR %s diff --git a/lld/test/ELF/dynamic-reloc.s b/lld/test/ELF/dynamic-reloc.s index 6d98db0c2468e6..6dae02cae125a0 100644 --- a/lld/test/ELF/dynamic-reloc.s +++ b/lld/test/ELF/dynamic-reloc.s @@ -32,7 +32,7 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value -// CHECK-NEXT: 0x0000000000000001 NEEDED Shared library: [so] +// CHECK-NEXT: 0x0000000000000001 NEEDED Shared library: so // CHECK-NEXT: 0x0000000000000015 DEBUG 0x0 // CHECK-NEXT: 0x0000000000000017 JMPREL // CHECK-NEXT: 0x0000000000000002 PLTRELSZ 24 (bytes) diff --git a/lld/test/ELF/filter.s b/lld/test/ELF/filter.s index 2b07c01013dfa6..3f34febacf659e 100644 --- a/lld/test/ELF/filter.s +++ b/lld/test/ELF/filter.s @@ -13,8 +13,8 @@ # CHECK: DynamicSection [ # CHECK-NEXT: Tag Type Name/Value -# CHECK-NEXT: 0x000000007FFFFFFF FILTER Filter library: [foo.so] -# CHECK-NEXT: 0x000000007FFFFFFF FILTER Filter library: [boo.so] +# CHECK-NEXT: 0x000000007FFFFFFF FILTER Filter library: foo.so +# CHECK-NEXT: 0x000000007FFFFFFF FILTER Filter library: boo.so # RUN: not ld.lld %t.o -F x -o /dev/null 2>&1 | FileCheck -check-prefix=ERR %s # ERR: -F may not be used without -shared diff --git a/lld/test/ELF/gc-sections-shared.s b/lld/test/ELF/gc-sections-shared.s index d32c15d4187fe3..9174bdc6f2a8f5 100644 --- a/lld/test/ELF/gc-sections-shared.s +++ b/lld/test/ELF/gc-sections-shared.s @@ -15,7 +15,7 @@ # this case is checked with symbol qux and %t4.so. # CHECK-NOT: NEEDED -# CHECK: (NEEDED) Shared library: [{{.*}}3.so] +# CHECK: (NEEDED) Shared library: {{.*}}3.so # CHECK-NOT: NEEDED # CHECK-DAG: FUNC WEAK DEFAULT UND qux diff --git a/lld/test/ELF/no-soname.s b/lld/test/ELF/no-soname.s index 69b17cd6cc1c81..f86b74eb15c127 100644 --- a/lld/test/ELF/no-soname.s +++ b/lld/test/ELF/no-soname.s @@ -6,26 +6,26 @@ // RUN: ld.lld %t.o %t.dir/no-soname/libfoo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s -// CHECK: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/libfoo.so] +// CHECK: 0x0000000000000001 NEEDED Shared library: {{.*}}/no-soname/libfoo.so // CHECK-NOT: NEEDED // RUN: ld.lld %t.o %t.dir/no-soname/../no-soname/libfoo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK2 -// CHECK2: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/../no-soname/libfoo.so] +// CHECK2: 0x0000000000000001 NEEDED Shared library: {{.*}}/no-soname/../no-soname/libfoo.so // CHECK2-NOT: NEEDED // RUN: ld.lld %t.o -L%t.dir/no-soname/../no-soname -lfoo -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK3 -// CHECK3: 0x0000000000000001 NEEDED Shared library: [libfoo.so] +// CHECK3: 0x0000000000000001 NEEDED Shared library: libfoo.so // CHECK3-NOT: NEEDED // RUN: ld.lld %t.o -shared -soname libbar.so -o %t.dir/no-soname/libbar.so // RUN: ld.lld %t.o %t.dir/no-soname/libbar.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK4 -// CHECK4: 0x0000000000000001 NEEDED Shared library: [libbar.so] +// CHECK4: 0x0000000000000001 NEEDED Shared library: libbar.so // CHECK4-NOT: NEEDED .global _start diff --git a/lld/test/ELF/partition-synthetic-sections.s b/lld/test/ELF/partition-synthetic-sections.s index d38597856e165e..0ae11fed1395a5 100644 --- a/lld/test/ELF/partition-synthetic-sections.s +++ b/lld/test/ELF/partition-synthetic-sections.s @@ -74,10 +74,10 @@ // CHECK: Dynamic section // CHECK-NEXT: Tag -// CHECK-NEXT: 0x0000000000000001 (NEEDED) Shared library: [verneed1.so.0] -// PART0-NEXT: 0x000000000000000e (SONAME) Library soname: [main.so] -// PART1-NEXT: 0x0000000000000001 (NEEDED) Shared library: [main.so] -// PART1-NEXT: 0x000000000000000e (SONAME) Library soname: [part1] +// CHECK-NEXT: 0x0000000000000001 (NEEDED) Shared library: verneed1.so.0 +// PART0-NEXT: 0x000000000000000e (SONAME) Library soname: main.so +// PART1-NEXT: 0x0000000000000001 (NEEDED) Shared library: main.so +// PART1-NEXT: 0x000000000000000e (SONAME) Library soname: part1 // CHECK-NEXT: 0x0000000000000007 (RELA) 0x[[RELA_DYN_ADDR]] // CHECK-NEXT: 0x0000000000000008 (RELASZ) // CHECK-NEXT: 0x0000000000000009 (RELAENT) 24 (bytes) diff --git a/lld/test/ELF/push-state.s b/lld/test/ELF/push-state.s index 6477d9d9150b65..038382d2f6a940 100644 --- a/lld/test/ELF/push-state.s +++ b/lld/test/ELF/push-state.s @@ -24,7 +24,7 @@ // RUN: ld.lld -o %t.exe -push-state -as-needed -pop-state %t.so %t1.o // RUN: llvm-readobj --dynamic-table %t.exe | FileCheck -check-prefix=NO-AS-NEEDED %s -// NO-AS-NEEDED: NEEDED Shared library: [libfoo] +// NO-AS-NEEDED: NEEDED Shared library: libfoo // RUN: mkdir -p %t.dir diff --git a/lld/test/ELF/shared-ppc64.s b/lld/test/ELF/shared-ppc64.s index 00a27ad0d004e7..2258db2cc45929 100644 --- a/lld/test/ELF/shared-ppc64.s +++ b/lld/test/ELF/shared-ppc64.s @@ -28,7 +28,7 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value // CHECK-NEXT: 0x000000000000001D RUNPATH Library runpath: [foo:bar] -// CHECK-NEXT: 0x0000000000000001 NEEDED Shared library: [{{.*}}2.so] +// CHECK-NEXT: 0x0000000000000001 NEEDED Shared library: {{.*}}2.so // CHECK-NEXT: 0x0000000000000015 DEBUG 0x0 // CHECK-NEXT: 0x0000000000000007 RELA [[RELADDR]] // CHECK-NEXT: 0x0000000000000008 RELASZ [[RELSIZE]] (bytes) diff --git a/lld/test/ELF/shared.s b/lld/test/ELF/shared.s index 800570e63b9533..d8a690d3fd27d4 100644 --- a/lld/test/ELF/shared.s +++ b/lld/test/ELF/shared.s @@ -157,7 +157,7 @@ // CHECK: DynamicSection [ // CHECK-NEXT: Tag Type Name/Value // CHECK-NEXT: 0x0000001D RUNPATH Library runpath: [foo:bar] -// CHECK-NEXT: 0x00000001 NEEDED Shared library: [{{.*}}2.so] +// CHECK-NEXT: 0x00000001 NEEDED Shared library: {{.*}}2.so // CHECK-NEXT: 0x00000015 DEBUG 0x0 // CHECK-NEXT: 0x00000011 REL [[RELADDR]] // CHECK-NEXT: 0x00000012 RELSZ [[RELSIZE]] (bytes) diff --git a/lld/test/ELF/soname.s b/lld/test/ELF/soname.s index 25c969dab74571..904b506f4b2c3f 100644 --- a/lld/test/ELF/soname.s +++ b/lld/test/ELF/soname.s @@ -5,7 +5,7 @@ // RUN: ld.lld %t.o %t.so %t2.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s -// CHECK: 0x0000000000000001 NEEDED Shared library: [bar] +// CHECK: 0x0000000000000001 NEEDED Shared library: bar // CHECK-NOT: NEEDED .global _start diff --git a/lld/test/ELF/soname2.s b/lld/test/ELF/soname2.s index 67a9c24af5cdd3..6866f9802c1982 100644 --- a/lld/test/ELF/soname2.s +++ b/lld/test/ELF/soname2.s @@ -3,7 +3,7 @@ // RUN: ld.lld %t.o -shared -soname=foo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s -// CHECK: 0x000000000000000E SONAME Library soname: [foo.so] +// CHECK: 0x000000000000000E SONAME Library soname: foo.so .global _start _start: diff --git a/lld/test/ELF/wrap-drop-shared-original.s b/lld/test/ELF/wrap-drop-shared-original.s index f3784aa9727964..59fef1493a567c 100644 --- a/lld/test/ELF/wrap-drop-shared-original.s +++ b/lld/test/ELF/wrap-drop-shared-original.s @@ -20,13 +20,13 @@ # RUN: llvm-readelf --dynamic --dyn-syms %t/libref-with-original-and-wrapped.so | \ # RUN: FileCheck --check-prefix=ORIGINAL-AND-WRAPPED %s -# ORIGINAL-NOT: (NEEDED) Shared library: [liboriginal.so] +# ORIGINAL-NOT: (NEEDED) Shared library: liboriginal.so # ORIGINAL: Symbol table '.dynsym' contains 3 entries: # ORIGINAL: NOTYPE LOCAL DEFAULT UND # ORIGINAL-NEXT: NOTYPE GLOBAL DEFAULT UND __wrap_foo # ORIGINAL-NEXT: NOTYPE GLOBAL DEFAULT 6 ref -# ORIGINAL-AND-WRAPPED: (NEEDED) Shared library: [liboriginal-and-wrapped.so] +# ORIGINAL-AND-WRAPPED: (NEEDED) Shared library: liboriginal-and-wrapped.so # ORIGINAL-AND-WRAPPED: Symbol table '.dynsym' contains 3 entries: # ORIGINAL-AND-WRAPPED: NOTYPE LOCAL DEFAULT UND # ORIGINAL-AND-WRAPPED-NEXT: NOTYPE GLOBAL DEFAULT UND __wrap_foo diff --git a/llvm/test/tools/llvm-ifs/write-stub.test b/llvm/test/tools/llvm-ifs/write-stub.test index 44c194b77abc72..e9f2d4f147b2c0 100644 --- a/llvm/test/tools/llvm-ifs/write-stub.test +++ b/llvm/test/tools/llvm-ifs/write-stub.test @@ -151,7 +151,7 @@ Symbols: # CHECK-NEXT: 0x[[DYNTABZ]]0000006 SYMTAB # CHECK-NEXT: 0x[[DYNTABZ]]0000005 STRTAB # CHECK-NEXT: 0x[[DYNTABZ]]000000A STRSZ -# CHECK-NEXT: 0x[[DYNTABZ]]0000001 NEEDED Shared library: [libc.so.6] +# CHECK-NEXT: 0x[[DYNTABZ]]0000001 NEEDED Shared library: libc.so.6 # CHECK-NEXT: 0x[[DYNTABZ]]0000000 NULL # CHECK-NEXT: ] diff --git a/llvm/test/tools/llvm-readobj/ELF/dynamic-malformed.test b/llvm/test/tools/llvm-readobj/ELF/dynamic-malformed.test index d160ea87208c3b..05be15775e9e71 100644 --- a/llvm/test/tools/llvm-readobj/ELF/dynamic-malformed.test +++ b/llvm/test/tools/llvm-readobj/ELF/dynamic-malformed.test @@ -100,15 +100,15 @@ ProgramHeaders: # BAD-STRING-LLVM-NEXT: 0x0000000000000005 STRTAB 0x1000 # BAD-STRING-LLVM-NEXT: 0x000000000000000A STRSZ 1 (bytes) # BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb2: it goes past the end of the table (0xb1) -# BAD-STRING-LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: [] +# BAD-STRING-LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: # BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb3: it goes past the end of the table (0xb1) -# BAD-STRING-LLVM-NEXT: 0x000000007FFFFFFF FILTER Filter library: [] +# BAD-STRING-LLVM-NEXT: 0x000000007FFFFFFF FILTER Filter library: # BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: it goes past the end of the table (0xb1) -# BAD-STRING-LLVM-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [] +# BAD-STRING-LLVM-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: # BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: it goes past the end of the table (0xb1) -# BAD-STRING-LLVM-NEXT: 0x000000007FFFFFFE USED Not needed object: [] +# BAD-STRING-LLVM-NEXT: 0x000000007FFFFFFE USED Not needed object: ## Note: there is no "string table at offset 0xb0..." warning here, because it was printed earlier. -# BAD-STRING-LLVM-NEXT: 0x000000000000000E SONAME Library soname: [] +# BAD-STRING-LLVM-NEXT: 0x000000000000000E SONAME Library soname: # BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb7: it goes past the end of the table (0xb1) # BAD-STRING-LLVM-NEXT: 0x000000000000000F RPATH Library rpath: [] # BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb8: it goes past the end of the table (0xb1) @@ -121,15 +121,15 @@ ProgramHeaders: # BAD-STRING-GNU-NEXT: 0x0000000000000005 (STRTAB) 0x1000 # BAD-STRING-GNU-NEXT: 0x000000000000000a (STRSZ) 1 (bytes) # BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb2: it goes past the end of the table (0xb1) -# BAD-STRING-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: [] +# BAD-STRING-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: # BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb3: it goes past the end of the table (0xb1) -# BAD-STRING-GNU-NEXT: 0x000000007fffffff (FILTER) Filter library: [] +# BAD-STRING-GNU-NEXT: 0x000000007fffffff (FILTER) Filter library: # BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: it goes past the end of the table (0xb1) -# BAD-STRING-GNU-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: [] +# BAD-STRING-GNU-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: # BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: it goes past the end of the table (0xb1) -# BAD-STRING-GNU-NEXT: 0x000000007ffffffe (USED) Not needed object: [] +# BAD-STRING-GNU-NEXT: 0x000000007ffffffe (USED) Not needed object: # BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: it goes past the end of the table (0xb1) -# BAD-STRING-GNU-NEXT: 0x000000000000000e (SONAME) Library soname: [] +# BAD-STRING-GNU-NEXT: 0x000000000000000e (SONAME) Library soname: # BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb7: it goes past the end of the table (0xb1) # BAD-STRING-GNU-NEXT: 0x000000000000000f (RPATH) Library rpath: [] # BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb8: it goes past the end of the table (0xb1) @@ -199,8 +199,8 @@ ProgramHeaders: # BAD-STRTAB-ERR2: warning: '[[FILE]]': unable to parse DT_STRTAB: virtual address is not in any segment: 0x2000000 # BAD-STRTAB-LLVM: LoadName: # BAD-STRTAB: warning: '[[FILE]]': string table was not found -# BAD-STRTAB-LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: [] -# BAD-STRTAB-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: [] +# BAD-STRTAB-LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: +# BAD-STRTAB-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: # BAD-STRTAB: NeededLibraries [ # BAD-STRTAB: # BAD-STRTAB: ] @@ -313,15 +313,15 @@ ProgramHeaders: # NOT-TERMINATED-LLVM: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: the string table is not null-terminated # NOT-TERMINATED: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb0: the string table is not null-terminated -# NOT-TERMINATED-NEXT: {{[(]?}}NEEDED{{[)]?}} Shared library: [] +# NOT-TERMINATED-NEXT: {{[(]?}}NEEDED{{[)]?}} Shared library: # NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb1: the string table is not null-terminated -# NOT-TERMINATED-NEXT: {{[(]?}}FILTER{{[)]?}} Filter library: [] +# NOT-TERMINATED-NEXT: {{[(]?}}FILTER{{[)]?}} Filter library: # NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb2: the string table is not null-terminated -# NOT-TERMINATED-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: [] +# NOT-TERMINATED-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: # NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb3: the string table is not null-terminated -# NOT-TERMINATED-NEXT: {{[(]?}}USED{{[)]?}} Not needed object: [] +# NOT-TERMINATED-NEXT: {{[(]?}}USED{{[)]?}} Not needed object: # NOT-TERMINATED-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: the string table is not null-terminated -# NOT-TERMINATED-NEXT: {{[(]?}}SONAME{{[)]?}} Library soname: [] +# NOT-TERMINATED-NEXT: {{[(]?}}SONAME{{[)]?}} Library soname: # NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: the string table is not null-terminated # NOT-TERMINATED-NEXT: {{[(]?}}RPATH{{[)]?}} Library rpath: [] # NOT-TERMINATED-GREQ-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: the string table is not null-terminated @@ -390,11 +390,11 @@ ProgramHeaders: ## as normal. Since the file ends with a zero byte, strings are dumped, but if it didn't, ## we'd get printed instead. The important bit is that we don't get the past the end warning. -# BEFORE-THE-EOF: {{[(]?}}NEEDED{{[)]?}} Shared library: [test.soabc] -# BEFORE-THE-EOF-NEXT: {{[(]?}}FILTER{{[)]?}} Filter library: [est.soabc] -# BEFORE-THE-EOF-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: [st.soabc] -# BEFORE-THE-EOF-NEXT: {{[(]?}}USED{{[)]?}} Not needed object: [t.soabc] -# BEFORE-THE-EOF-NEXT: {{[(]?}}SONAME{{[)]?}} Library soname: [.soabc] +# BEFORE-THE-EOF: {{[(]?}}NEEDED{{[)]?}} Shared library: test.soabc +# BEFORE-THE-EOF-NEXT: {{[(]?}}FILTER{{[)]?}} Filter library: est.soabc +# BEFORE-THE-EOF-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: st.soabc +# BEFORE-THE-EOF-NEXT: {{[(]?}}USED{{[)]?}} Not needed object: t.soabc +# BEFORE-THE-EOF-NEXT: {{[(]?}}SONAME{{[)]?}} Library soname: .soabc # BEFORE-THE-EOF-NEXT: {{[(]?}}RPATH{{[)]?}} Library rpath: [soabc] # BEFORE-THE-EOF-NEXT: {{[(]?}}RUNPATH{{[)]?}} Library runpath: [oabc] # BEFORE-THE-EOF-NEXT: {{[(]?}}NULL{{[)]?}} 0x0 @@ -406,11 +406,11 @@ ProgramHeaders: # PAST-THE-EOF: warning: '[[FILE]]': the dynamic string table at 0xb0 goes past the end of the file (0x2c0) with DT_STRSZ = 0x211 # PAST-THE-EOF: warning: '[[FILE]]': string table was not found -# PAST-THE-EOF: {{[(]?}}NEEDED{{[)]?}} Shared library: [] -# PAST-THE-EOF-NEXT: {{[(]?}}FILTER{{[)]?}} Filter library: [] -# PAST-THE-EOF-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: [] -# PAST-THE-EOF-NEXT: {{[(]?}}USED{{[)]?}} Not needed object: [] -# PAST-THE-EOF-NEXT: {{[(]?}}SONAME{{[)]?}} Library soname: [] +# PAST-THE-EOF: {{[(]?}}NEEDED{{[)]?}} Shared library: +# PAST-THE-EOF-NEXT: {{[(]?}}FILTER{{[)]?}} Filter library: +# PAST-THE-EOF-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: +# PAST-THE-EOF-NEXT: {{[(]?}}USED{{[)]?}} Not needed object: +# PAST-THE-EOF-NEXT: {{[(]?}}SONAME{{[)]?}} Library soname: # PAST-THE-EOF-NEXT: {{[(]?}}RPATH{{[)]?}} Library rpath: [] # PAST-THE-EOF-NEXT: {{[(]?}}RUNPATH{{[)]?}} Library runpath: [] # PAST-THE-EOF-NEXT: {{[(]?}}NULL{{[)]?}} 0x0 diff --git a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test index d05eed0f89cc62..e25f64ca220275 100644 --- a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test +++ b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test @@ -13,7 +13,7 @@ # LLVM64:DynamicSection [ (61 entries) # LLVM64-NEXT: Tag Type Name/Value -# LLVM64-NEXT: 0x0000000000000001 NEEDED Shared library: [D] +# LLVM64-NEXT: 0x0000000000000001 NEEDED Shared library: D # LLVM64-NEXT: 0x0000000000000002 PLTRELSZ 16 (bytes) # LLVM64-NEXT: 0x0000000000000003 PLTGOT 0x1000 # LLVM64-NEXT: 0x0000000000000004 HASH 0x1000 @@ -26,8 +26,8 @@ # LLVM64-NEXT: 0x000000000000000B SYMENT 2439 (bytes) # LLVM64-NEXT: 0x000000000000000C INIT 0x1000 # LLVM64-NEXT: 0x000000000000000D FINI 0x1000 -# LLVM64-NEXT: 0x000000000000000E SONAME Library soname: [U] -# LLVM64-NEXT: 0x000000000000000F RPATH Library rpath: [f] +# LLVM64-NEXT: 0x000000000000000E SONAME Library soname: U +# LLVM64-NEXT: 0x000000000000000F RPATH Library rpath: [x:w:U] # LLVM64-NEXT: 0x0000000000000010 SYMBOLIC 0x1234567890ABCDEF # LLVM64-NEXT: 0x0000000000000011 REL 0x1000 # LLVM64-NEXT: 0x0000000000000012 RELSZ 16 (bytes) @@ -67,9 +67,9 @@ # LLVM64-NEXT: 0x000000006FFFFFFD VERDEFNUM 0 # LLVM64-NEXT: 0x000000006FFFFFFE VERNEED 0x1000 # LLVM64-NEXT: 0x000000006FFFFFFF VERNEEDNUM 0 -# LLVM64-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [D] -# LLVM64-NEXT: 0x000000007FFFFFFE USED Not needed object: [U] -# LLVM64-NEXT: 0x000000007FFFFFFF FILTER Filter library: [U] +# LLVM64-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: D +# LLVM64-NEXT: 0x000000007FFFFFFE USED Not needed object: U +# LLVM64-NEXT: 0x000000007FFFFFFF FILTER Filter library: U # LLVM64-NEXT: 0x0000000012345678 0x12345678 0x8765432187654321 # LLVM64-NEXT: 0x000000006ABCDEF0 0x6abcdef0 0x9988776655443322 # LLVM64-NEXT: 0x0000000076543210 0x76543210 0x5555666677778888 @@ -78,7 +78,7 @@ # GNU64:Dynamic section at offset {{.*}} contains 61 entries: # GNU64-NEXT: Tag Type Name/Value -# GNU64-NEXT: 0x0000000000000001 (NEEDED) Shared library: [D] +# GNU64-NEXT: 0x0000000000000001 (NEEDED) Shared library: D # GNU64-NEXT: 0x0000000000000002 (PLTRELSZ) 16 (bytes) # GNU64-NEXT: 0x0000000000000003 (PLTGOT) 0x1000 # GNU64-NEXT: 0x0000000000000004 (HASH) 0x1000 @@ -91,8 +91,8 @@ # GNU64-NEXT: 0x000000000000000b (SYMENT) 2439 (bytes) # GNU64-NEXT: 0x000000000000000c (INIT) 0x1000 # GNU64-NEXT: 0x000000000000000d (FINI) 0x1000 -# GNU64-NEXT: 0x000000000000000e (SONAME) Library soname: [U] -# GNU64-NEXT: 0x000000000000000f (RPATH) Library rpath: [f] +# GNU64-NEXT: 0x000000000000000e (SONAME) Library soname: U +# GNU64-NEXT: 0x000000000000000f (RPATH) Library rpath: [x:w:U] # GNU64-NEXT: 0x0000000000000010 (SYMBOLIC) 0x1234567890abcdef # GNU64-NEXT: 0x0000000000000011 (REL) 0x1000 # GNU64-NEXT: 0x0000000000000012 (RELSZ) 16 (bytes) @@ -132,9 +132,9 @@ # GNU64-NEXT: 0x000000006ffffffd (VERDEFNUM) 0 # GNU64-NEXT: 0x000000006ffffffe (VERNEED) 0x1000 # GNU64-NEXT: 0x000000006fffffff (VERNEEDNUM) 0 -# GNU64-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: [D] -# GNU64-NEXT: 0x000000007ffffffe (USED) Not needed object: [U] -# GNU64-NEXT: 0x000000007fffffff (FILTER) Filter library: [U] +# GNU64-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: D +# GNU64-NEXT: 0x000000007ffffffe (USED) Not needed object: U +# GNU64-NEXT: 0x000000007fffffff (FILTER) Filter library: U # GNU64-NEXT: 0x0000000012345678 (0x12345678) 0x8765432187654321 # GNU64-NEXT: 0x000000006abcdef0 (0x6abcdef0) 0x9988776655443322 # GNU64-NEXT: 0x0000000076543210 (0x76543210) 0x5555666677778888 @@ -216,9 +216,11 @@ # JSON64-NEXT: { # JSON64-NEXT: "Tag": 15, # JSON64-NEXT: "Type": "RPATH", -# JSON64-NEXT: "Value": 5, +# JSON64-NEXT: "Value": 9, # JSON64-NEXT: "Path": [ -# JSON64-NEXT: "f" +# JSON64-NEXT: "x", +# JSON64-NEXT: "w", +# JSON64-NEXT: "U" # JSON64-NEXT: ] # JSON64-NEXT: }, # JSON64-NEXT: { @@ -506,7 +508,7 @@ Sections: Type: SHT_STRTAB Address: 0x1000 Size: 0x10 - Content: "004400550066007700" + Content: "004400550066007700783A773A5500" - Name: .dynamic Type: SHT_DYNAMIC Address: 0x1010 @@ -540,7 +542,7 @@ Sections: - Tag: DT_SONAME Value: 0x3 - Tag: DT_RPATH - Value: 0x5 + Value: 0x9 - Tag: DT_SYMBOLIC Value: [[SYMBOLIC=0x1234567890abcdef]] - Tag: DT_REL @@ -659,7 +661,7 @@ ProgramHeaders: # LLVM32:DynamicSection [ (61 entries) # LLVM32-NEXT: Tag Type Name/Value -# LLVM32-NEXT: 0x00000001 NEEDED Shared library: [D] +# LLVM32-NEXT: 0x00000001 NEEDED Shared library: D # LLVM32-NEXT: 0x00000002 PLTRELSZ 16 (bytes) # LLVM32-NEXT: 0x00000003 PLTGOT 0x1000 # LLVM32-NEXT: 0x00000004 HASH 0x1000 @@ -672,8 +674,8 @@ ProgramHeaders: # LLVM32-NEXT: 0x0000000B SYMENT 2439 (bytes) # LLVM32-NEXT: 0x0000000C INIT 0x1000 # LLVM32-NEXT: 0x0000000D FINI 0x1000 -# LLVM32-NEXT: 0x0000000E SONAME Library soname: [U] -# LLVM32-NEXT: 0x0000000F RPATH Library rpath: [f] +# LLVM32-NEXT: 0x0000000E SONAME Library soname: U +# LLVM32-NEXT: 0x0000000F RPATH Library rpath: [x:w:U] # LLVM32-NEXT: 0x00000010 SYMBOLIC 0x12345678 # LLVM32-NEXT: 0x00000011 REL 0x1000 # LLVM32-NEXT: 0x00000012 RELSZ 16 (bytes) @@ -713,9 +715,9 @@ ProgramHeaders: # LLVM32-NEXT: 0x6FFFFFFD VERDEFNUM 0 # LLVM32-NEXT: 0x6FFFFFFE VERNEED 0x1000 # LLVM32-NEXT: 0x6FFFFFFF VERNEEDNUM 0 -# LLVM32-NEXT: 0x7FFFFFFD AUXILIARY Auxiliary library: [D] -# LLVM32-NEXT: 0x7FFFFFFE USED Not needed object: [U] -# LLVM32-NEXT: 0x7FFFFFFF FILTER Filter library: [U] +# LLVM32-NEXT: 0x7FFFFFFD AUXILIARY Auxiliary library: D +# LLVM32-NEXT: 0x7FFFFFFE USED Not needed object: U +# LLVM32-NEXT: 0x7FFFFFFF FILTER Filter library: U # LLVM32-NEXT: 0x12345678 0x12345678 0x87654321 # LLVM32-NEXT: 0x6ABCDEF0 0x6abcdef0 0x99887766 # LLVM32-NEXT: 0x76543210 0x76543210 0x55556666 @@ -724,7 +726,7 @@ ProgramHeaders: # GNU32:Dynamic section at offset 0x84 contains 61 entries: # GNU32-NEXT: Tag Type Name/Value -# GNU32-NEXT: 0x00000001 (NEEDED) Shared library: [D] +# GNU32-NEXT: 0x00000001 (NEEDED) Shared library: D # GNU32-NEXT: 0x00000002 (PLTRELSZ) 16 (bytes) # GNU32-NEXT: 0x00000003 (PLTGOT) 0x1000 # GNU32-NEXT: 0x00000004 (HASH) 0x1000 @@ -737,8 +739,8 @@ ProgramHeaders: # GNU32-NEXT: 0x0000000b (SYMENT) 2439 (bytes) # GNU32-NEXT: 0x0000000c (INIT) 0x1000 # GNU32-NEXT: 0x0000000d (FINI) 0x1000 -# GNU32-NEXT: 0x0000000e (SONAME) Library soname: [U] -# GNU32-NEXT: 0x0000000f (RPATH) Library rpath: [f] +# GNU32-NEXT: 0x0000000e (SONAME) Library soname: U +# GNU32-NEXT: 0x0000000f (RPATH) Library rpath: [x:w:U] # GNU32-NEXT: 0x00000010 (SYMBOLIC) 0x12345678 # GNU32-NEXT: 0x00000011 (REL) 0x1000 # GNU32-NEXT: 0x00000012 (RELSZ) 16 (bytes) @@ -778,9 +780,9 @@ ProgramHeaders: # GNU32-NEXT: 0x6ffffffd (VERDEFNUM) 0 # GNU32-NEXT: 0x6ffffffe (VERNEED) 0x1000 # GNU32-NEXT: 0x6fffffff (VERNEEDNUM) 0 -# GNU32-NEXT: 0x7ffffffd (AUXILIARY) Auxiliary library: [D] -# GNU32-NEXT: 0x7ffffffe (USED) Not needed object: [U] -# GNU32-NEXT: 0x7fffffff (FILTER) Filter library: [U] +# GNU32-NEXT: 0x7ffffffd (AUXILIARY) Auxiliary library: D +# GNU32-NEXT: 0x7ffffffe (USED) Not needed object: U +# GNU32-NEXT: 0x7fffffff (FILTER) Filter library: U # GNU32-NEXT: 0x12345678 (0x12345678) 0x87654321 # GNU32-NEXT: 0x6abcdef0 (0x6abcdef0) 0x99887766 # GNU32-NEXT: 0x76543210 (0x76543210) 0x55556666 @@ -854,7 +856,7 @@ Sections: # PHENTSIZE-LLVM: DynamicSection [ (61 entries) # PHENTSIZE-LLVM-NEXT: Tag Type Name/Value -# PHENTSIZE-LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: [] +# PHENTSIZE-LLVM-NEXT: 0x0000000000000001 NEEDED Shared library: # PHENTSIZE-LLVM-NEXT: 0x0000000000000002 PLTRELSZ 16 (bytes) # PHENTSIZE-LLVM-NEXT: 0x0000000000000003 PLTGOT 0x1000 # PHENTSIZE-LLVM-NEXT: 0x0000000000000004 HASH 0x1000 @@ -867,7 +869,7 @@ Sections: # PHENTSIZE-LLVM-NEXT: 0x000000000000000B SYMENT 2439 (bytes) # PHENTSIZE-LLVM-NEXT: 0x000000000000000C INIT 0x1000 # PHENTSIZE-LLVM-NEXT: 0x000000000000000D FINI 0x1000 -# PHENTSIZE-LLVM-NEXT: 0x000000000000000E SONAME Library soname: [] +# PHENTSIZE-LLVM-NEXT: 0x000000000000000E SONAME Library soname: # PHENTSIZE-LLVM-NEXT: 0x000000000000000F RPATH Library rpath: [] # PHENTSIZE-LLVM-NEXT: 0x0000000000000010 SYMBOLIC 0x1234567890ABCDEF # PHENTSIZE-LLVM-NEXT: 0x0000000000000011 REL 0x1000 @@ -908,9 +910,9 @@ Sections: # PHENTSIZE-LLVM-NEXT: 0x000000006FFFFFFD VERDEFNUM 0 # PHENTSIZE-LLVM-NEXT: 0x000000006FFFFFFE VERNEED 0x1000 # PHENTSIZE-LLVM-NEXT: 0x000000006FFFFFFF VERNEEDNUM 0 -# PHENTSIZE-LLVM-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [] -# PHENTSIZE-LLVM-NEXT: 0x000000007FFFFFFE USED Not needed object: [] -# PHENTSIZE-LLVM-NEXT: 0x000000007FFFFFFF FILTER Filter library: [] +# PHENTSIZE-LLVM-NEXT: 0x000000007FFFFFFD AUXILIARY Auxiliary library: +# PHENTSIZE-LLVM-NEXT: 0x000000007FFFFFFE USED Not needed object: +# PHENTSIZE-LLVM-NEXT: 0x000000007FFFFFFF FILTER Filter library: # PHENTSIZE-LLVM-NEXT: 0x0000000012345678 0x12345678 0x8765432187654321 # PHENTSIZE-LLVM-NEXT: 0x000000006ABCDEF0 0x6abcdef0 0x9988776655443322 # PHENTSIZE-LLVM-NEXT: 0x0000000076543210 0x76543210 0x5555666677778888 @@ -920,7 +922,7 @@ Sections: # PHENTSIZE-GNU: Dynamic section at offset 0xc0 contains 61 entries: # PHENTSIZE-GNU-NEXT: Tag Type Name/Value # PHENTSIZE-GNU-NEXT: warning: '[[FILE]]': string table was not found -# PHENTSIZE-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: [] +# PHENTSIZE-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: # PHENTSIZE-GNU-NEXT: 0x0000000000000002 (PLTRELSZ) 16 (bytes) # PHENTSIZE-GNU-NEXT: 0x0000000000000003 (PLTGOT) 0x1000 # PHENTSIZE-GNU-NEXT: 0x0000000000000004 (HASH) 0x1000 @@ -933,7 +935,7 @@ Sections: # PHENTSIZE-GNU-NEXT: 0x000000000000000b (SYMENT) 2439 (bytes) # PHENTSIZE-GNU-NEXT: 0x000000000000000c (INIT) 0x1000 # PHENTSIZE-GNU-NEXT: 0x000000000000000d (FINI) 0x1000 -# PHENTSIZE-GNU-NEXT: 0x000000000000000e (SONAME) Library soname: [] +# PHENTSIZE-GNU-NEXT: 0x000000000000000e (SONAME) Library soname: # PHENTSIZE-GNU-NEXT: 0x000000000000000f (RPATH) Library rpath: [] # PHENTSIZE-GNU-NEXT: 0x0000000000000010 (SYMBOLIC) 0x1234567890abcdef # PHENTSIZE-GNU-NEXT: 0x0000000000000011 (REL) 0x1000 @@ -974,9 +976,9 @@ Sections: # PHENTSIZE-GNU-NEXT: 0x000000006ffffffd (VERDEFNUM) 0 # PHENTSIZE-GNU-NEXT: 0x000000006ffffffe (VERNEED) 0x1000 # PHENTSIZE-GNU-NEXT: 0x000000006fffffff (VERNEEDNUM) 0 -# PHENTSIZE-GNU-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: [] -# PHENTSIZE-GNU-NEXT: 0x000000007ffffffe (USED) Not needed object: [] -# PHENTSIZE-GNU-NEXT: 0x000000007fffffff (FILTER) Filter library: [] +# PHENTSIZE-GNU-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: +# PHENTSIZE-GNU-NEXT: 0x000000007ffffffe (USED) Not needed object: +# PHENTSIZE-GNU-NEXT: 0x000000007fffffff (FILTER) Filter library: # PHENTSIZE-GNU-NEXT: 0x0000000012345678 (0x12345678) 0x8765432187654321 # PHENTSIZE-GNU-NEXT: 0x000000006abcdef0 (0x6abcdef0) 0x9988776655443322 # PHENTSIZE-GNU-NEXT: 0x0000000076543210 (0x76543210) 0x5555666677778888 diff --git a/llvm/test/tools/llvm-readobj/ELF/loadname.test b/llvm/test/tools/llvm-readobj/ELF/loadname.test index 18db00845e00b5..359b9ca762334b 100644 --- a/llvm/test/tools/llvm-readobj/ELF/loadname.test +++ b/llvm/test/tools/llvm-readobj/ELF/loadname.test @@ -15,7 +15,7 @@ # GNU-NEXT: Tag Type Name/Value # GNU-NEXT: 0x0000000000000005 (STRTAB) 0x0 # GNU-NEXT: 0x000000000000000a (STRSZ) 8 (bytes) -# GNU-NEXT: 0x000000000000000e (SONAME) Library soname: [test.so] +# GNU-NEXT: 0x000000000000000e (SONAME) Library soname: test.so # GNU-NEXT: 0x0000000000000000 (NULL) 0x0 !ELF @@ -62,4 +62,4 @@ ProgramHeaders: # BROKEN-OFFSET: warning: '[[FILE]]': unable to parse DT_STRTAB: can't map virtual address 0xfffe to the segment with index 1: the segment ends at 0x10077, which is greater than the file size (0x228) # BROKEN-OFFSET: warning: '[[FILE]]': string table was not found # BROKEN-OFFSET-LLVM: LoadName: -# BROKEN-OFFSET-GNU: 0x000000000000000e (SONAME) Library soname: [] +# BROKEN-OFFSET-GNU: 0x000000000000000e (SONAME) Library soname: diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp index 734b28db63e54b..a986ba88fdcfd1 100644 --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -2317,6 +2317,12 @@ std::string ELFDumper::getDynamicEntry(uint64_t Type, return OS.str(); }; + const std::map TagNames = { + {DT_NEEDED, "Shared library"}, {DT_SONAME, "Library soname"}, + {DT_AUXILIARY, "Auxiliary library"}, {DT_USED, "Not needed object"}, + {DT_FILTER, "Filter library"}, {DT_RPATH, "Library rpath"}, + {DT_RUNPATH, "Library runpath"}, + }; // Handle custom printing of architecture specific tags switch (Obj.getHeader().e_machine) { case EM_AARCH64: @@ -2474,18 +2480,11 @@ std::string ELFDumper::getDynamicEntry(uint64_t Type, case DT_AUXILIARY: case DT_USED: case DT_FILTER: + return (Twine(TagNames.at(Type)) + ": " + getDynamicString(Value)).str(); case DT_RPATH: - case DT_RUNPATH: { - const std::map TagNames = { - {DT_NEEDED, "Shared library"}, {DT_SONAME, "Library soname"}, - {DT_AUXILIARY, "Auxiliary library"}, {DT_USED, "Not needed object"}, - {DT_FILTER, "Filter library"}, {DT_RPATH, "Library rpath"}, - {DT_RUNPATH, "Library runpath"}, - }; - + case DT_RUNPATH: return (Twine(TagNames.at(Type)) + ": [" + getDynamicString(Value) + "]") .str(); - } case DT_FLAGS: return FormatFlags(Value, ArrayRef(ElfDynamicDTFlags)); case DT_FLAGS_1: