1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/tools/llvm-readobj/symbols.test
Sam Clegg 610f20a479 [WebAssembly] Only treat imports/exports as symbols when reading relocatable object files
This change only treats imported and exports functions and globals
as symbol table entries the object has a "linking" section (i.e. it is
relocatable object file).

In this case all globals must be of type I32 and initialized with
i32.const.  This was previously being assumed but not checked for and
was causing a failure on big endian machines due to using the wrong
value of then union.

See: https://bugs.llvm.org/show_bug.cgi?id=34487

Differential Revision: https://reviews.llvm.org/D37497

llvm-svn: 312674
2017-09-06 22:05:41 +00:00

106 lines
2.9 KiB
Plaintext

RUN: llvm-readobj -t %p/Inputs/trivial.obj.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF
RUN: llvm-readobj -t %p/Inputs/trivial.obj.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF
RUN: llvm-readobj -t %p/Inputs/trivial.obj.wasm \
RUN: | FileCheck %s -check-prefix WASM
COFF: Symbols [
COFF-NEXT: Symbol {
COFF-NEXT: Name: @comp.id
COFF-NEXT: Value: 14766605
COFF-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
COFF-NEXT: BaseType: Null (0x0)
COFF-NEXT: ComplexType: Null (0x0)
COFF-NEXT: StorageClass: Static (0x3)
COFF-NEXT: AuxSymbolCount: 0
COFF-NEXT: }
COFF-NEXT: Symbol {
COFF-NEXT: Name: @feat.00
COFF-NEXT: Value: 2147484049
COFF-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
COFF-NEXT: BaseType: Null (0x0)
COFF-NEXT: ComplexType: Null (0x0)
COFF-NEXT: StorageClass: Static (0x3)
COFF-NEXT: AuxSymbolCount: 0
COFF-NEXT: }
COFF-NEXT: Symbol {
COFF-NEXT: Name: .text
COFF-NEXT: Value: 0
COFF-NEXT: Section: .text (1)
COFF-NEXT: BaseType: Null (0x0)
COFF-NEXT: ComplexType: Null (0x0)
COFF-NEXT: StorageClass: Static (0x3)
COFF-NEXT: AuxSymbolCount: 1
COFF-NEXT: AuxSectionDef {
COFF-NEXT: Length: 22
COFF-NEXT: RelocationCount: 3
COFF-NEXT: LineNumberCount: 0
COFF-NEXT: Checksum: 0x0
COFF-NEXT: Number: 1
COFF-NEXT: Selection: 0x0
COFF-NEXT: }
COFF-NEXT: }
ELF: Symbols [
ELF-NEXT: Symbol {
ELF-NEXT: Name: (0)
ELF-NEXT: Value: 0x0
ELF-NEXT: Size: 0
ELF-NEXT: Binding: Local (0x0)
ELF-NEXT: Type: None (0x0)
ELF-NEXT: Other: 0
ELF-NEXT: Section: Undefined (0x0)
ELF-NEXT: }
ELF-NEXT: Symbol {
ELF-NEXT: Name: trivial.ll (1)
ELF-NEXT: Value: 0x0
ELF-NEXT: Size: 0
ELF-NEXT: Binding: Local (0x0)
ELF-NEXT: Type: File (0x4)
ELF-NEXT: Other: 0
ELF-NEXT: Section: Absolute (0xFFF1)
ELF-NEXT: }
ELF-NEXT: Symbol {
ELF-NEXT: Name: .L.str (39)
ELF-NEXT: Value: 0x0
ELF-NEXT: Size: 13
ELF-NEXT: Binding: Local (0x0)
ELF-NEXT: Type: Object (0x1)
ELF-NEXT: Other: 0
ELF-NEXT: Section: .rodata.str1.1 (0x5)
ELF-NEXT: }
WASM: Symbols [
WASM-NEXT: Symbol {
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: }
WASM-NEXT: Symbol {
WASM-NEXT: Name: puts
WASM-NEXT: Type: FUNCTION_IMPORT (0x0)
WASM-NEXT: Flags: 0x0
WASM-NEXT: }
WASM-NEXT: Symbol {
WASM-NEXT: Name: SomeOtherFunction
WASM-NEXT: Type: FUNCTION_IMPORT (0x0)
WASM-NEXT: Flags: 0x0
WASM-NEXT: }
WASM-NEXT: Symbol {
WASM-NEXT: Name: main
WASM-NEXT: Type: FUNCTION_EXPORT (0x1)
WASM-NEXT: Flags: 0x0
WASM-NEXT: }
WASM-NEXT: ]