[Mips] Use explicit assembler instructions in the tests.

llvm-svn: 199556
This commit is contained in:
Simon Atanasyan 2014-01-18 16:59:19 +00:00
parent 2f1d6366e7
commit 9dec22dbe2
5 changed files with 249 additions and 191 deletions

View File

@ -1,14 +0,0 @@
// clang -O0 -EL -fPIC -target mipsel-linux-gnu -c dynobj.c -o dynobj.o
int xyz(const char *);
int abc(const char *);
int bar(void)
{
return 1;
}
int foo(void)
{
bar();
return xyz("str1") + abc("str2");
}

Binary file not shown.

View File

@ -1,27 +1,49 @@
# Check MIPS specific tags in the dynamic table.
RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
RUN: -o %t %p/Inputs/dynobj.o
RUN: llvm-readobj -dynamic-table %t | FileCheck %s
CHECK: Format: ELF32-mips
CHECK: Arch: mipsel
CHECK: AddressSize: 32bit
CHECK: LoadName:
CHECK: DynamicSection [ (15 entries)
CHECK: Tag Type Name/Value
CHECK: 0x00000004 HASH 0xE0
CHECK: 0x00000005 STRTAB 0x158
CHECK: 0x00000006 SYMTAB 0x108
CHECK: 0x0000000A STRSZ 17 (bytes)
CHECK: 0x0000000B SYMENT 16 (bytes)
CHECK: 0x0000001A FINI_ARRAY 0x0
CHECK: 0x0000001C FINI_ARRAYSZ 0 (bytes)
CHECK: 0x70000001 MIPS_RLD_VERSION 1
CHECK: 0x70000005 MIPS_FLAGS 0x2
CHECK: 0x70000006 MIPS_BASE_ADDRESS 0x0
CHECK: 0x7000000A MIPS_LOCAL_GOTNO 4
CHECK: 0x70000011 MIPS_SYMTABNO 5
CHECK: 0x70000013 MIPS_GOTSYM 0x2
CHECK: 0x00000003 PLTGOT 0x1000
CHECK: 0x00000000 NULL 0x0
CHECK: ]
# Build shared library
# RUN: llvm-mc -triple=mipsel -filetype=obj -relocation-model=pic -o=%t-obj %s
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t-so %t-obj
# RUN: llvm-readobj -dynamic-table %t-so | FileCheck %s
# CHECK: Format: ELF32-mips
# CHECK: Arch: mipsel
# CHECK: AddressSize: 32bit
# CHECK: LoadName:
# CHECK: DynamicSection [ (15 entries)
# CHECK: Tag Type Name/Value
# CHECK: 0x00000004 HASH 0xD4
# CHECK: 0x00000005 STRTAB 0x138
# CHECK: 0x00000006 SYMTAB 0xF8
# CHECK: 0x0000000A STRSZ 17 (bytes)
# CHECK: 0x0000000B SYMENT 16 (bytes)
# CHECK: 0x0000001A FINI_ARRAY 0x0
# CHECK: 0x0000001C FINI_ARRAYSZ 0 (bytes)
# CHECK: 0x70000001 MIPS_RLD_VERSION 1
# CHECK: 0x70000005 MIPS_FLAGS 0x2
# CHECK: 0x70000006 MIPS_BASE_ADDRESS 0x0
# CHECK: 0x7000000A MIPS_LOCAL_GOTNO 4
# CHECK: 0x70000011 MIPS_SYMTABNO 4
# CHECK: 0x70000013 MIPS_GOTSYM 0x2
# CHECK: 0x00000003 PLTGOT 0x1000
# CHECK: 0x00000000 NULL 0x0
# CHECK: ]
.abicalls
.global glob
.ent glob
glob:
lw $gp, %got($.str1)($1)
addiu $4, $gp, %lo($.str1)
lw $4, %got($.str2)($1)
addiu $4, $4, %lo($.str2)
lw $25, %call16(glob2)($1)
lw $25, %call16(ext1)($1)
.end glob
.section .rodata.str1
$.str1:
.asciz "str1"
.section .rodata.str2
$.str2:
.asciz "str2"

View File

