[Mips] Move got16.test assembler source code to the test file and use

llvm-mc for an object file generation.

llvm-svn: 199231
This commit is contained in:
Simon Atanasyan 2014-01-14 18:18:49 +00:00
parent 3a4c638900
commit 2a1ae098b3
3 changed files with 118 additions and 104 deletions

Binary file not shown.

View File

@ -1,23 +0,0 @@
# as -mips32r2 -EL -o got16.o got16.s
.global glob
.ent glob
glob:
lw $4,%got(local)($28)
addiu $4,$4,%lo(local)
lw $4,%got(hidden)($28)
lw $4,%call16(glob)($28)
lw $4,%call16(extern)($28)
.end glob
.data
.type local,%object
.size local,4
local:
.word undef
.globl hidden
.hidden hidden
.type hidden,%object
.size hidden,4
hidden:
.word 0

View File

@ -1,83 +1,120 @@
# Check handling of global/local GOT16 relocations.
RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
RUN: --output-filetype=yaml -o %t %p/Inputs/got16.o
RUN: FileCheck %s < %t
# RUN: llvm-mc -triple=mipsel -filetype=obj -o=%t1 %s
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
# RUN: --output-filetype=yaml %t1 | FileCheck -check-prefix YAML %s
CHECK: - ref-name: L002
CHECK: type: got
CHECK: content: [ 00, 00, 00, 00 ]
CHECK: alignment: 2^2
CHECK: section-choice: custom-required
CHECK: section-name: .got
CHECK: permissions: rw-
CHECK: references:
CHECK: - kind: R_MIPS_32
CHECK: offset: 0
CHECK: target: L003
CHECK: - ref-name: L004
CHECK: type: got
CHECK: content: [ 00, 00, 00, 00 ]
CHECK: alignment: 2^2
CHECK: section-choice: custom-required
CHECK: section-name: .got
CHECK: permissions: rw-
CHECK: references:
CHECK: - kind: R_MIPS_32
CHECK: offset: 0
CHECK: target: hidden
CHECK: - ref-name: L005
CHECK: type: got
CHECK: content: [ 00, 00, 00, 00 ]
CHECK: alignment: 2^2
CHECK: section-choice: custom-required
CHECK: section-name: .got
CHECK: permissions: rw-
CHECK: references:
CHECK: - kind: LLD_R_MIPS_GLOBAL_GOT
CHECK: offset: 0
CHECK: target: glob
CHECK: - kind: R_MIPS_32
CHECK: offset: 0
CHECK: target: glob
CHECK: - ref-name: L006
CHECK: type: got
CHECK: content: [ 00, 00, 00, 00 ]
CHECK: alignment: 2^2
CHECK: section-choice: custom-required
CHECK: section-name: .got
CHECK: permissions: rw-
CHECK: references:
CHECK: - kind: LLD_R_MIPS_GLOBAL_GOT
CHECK: offset: 0
CHECK: target: extern
CHECK: - ref-name: L007
CHECK: alignment: 2^4
CHECK: references:
CHECK: - kind: layout-after
CHECK: offset: 0
CHECK: target: glob
CHECK: - name: glob
CHECK: scope: global
CHECK: content: [ 00, 00, 84, 8F, 00, 00, 84, 24, 00, 00, 84, 8F,
CHECK: 00, 00, 84, 8F, 00, 00, 84, 8F, 00, 00, 00, 00,
CHECK: 00, 00, 00, 00, 00, 00, 00, 00 ]
CHECK: alignment: 2^4
CHECK: references:
CHECK: - kind: R_MIPS_GOT16
CHECK: offset: 0
CHECK: target: L002
CHECK: - kind: R_MIPS_LO16
CHECK: offset: 4
CHECK: target: L003
CHECK: - kind: LLD_R_MIPS_GLOBAL_GOT16
CHECK: offset: 8
CHECK: target: L004
CHECK: - kind: R_MIPS_CALL16
CHECK: offset: 12
CHECK: target: L005
CHECK: - kind: R_MIPS_CALL16
CHECK: offset: 16
CHECK: target: L006
CHECK: - kind: layout-before
CHECK: offset: 0
CHECK: target: L007
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t2 %t1
# RUN: llvm-objdump -t -disassemble %t2 | FileCheck -check-prefix RAW %s
# YAML: - ref-name: L003
# YAML: type: got
# YAML: content: [ 00, 00, 00, 00 ]
# YAML: alignment: 2^2
# YAML: section-choice: custom-required
# YAML: section-name: .got
# YAML: permissions: rw-
# YAML: references:
# YAML: - kind: R_MIPS_32
# YAML: offset: 0
# YAML: target: L004
# YAML: - ref-name: L005
# YAML: type: got
# YAML: content: [ 00, 00, 00, 00 ]
# YAML: alignment: 2^2
# YAML: section-choice: custom-required
# YAML: section-name: .got
# YAML: permissions: rw-
# YAML: references:
# YAML: - kind: R_MIPS_32
# YAML: offset: 0
# YAML: target: hidden
# YAML: - ref-name: L006
# YAML: type: got
# YAML: content: [ 00, 00, 00, 00 ]
# YAML: alignment: 2^2
# YAML: section-choice: custom-required
# YAML: section-name: .got
# YAML: permissions: rw-
# YAML: references:
# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT
# YAML: offset: 0
# YAML: target: glob
# YAML: - kind: R_MIPS_32
# YAML: offset: 0
# YAML: target: glob
# YAML: - ref-name: L007
# YAML: type: got
# YAML: content: [ 00, 00, 00, 00 ]
# YAML: alignment: 2^2
# YAML: section-choice: custom-required
# YAML: section-name: .got
# YAML: permissions: rw-
# YAML: references:
# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT
# YAML: offset: 0
# YAML: target: extern
# YAML: - ref-name: L008
# YAML: alignment: 2^2
# YAML: references:
# YAML: - kind: layout-after
# YAML: offset: 0
# YAML: target: glob
# YAML: - name: glob
# YAML: scope: global
# YAML: content: [ 00, 00, 84, 8F, 00, 00, 84, 24, 00, 00, 84, 8F,
# YAML: 00, 00, 84, 8F, 00, 00, 84, 8F ]
# YAML: alignment: 2^2
# YAML: references:
# YAML: - kind: R_MIPS_GOT16
# YAML: offset: 0
# YAML: target: L003
# YAML: - kind: R_MIPS_LO16
# YAML: offset: 4
# YAML: target: L004
# YAML: - kind: LLD_R_MIPS_GLOBAL_GOT16
# YAML: offset: 8
# YAML: target: L005
# YAML: - kind: R_MIPS_CALL16
# YAML: offset: 12
# YAML: target: L006
# YAML: - kind: R_MIPS_CALL16
# YAML: offset: 16
# YAML: target: L007
# YAML: - kind: layout-before
# YAML: offset: 0
# YAML: target: L008
# RAW: Disassembly of section .text:
# RAW: glob:
# RAW: 168: 18 80 84 8f lw $4, -32744($gp)
# RAW: 16c: 00 20 84 24 addiu $4, $4, 8192
# RAW: 170: 1c 80 84 8f lw $4, -32740($gp)
# RAW: 174: 20 80 84 8f lw $4, -32736($gp)
# RAW: 178: 24 80 84 8f lw $4, -32732($gp)
# RAW: SYMBOL TABLE:
# RAW: 00000000 *UND* 00000000
# RAW: 00002000 l .data 00000000 local
.global glob
.ent glob
glob:
lw $4,%got(local)($28) # G(local)
addiu $4,$4,%lo(local) # local (0x2000)
lw $4,%got(hidden)($28) # G(hidden)
lw $4,%call16(glob)($28) # G(glob)
lw $4,%call16(extern)($28) # G(extern)
.end glob
.data
.type local,%object
.size local,4
local:
.word undef
.globl hidden
.hidden hidden
.type hidden,%object
.size hidden,4
hidden:
.word 0