summaryrefslogtreecommitdiff
path: root/test/tools/llvm-readobj
diff options
context:
space:
mode:
Diffstat (limited to 'test/tools/llvm-readobj')
-rw-r--r--test/tools/llvm-readobj/Inputs/trivial.ll14
-rw-r--r--test/tools/llvm-readobj/Inputs/trivial.obj.wasmbin221 -> 285 bytes
-rw-r--r--test/tools/llvm-readobj/codeview-linetables.test20
-rw-r--r--test/tools/llvm-readobj/file-headers.test3
-rw-r--r--test/tools/llvm-readobj/relocations.test15
-rw-r--r--test/tools/llvm-readobj/sections.test131
-rw-r--r--test/tools/llvm-readobj/symbols.test22
7 files changed, 113 insertions, 92 deletions
diff --git a/test/tools/llvm-readobj/Inputs/trivial.ll b/test/tools/llvm-readobj/Inputs/trivial.ll
index f79b8b897691..e0e519d064de 100644
--- a/test/tools/llvm-readobj/Inputs/trivial.ll
+++ b/test/tools/llvm-readobj/Inputs/trivial.ll
@@ -1,9 +1,11 @@
-; llc -mtriple=i386-pc-win32 trivial.ll -filetype=obj -o trivial-object-test.coff-i386
-; llc -mtriple=x86_64-pc-win32 trivial.ll -filetype=obj -o trivial-object-test.coff-x86-64
-; llc -mtriple=i386-linux-gnu trivial.ll -filetype=obj -o trivial-object-test.elf-i386 -relocation-model=pic
-; llc -mtriple=x86_64-linux-gnu trivial.ll -filetype=obj -o trivial-object-test.elf-x86-64 -relocation-model=pic
-; llc -mtriple=i386-apple-darwin10 trivial.ll -filetype=obj -o trivial-object-test.macho-i386 -relocation-model=pic
-; llc -mtriple=x86_64-apple-darwin10 trivial.ll -filetype=obj -o trivial-object-test.macho-x86-64 -relocation-model=pic
+; Input used for generating checked-in binaries (trivial.obj.*)
+; llc -mtriple=i386-pc-win32 trivial.ll -filetype=obj -o trivial.obj.coff-i386
+; llc -mtriple=x86_64-pc-win32 trivial.ll -filetype=obj -o trivial.obj.coff-x86-64
+; llc -mtriple=i386-linux-gnu trivial.ll -filetype=obj -o trivial.obj.elf-i386 -relocation-model=pic
+; llc -mtriple=x86_64-linux-gnu trivial.ll -filetype=obj -o trivial.obj.elf-x86-64 -relocation-model=pic
+; llc -mtriple=i386-apple-darwin10 trivial.ll -filetype=obj -o trivial.obj.macho-i386 -relocation-model=pic
+; llc -mtriple=x86_64-apple-darwin10 trivial.ll -filetype=obj -o trivial.obj.macho-x86-64 -relocation-model=pic
+; llc -mtriple=wasm32-unknown-unknown-wasm trivial.ll -filetype=obj -o trivial.obj.wasm
@.str = private unnamed_addr constant [13 x i8] c"Hello World\0A\00", align 1
diff --git a/test/tools/llvm-readobj/Inputs/trivial.obj.wasm b/test/tools/llvm-readobj/Inputs/trivial.obj.wasm
index f14192f1798b..caa702f70015 100644
--- a/test/tools/llvm-readobj/Inputs/trivial.obj.wasm
+++ b/test/tools/llvm-readobj/Inputs/trivial.obj.wasm
Binary files differ
diff --git a/test/tools/llvm-readobj/codeview-linetables.test b/test/tools/llvm-readobj/codeview-linetables.test
index fe68e7efdb05..9256aefe4330 100644
--- a/test/tools/llvm-readobj/codeview-linetables.test
+++ b/test/tools/llvm-readobj/codeview-linetables.test
@@ -41,7 +41,7 @@ MFUN32: ]
MFUN32: Subsection [
MFUN32-NEXT: SubSectionType: Symbols (0xF1)
MFUN32-NEXT: SubSectionSize: 0x4B
-MFUN32: ProcStart {
+MFUN32: GlobalProcIdSym {
MFUN32: CodeSize: 0xA
MFUN32: DisplayName: x
MFUN32: LinkageName: _x
@@ -60,7 +60,7 @@ MFUN32: ]
MFUN32: Subsection [
MFUN32-NEXT: SubSectionType: Symbols (0xF1)
MFUN32-NEXT: SubSectionSize: 0x4B
-MFUN32: ProcStart {
+MFUN32: GlobalProcIdSym {
MFUN32: CodeSize: 0xA
MFUN32: DisplayName: y
MFUN32: LinkageName: _y
@@ -79,7 +79,7 @@ MFUN32: ]
MFUN32: Subsection [
MFUN32-NEXT: SubSectionType: Symbols (0xF1)
MFUN32-NEXT: SubSectionSize: 0x4B
-MFUN32: ProcStart {
+MFUN32: GlobalProcIdSym {
MFUN32: CodeSize: 0x14
MFUN32: DisplayName: f
MFUN32: LinkageName: _f
@@ -193,7 +193,7 @@ MFUN64: ]
MFUN64: Subsection [
MFUN64-NEXT: SubSectionType: Symbols (0xF1)
MFUN64-NEXT: SubSectionSize: 0x4B
-MFUN64: ProcStart {
+MFUN64: GlobalProcIdSym {
MFUN64: CodeSize: 0xE
MFUN64: DisplayName: x
MFUN64: LinkageName: x
@@ -208,7 +208,7 @@ MFUN64-NEXT: ]
MFUN64-NEXT: Subsection [
MFUN64-NEXT: SubSectionType: Symbols (0xF1)
MFUN64-NEXT: SubSectionSize: 0x4B
-MFUN64: ProcStart {
+MFUN64: GlobalProcIdSym {
MFUN64: CodeSize: 0xE
MFUN64: DisplayName: y
MFUN64: LinkageName: y
@@ -223,7 +223,7 @@ MFUN64-NEXT: ]
MFUN64-NEXT: Subsection [
MFUN64-NEXT: SubSectionType: Symbols (0xF1)
MFUN64-NEXT: SubSectionSize: 0x4B
-MFUN64: ProcStart {
+MFUN64: GlobalProcIdSym {
MFUN64: CodeSize: 0x18
MFUN64: DisplayName: f
MFUN64: LinkageName: f
@@ -365,7 +365,7 @@ MFILE32: ]
MFILE32: Subsection [
MFILE32-NEXT: SubSectionType: Symbols (0xF1)
MFILE32-NEXT: SubSectionSize: 0x4B
-MFILE32: ProcStart {
+MFILE32: GlobalProcIdSym {
MFILE32: CodeSize: 0x14
MFILE32: DisplayName: f
MFILE32: LinkageName: _f
@@ -442,7 +442,7 @@ MFILE64: ]
MFILE64: Subsection [
MFILE64-NEXT: SubSectionType: Symbols (0xF1)
MFILE64-NEXT: SubSectionSize: 0x4B
-MFILE64: ProcStart {
+MFILE64: GlobalProcIdSym {
MFILE64: CodeSize: 0x18
MFILE64: DisplayName: f
MFILE64: LinkageName: f
@@ -528,7 +528,7 @@ RUN: | FileCheck %s -check-prefix MCOMDAT
RUN: llvm-readobj -s -codeview -section-symbols %p/Inputs/comdat-function-linetables.obj.coff-2013-i386 \
RUN: | FileCheck %s -check-prefix MCOMDAT
-MCOMDAT: ProcStart {
+MCOMDAT: GlobalProcIdSym {
MCOMDAT: CodeSize: 0x7
MCOMDAT: DisplayName: f
MCOMDAT: LinkageName: ?f@@YAHXZ
@@ -556,7 +556,7 @@ MCOMDAT-NEXT: IsStatement: Yes
MCOMDAT-NEXT: ]
MCOMDAT-NEXT: ]
MCOMDAT-NEXT: ]
-MCOMDAT: ProcStart {
+MCOMDAT: GlobalProcIdSym {
MCOMDAT: CodeSize: 0x7
MCOMDAT: DisplayName: g
MCOMDAT: LinkageName: ?g@@YAHXZ
diff --git a/test/tools/llvm-readobj/file-headers.test b/test/tools/llvm-readobj/file-headers.test
index 6bc9714f2037..65ccd50a2729 100644
--- a/test/tools/llvm-readobj/file-headers.test
+++ b/test/tools/llvm-readobj/file-headers.test
@@ -28,9 +28,6 @@ RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
RUN: | FileCheck %s -check-prefix COFF-IMPORTLIB
RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-lanai \
RUN: | FileCheck %s -check-prefix ELF-LANAI
-# trivial.obj.wasm was generated using the following command:
-# echo "extern int bar, baz; int foo() { return bar + baz + (int)&foo; }" | \
-# ./bin/clang -c -o trivial.obj.wasm -target wasm32-unknown-unknown-wasm -x c -
RUN: llvm-readobj -h %p/Inputs/trivial.obj.wasm \
RUN: | FileCheck %s -check-prefix WASM
diff --git a/test/tools/llvm-readobj/relocations.test b/test/tools/llvm-readobj/relocations.test
index 9c7dcf1d659c..85ccd3cefa1b 100644
--- a/test/tools/llvm-readobj/relocations.test
+++ b/test/tools/llvm-readobj/relocations.test
@@ -289,21 +289,20 @@ MACHO-ARM-NEXT: ]
WASM: Relocations [
WASM-NEXT: Section (8) CODE {
WASM-NEXT: Relocation {
-WASM-NEXT: Type: R_WEBASSEMBLY_TABLE_INDEX_SLEB (1)
-WASM-NEXT: Offset: 0x6
+WASM-NEXT: Type: R_WEBASSEMBLY_GLOBAL_ADDR_SLEB (4)
+WASM-NEXT: Offset: 0x4
WASM-NEXT: Index: 0x0
+WASM-NEXT: Addend: 0
WASM-NEXT: }
WASM-NEXT: Relocation {
-WASM-NEXT: Type: R_WEBASSEMBLY_GLOBAL_ADDR_LEB (3)
-WASM-NEXT: Offset: 0x15
+WASM-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+WASM-NEXT: Offset: 0xA
WASM-NEXT: Index: 0x0
-WASM-NEXT: Addend: 0
WASM-NEXT: }
WASM-NEXT: Relocation {
-WASM-NEXT: Type: R_WEBASSEMBLY_GLOBAL_ADDR_LEB (3)
-WASM-NEXT: Offset: 0x24
+WASM-NEXT: Type: R_WEBASSEMBLY_FUNCTION_INDEX_LEB (0)
+WASM-NEXT: Offset: 0x11
WASM-NEXT: Index: 0x1
-WASM-NEXT: Addend: 0
WASM-NEXT: }
WASM-NEXT: }
WASM-NEXT: ]
diff --git a/test/tools/llvm-readobj/sections.test b/test/tools/llvm-readobj/sections.test
index 1747ee45d4f3..4eda5dae882a 100644
--- a/test/tools/llvm-readobj/sections.test
+++ b/test/tools/llvm-readobj/sections.test
@@ -493,62 +493,75 @@ MACHO-ARM-NEXT: Reserved2: 0x0
MACHO-ARM-NEXT: }
MACHO-ARM-NEXT:]
-WASM: Sections [
-WASM-NEXT: Section {
-WASM-NEXT: Type: TYPE (0x1)
-WASM-NEXT: Size: 5
-WASM-NEXT: Offset: 8
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: IMPORT (0x2)
-WASM-NEXT: Size: 23
-WASM-NEXT: Offset: 19
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: FUNCTION (0x3)
-WASM-NEXT: Size: 2
-WASM-NEXT: Offset: 48
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: TABLE (0x4)
-WASM-NEXT: Size: 4
-WASM-NEXT: Offset: 56
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: MEMORY (0x5)
-WASM-NEXT: Size: 3
-WASM-NEXT: Offset: 66
-WASM-NEXT: Memories [
-WASM-NEXT: Memory {
-WASM-NEXT: InitialPages: 0
-WASM-NEXT: }
-WASM-NEXT: ]
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: EXPORT (0x7)
-WASM-NEXT: Size: 7
-WASM-NEXT: Offset: 75
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: ELEM (0x9)
-WASM-NEXT: Size: 7
-WASM-NEXT: Offset: 88
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: CODE (0xA)
-WASM-NEXT: Size: 61
-WASM-NEXT: Offset: 101
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: CUSTOM (0x0)
-WASM-NEXT: Size: 17
-WASM-NEXT: Offset: 168
-WASM-NEXT: Name: name
-WASM-NEXT: }
-WASM-NEXT: Section {
-WASM-NEXT: Type: CUSTOM (0x0)
-WASM-NEXT: Size: 24
-WASM-NEXT: Offset: 191
-WASM-NEXT: Name: reloc.CODE
-WASM-NEXT: }
-WASM-NEXT:]
+WASM: Sections [
+WASM-NEXT: Section {
+WASM-NEXT: Type: TYPE (0x1)
+WASM-NEXT: Size: 14
+WASM-NEXT: Offset: 8
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: IMPORT (0x2)
+WASM-NEXT: Size: 36
+WASM-NEXT: Offset: 28
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: FUNCTION (0x3)
+WASM-NEXT: Size: 2
+WASM-NEXT: Offset: 70
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: TABLE (0x4)
+WASM-NEXT: Size: 4
+WASM-NEXT: Offset: 78
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: MEMORY (0x5)
+WASM-NEXT: Size: 3
+WASM-NEXT: Offset: 88
+WASM-NEXT: Memories [
+WASM-NEXT: Memory {
+WASM-NEXT: InitialPages: 1
+WASM-NEXT: }
+WASM-NEXT: ]
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: GLOBAL (0x6)
+WASM-NEXT: Size: 6
+WASM-NEXT: Offset: 97
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: EXPORT (0x7)
+WASM-NEXT: Size: 8
+WASM-NEXT: Offset: 109
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: CODE (0xA)
+WASM-NEXT: Size: 25
+WASM-NEXT: Offset: 123
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: DATA (0xB)
+WASM-NEXT: Size: 19
+WASM-NEXT: Offset: 154
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: CUSTOM (0x0)
+WASM-NEXT: Size: 43
+WASM-NEXT: Offset: 179
+WASM-NEXT: Name: name
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: CUSTOM (0x0)
+WASM-NEXT: Size: 23
+WASM-NEXT: Offset: 228
+WASM-NEXT: Name: reloc.CODE
+WASM-NEXT: }
+WASM-NEXT: Section {
+WASM-NEXT: Type: CUSTOM (0x0)
+WASM-NEXT: Size: 22
+WASM-NEXT: Offset: 257
+WASM-NEXT: Name: linking
+WASM-NEXT: DataSize: 13
+WASM-NEXT: DataAlignment: 1
+WASM-NEXT: }
+WASM-NEXT: ]
diff --git a/test/tools/llvm-readobj/symbols.test b/test/tools/llvm-readobj/symbols.test
index da8a70b031ab..380c6f6a5ee5 100644
--- a/test/tools/llvm-readobj/symbols.test
+++ b/test/tools/llvm-readobj/symbols.test
@@ -73,22 +73,32 @@ ELF-NEXT: }
WASM: Symbols [
WASM-NEXT: Symbol {
-WASM-NEXT: Name: bar
-WASM-NEXT: Type: GLOBAL_IMPORT (0x2)
+WASM-NEXT: Name: puts
+WASM-NEXT: Type: FUNCTION_IMPORT (0x0)
WASM-NEXT: Flags: 0x0
WASM-NEXT: }
WASM-NEXT: Symbol {
-WASM-NEXT: Name: baz
-WASM-NEXT: Type: GLOBAL_IMPORT (0x2)
+WASM-NEXT: Name: SomeOtherFunction
+WASM-NEXT: Type: FUNCTION_IMPORT (0x0)
WASM-NEXT: Flags: 0x0
WASM-NEXT: }
WASM-NEXT: Symbol {
-WASM-NEXT: Name: foo
+WASM-NEXT: Name: main
WASM-NEXT: Type: FUNCTION_EXPORT (0x1)
WASM-NEXT: Flags: 0x0
WASM-NEXT: }
WASM-NEXT: Symbol {
-WASM-NEXT: Name: foo
+WASM-NEXT: Name: puts
+WASM-NEXT: Type: DEBUG_FUNCTION_NAME (0x4)
+WASM-NEXT: Flags: 0x0
+WASM-NEXT: }
+WASM-NEXT: Symbol {
+WASM-NEXT: Name: SomeOtherFunction
+WASM-NEXT: Type: DEBUG_FUNCTION_NAME (0x4)
+WASM-NEXT: Flags: 0x0
+WASM-NEXT: }
+WASM-NEXT: Symbol {
+WASM-NEXT: Name: main
WASM-NEXT: Type: DEBUG_FUNCTION_NAME (0x4)
WASM-NEXT: Flags: 0x0
WASM-NEXT: }