llvm-project/lld/test/elf/Mips/got16.test

122 lines
4.7 KiB
Plaintext

# REQUIRES: mips
# Check handling of global/local GOT16 relocations.
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec \
# RUN: --output-filetype=yaml %S/Inputs/got16.o \
# RUN: | FileCheck -check-prefix YAML %s
# RUN: lld -flavor gnu -target mipsel -shared --noinhibit-exec -o %t2 \
# RUN: %S/Inputs/got16.o
# RUN: llvm-objdump -t -disassemble %t2 | FileCheck -check-prefix RAW %s
# Local GOT entries:
# YAML: - ref-name: L003
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
# YAML-NEXT: section-choice: custom-required
# YAML-NEXT: section-name: .got
# YAML-NEXT: permissions: rw-
# YAML-NEXT: references:
# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16
# YAML-NEXT: offset: 0
# YAML-NEXT: target: L006
# YAML-NEXT: - ref-name: L005
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
# YAML-NEXT: section-choice: custom-required
# YAML-NEXT: section-name: .got
# YAML-NEXT: permissions: rw-
# YAML-NEXT: references:
# YAML-NEXT: - kind: LLD_R_MIPS_32_HI16
# YAML-NEXT: offset: 0
# YAML-NEXT: target: L006
# YAML-NEXT: addend: 66048
# YAML-NEXT: - ref-name: L007
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
# YAML-NEXT: section-choice: custom-required
# YAML-NEXT: section-name: .got
# YAML-NEXT: permissions: rw-
# YAML-NEXT: references:
# YAML-NEXT: - kind: R_MIPS_32
# YAML-NEXT: offset: 0
# YAML-NEXT: target: hidden
# Global GOT entries:
# YAML-NEXT: - ref-name: L008
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
# YAML-NEXT: section-choice: custom-required
# YAML-NEXT: section-name: .got
# YAML-NEXT: permissions: rw-
# YAML-NEXT: references:
# YAML-NEXT: - kind: LLD_R_MIPS_GLOBAL_GOT
# YAML-NEXT: offset: 0
# YAML-NEXT: target: glob
# YAML-NEXT: - kind: R_MIPS_32
# YAML-NEXT: offset: 0
# YAML-NEXT: target: glob
# YAML-NEXT: - ref-name: L009
# YAML-NEXT: type: got
# YAML-NEXT: content: [ 00, 00, 00, 00 ]
# YAML-NEXT: alignment: 2^2
# YAML-NEXT: section-choice: custom-required
# YAML-NEXT: section-name: .got
# YAML-NEXT: permissions: rw-
# YAML-NEXT: references:
# YAML-NEXT: - kind: LLD_R_MIPS_GLOBAL_GOT
# YAML-NEXT: offset: 0
# YAML-NEXT: target: extern
# Function glob
# YAML: - name: glob
# YAML: scope: global
# YAML: content: [ 00, 00, 84, 8F, 00, 00, 84, 24, 01, 00, 84, 8F,
# YAML: 00, 02, 84, 24, 00, 00, 84, 8F, 00, 00, 84, 8F,
# YAML: 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: L006
# YAML: - kind: R_MIPS_GOT16
# YAML: offset: 8
# YAML: target: L005
# YAML: addend: 66048
# YAML: - kind: R_MIPS_LO16
# YAML: offset: 12
# YAML: target: L006
# YAML: addend: 512
# YAML: - kind: R_MIPS_GOT16
# YAML: offset: 16
# YAML: target: L007
# YAML: - kind: R_MIPS_CALL16
# YAML: offset: 20
# YAML: target: L008
# YAML: - kind: R_MIPS_CALL16
# YAML: offset: 24
# YAML: target: L009
# RAW: Disassembly of section .text:
# RAW: glob:
# RAW-NEXT: 12c: 18 80 84 8f lw $4, -32744($gp)
# RAW-NEXT: 130: 00 20 84 24 addiu $4, $4, 8192
# RAW-NEXT: 134: 1c 80 84 8f lw $4, -32740($gp)
# RAW-NEXT: 138: 00 22 84 24 addiu $4, $4, 8704
# RAW-NEXT: 13c: 20 80 84 8f lw $4, -32736($gp)
# RAW-NEXT: 140: 24 80 84 8f lw $4, -32732($gp)
# RAW-NEXT: 144: 28 80 84 8f lw $4, -32728($gp)
# RAW: SYMBOL TABLE:
# RAW: 00000000 *UND* 00000000
# RAW: 00002000 l .data 00000000 str1
# RAW: 00012200 l .data 00000005 str2
# RAW: 0000012c g F .text 0000001c glob
# RAW: 00012205 g .data 00000004 hidden