@ -1,118 +1,158 @@
# Check sorting of .dynsym content accordingly to .got section.
RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
RUN: -o %t %p/Inputs/dynobj.o
RUN: llvm-readobj -dyn-symbols %t | FileCheck -check-prefix=CHECK-DYN %s
RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
RUN: --output-filetype=yaml -o %t %p/Inputs/dynobj.o
RUN: FileCheck -check-prefix=CHECK-GOT %s < %t
# Build shared library
# RUN: llvm-mc -triple=mipsel -filetype=obj -relocation-model=pic -o=%t-obj %s
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t-so %t-obj
# RUN: llvm-readobj -dyn-symbols %t-so | FileCheck -check-prefix=CHECK-DYN %s
CHECK-DYN: Format: ELF32-mips
CHECK-DYN: Arch: mipsel
CHECK-DYN: AddressSize: 32bit
CHECK-DYN: LoadName:
CHECK-DYN: DynamicSymbols [
CHECK-DYN: Symbol {
CHECK-DYN: Name: @ (0)
CHECK-DYN: Value: 0x0
CHECK-DYN: Size: 0
CHECK-DYN: Binding: Local (0x0)
CHECK-DYN: Type: None (0x0)
CHECK-DYN: Other: 0
CHECK-DYN: Section: (0x0)
CHECK-DYN: }
CHECK-DYN: Symbol {
CHECK-DYN: Name: foo@ (5)
CHECK-DYN: Value: 0x194
CHECK-DYN: Size: 156
CHECK-DYN: Binding: Global (0x1)
CHECK-DYN: Type: Function (0x2)
CHECK-DYN: Other: 0
CHECK-DYN: Section: .text (0x4)
CHECK-DYN: }
CHECK-DYN: Symbol {
CHECK-DYN: Name: bar@ (1)
CHECK-DYN: Value: 0x170
CHECK-DYN: Size: 36
CHECK-DYN: Binding: Global (0x1)
CHECK-DYN: Type: Function (0x2)
CHECK-DYN: Other: 0
CHECK-DYN: Section: .text (0x4)
CHECK-DYN: }
CHECK-DYN: Symbol {
CHECK-DYN: Name: xyz@ (9)
CHECK-DYN: Value: 0x0
CHECK-DYN: Size: 0
CHECK-DYN: Binding: Global (0x1)
CHECK-DYN: Type: None (0x0)
CHECK-DYN: Other: 0
CHECK-DYN: Section: (0x0)
CHECK-DYN: }
CHECK-DYN: Symbol {
CHECK-DYN: Name: abc@ (13)
CHECK-DYN: Value: 0x0
CHECK-DYN: Size: 0
CHECK-DYN: Binding: Global (0x1)
CHECK-DYN: Type: None (0x0)
CHECK-DYN: Other: 0
CHECK-DYN: Section: (0x0)
CHECK-DYN: }
CHECK-DYN: ]
# Build shared library (yaml format)
# RUN: llvm-mc -triple=mipsel -filetype=obj -relocation-model=pic -o=%t-obj %s
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
# RUN: --output-filetype=yaml -o %t-yaml %t-obj
# RUN: FileCheck -check-prefix=CHECK-GOT %s < %t-yaml
CHECK-GOT: - type: got
CHECK-GOT: content: [ 00, 00, 00, 00 ]
CHECK-GOT: alignment: 2^2
CHECK-GOT: section-choice: custom-required
CHECK-GOT: section-name: .got
CHECK-GOT: permissions: rw-
CHECK-GOT: - type: got
CHECK-GOT: content: [ 00, 00, 00, 80 ]
CHECK-GOT: alignment: 2^2
CHECK-GOT: section-choice: custom-required
CHECK-GOT: section-name: .got
CHECK-GOT: permissions: rw-
CHECK-GOT: - ref-name: L004
CHECK-GOT: type: got
CHECK-GOT: content: [ 00, 00, 00, 00 ]
CHECK-GOT: alignment: 2^2
CHECK-GOT: section-choice: custom-required
CHECK-GOT: section-name: .got
CHECK-GOT: permissions: rw-
CHECK-GOT: - ref-name: L006
CHECK-GOT: type: got
CHECK-GOT: content: [ 00, 00, 00, 00 ]
CHECK-GOT: alignment: 2^2
CHECK-GOT: section-choice: custom-required
CHECK-GOT: section-name: .got
CHECK-GOT: permissions: rw-
CHECK-GOT: - ref-name: L003
CHECK-GOT: type: got
CHECK-GOT: content: [ 00, 00, 00, 00 ]
CHECK-GOT: alignment: 2^2
CHECK-GOT: section-choice: custom-required
CHECK-GOT: section-name: .got
CHECK-GOT: permissions: rw-
CHECK-GOT: references:
CHECK-GOT: - kind: R_MIPS_32
CHECK-GOT: offset: 0
CHECK-GOT: target: bar
CHECK-GOT: - ref-name: L005
CHECK-GOT: type: got
CHECK-GOT: content: [ 00, 00, 00, 00 ]
CHECK-GOT: alignment: 2^2
CHECK-GOT: section-choice: custom-required
CHECK-GOT: section-name: .got
CHECK-GOT: permissions: rw-
CHECK-GOT: - ref-name: L007
CHECK-GOT: type: got
CHECK-GOT: content: [ 00, 00, 00, 00 ]
CHECK-GOT: alignment: 2^2
CHECK-GOT: section-choice: custom-required
CHECK-GOT: section-name: .got
CHECK-GOT: permissions: rw-
CHECK-GOT: - ref-name: L002
CHECK-GOT: alignment: 2^4
CHECK-GOT: references:
CHECK-GOT: - kind: layout-after
CHECK-GOT: offset: 0
CHECK-GOT: target: bar
# CHECK-DYN: Format: ELF32-mips
# CHECK-DYN: Arch: mipsel
# CHECK-DYN: AddressSize: 32bit
# CHECK-DYN: LoadName:
# CHECK-DYN: DynamicSymbols [
# CHECK-DYN: Symbol {
# CHECK-DYN: Name: @ (0)
# CHECK-DYN: Value: 0x0
# CHECK-DYN: Size: 0
# CHECK-DYN: Binding: Local (0x0)
# CHECK-DYN: Type: None (0x0)
# CHECK-DYN: Other: 0
# CHECK-DYN: Section: (0x0)
# CHECK-DYN: }
# CHECK-DYN: Symbol {
# CHECK-DYN: Name: bar@ (5)
# CHECK-DYN: Value: 0x178
# CHECK-DYN: Size: 4
# CHECK-DYN: Binding: Global (0x1)
# CHECK-DYN: Type: Function (0x2)
# CHECK-DYN: Other: 0
# CHECK-DYN: Section: .text (0x4)
# CHECK-DYN: }
# CHECK-DYN: Symbol {
# CHECK-DYN: Name: foo@ (1)
# CHECK-DYN: Value: 0x160
# CHECK-DYN: Size: 24
# CHECK-DYN: Binding: Global (0x1)
# CHECK-DYN: Type: Function (0x2)
# CHECK-DYN: Other: 0
# CHECK-DYN: Section: .text (0x4)
# CHECK-DYN: }
# CHECK-DYN: Symbol {
# CHECK-DYN: Name: ext1@ (9)
# CHECK-DYN: Value: 0x0
# CHECK-DYN: Size: 0
# CHECK-DYN: Binding: Global (0x1)
# CHECK-DYN: Type: None (0x0)
# CHECK-DYN: Other: 0
# CHECK-DYN: Section: (0x0)
# CHECK-DYN: }
# CHECK-DYN: Symbol {
# CHECK-DYN: Name: ext2@ (14)
# CHECK-DYN: Value: 0x0
# CHECK-DYN: Size: 0
# CHECK-DYN: Binding: Global (0x1)
# CHECK-DYN: Type: None (0x0)
# CHECK-DYN: Other: 0
# CHECK-DYN: Section: (0x0)
# CHECK-DYN: }
# CHECK-DYN: ]
# CHECK-GOT: - type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
# CHECK-GOT: section-choice: custom-required
# CHECK-GOT: section-name: .got
# CHECK-GOT: permissions: rw-
# CHECK-GOT: - type: got
# CHECK-GOT: content: [ 00, 00, 00, 80 ]
# CHECK-GOT: alignment: 2^2
# CHECK-GOT: section-choice: custom-required
# CHECK-GOT: section-name: .got
# CHECK-GOT: permissions: rw-
# CHECK-GOT: - ref-name: L002
# CHECK-GOT: type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
# CHECK-GOT: section-choice: custom-required
# CHECK-GOT: section-name: .got
# CHECK-GOT: permissions: rw-
# CHECK-GOT: references:
# CHECK-GOT: - kind: R_MIPS_32
# CHECK-GOT: offset: 0
# CHECK-GOT: target: L003
# CHECK-GOT: - ref-name: L004
# CHECK-GOT: type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
# CHECK-GOT: section-choice: custom-required
# CHECK-GOT: section-name: .got
# CHECK-GOT: permissions: rw-
# CHECK-GOT: references:
# CHECK-GOT: - kind: R_MIPS_32
# CHECK-GOT: offset: 0
# CHECK-GOT: target: L005
# CHECK-GOT: - ref-name: L006
# CHECK-GOT: type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
# CHECK-GOT: section-choice: custom-required
# CHECK-GOT: section-name: .got
# CHECK-GOT: permissions: rw-
# CHECK-GOT: references:
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
# CHECK-GOT: offset: 0
# CHECK-GOT: target: foo
# CHECK-GOT: - ref-name: L007
# CHECK-GOT: type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
# CHECK-GOT: section-choice: custom-required
# CHECK-GOT: section-name: .got
# CHECK-GOT: permissions: rw-
# CHECK-GOT: references:
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
# CHECK-GOT: offset: 0
# CHECK-GOT: target: ext1
# CHECK-GOT: - ref-name: L009
# CHECK-GOT: type: got
# CHECK-GOT: content: [ 00, 00, 00, 00 ]
# CHECK-GOT: alignment: 2^2
# CHECK-GOT: section-choice: custom-required
# CHECK-GOT: section-name: .got
# CHECK-GOT: permissions: rw-
# CHECK-GOT: references:
# CHECK-GOT: - kind: LLD_R_MIPS_GLOBAL_GOT
# CHECK-GOT: offset: 0
# CHECK-GOT: target: ext2
.abicalls
.global foo
.ent foo
foo:
lw $gp, %got($.str1)($1)
addiu $4, $gp, %lo($.str1)
lw $4, %got($.str2)($1)
addiu $4, $4, %lo($.str2)
lw $25, %call16(foo)($1)
lw $25, %call16(ext1)($1)
.end foo
.global bar
.ent brar
bar:
lw $25, %call16(ext2)($1)
.end bar
.section .rodata.str1
$.str1:
.asciz "str1"
.section .rodata.str2
$.str2:
.asciz "str2"

View File

@ -1,39 +1,49 @@
RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
RUN: -o %t %p/Inputs/dynobj.o
RUN: llvm-readobj -file-headers %t | FileCheck %s
# Check ELF Header for shared library.
CHECK: Format: ELF32-mips
CHECK: Arch: mipsel
CHECK: AddressSize: 32bit
CHECK: LoadName:
CHECK: ElfHeader {
CHECK: Ident {
CHECK: Magic: (7F 45 4C 46)
CHECK: Class: 32-bit (0x1)
CHECK: DataEncoding: LittleEndian (0x1)
CHECK: FileVersion: 1
CHECK: OS/ABI: SystemV (0x0)
CHECK: ABIVersion: 0
CHECK: Unused: (00 00 00 00 00 00 00)
CHECK: }
CHECK: Type: SharedObject (0x3)
CHECK: Machine: EM_MIPS (0x8)
CHECK: Version: 1
CHECK: Entry: 0x170
CHECK: ProgramHeaderOffset: 0x34
CHECK: SectionHeaderOffset: 0x21D8
CHECK: Flags [ (0x70001007)
CHECK: 0x1
CHECK: 0x2
CHECK: 0x1000
CHECK: 0x10000000
CHECK: 0x20000000
CHECK: 0x40000000
CHECK: ]
CHECK: HeaderSize: 52
CHECK: ProgramHeaderEntrySize: 32
CHECK: ProgramHeaderCount: 5
CHECK: SectionHeaderEntrySize: 40
CHECK: SectionHeaderCount: 16
CHECK: StringTableSectionIndex: 13
CHECK:}
# Build shared library
# RUN: llvm-mc -triple=mipsel -filetype=obj -relocation-model=pic -o=%t-obj %s
# RUN: lld -flavor gnu -target mipsel -shared -o %t-so %t-obj
# RUN: llvm-readobj -file-headers %t-so | FileCheck %s
# CHECK: Format: ELF32-mips
# CHECK: Arch: mipsel
# CHECK: AddressSize: 32bit
# CHECK: LoadName:
# CHECK: ElfHeader {
# CHECK: Ident {
# CHECK: Magic: (7F 45 4C 46)
# CHECK: Class: 32-bit (0x1)
# CHECK: DataEncoding: LittleEndian (0x1)
# CHECK: FileVersion: 1
# CHECK: OS/ABI: SystemV (0x0)
# CHECK: ABIVersion: 0
# CHECK: Unused: (00 00 00 00 00 00 00)
# CHECK: }
# CHECK: Type: SharedObject (0x3)
# CHECK: Machine: EM_MIPS (0x8)
# CHECK: Version: 1
# CHECK: Entry: 0x110
# CHECK: ProgramHeaderOffset: 0x34
# CHECK: SectionHeaderOffset: 0x20E0
# CHECK: Flags [ (0x70001007)
# CHECK: 0x1
# CHECK: 0x2
# CHECK: 0x1000
# CHECK: 0x10000000
# CHECK: 0x20000000
# CHECK: 0x40000000
# CHECK: ]
# CHECK: HeaderSize: 52
# CHECK: ProgramHeaderEntrySize: 32
# CHECK: ProgramHeaderCount: 5
# CHECK: SectionHeaderEntrySize: 40
# CHECK: SectionHeaderCount: 12
# CHECK: StringTableSectionIndex: 9
# CHECK:}
.abicalls
.global glob
.ent glob
glob:
nop
.end glob