2018-06-06 21:56:51 +08:00
|
|
|
// REQUIRES: x86
|
2015-12-11 16:59:37 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/relocation-size-shared.s -o %tso.o
|
2019-09-09 11:35:14 +08:00
|
|
|
// RUN: ld.lld -shared %tso.o -soname=so -o %t1.so
|
|
|
|
// RUN: ld.lld %t.o %t1.so -o %t
|
|
|
|
// RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCSHARED %s
|
|
|
|
// RUN: llvm-readelf -x .data %t | FileCheck --check-prefix=DATA %s
|
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
|
2015-12-11 16:59:37 +08:00
|
|
|
|
|
|
|
// RELOCSHARED: Relocations [
|
|
|
|
// RELOCSHARED-NEXT: Section ({{.*}}) .rela.dyn {
|
2019-09-09 11:35:14 +08:00
|
|
|
// RELOCSHARED-NEXT: R_X86_64_SIZE32 fooshared 0xFFFFFFFFFFFFFFFF
|
|
|
|
// RELOCSHARED-NEXT: R_X86_64_SIZE32 fooshared 0x0
|
|
|
|
// RELOCSHARED-NEXT: R_X86_64_SIZE32 fooshared 0x1
|
|
|
|
// RELOCSHARED-NEXT: R_X86_64_SIZE64 fooshared 0xFFFFFFFFFFFFFFFF
|
|
|
|
// RELOCSHARED-NEXT: R_X86_64_SIZE64 fooshared 0x0
|
|
|
|
// RELOCSHARED-NEXT: R_X86_64_SIZE64 fooshared 0x1
|
2015-12-11 16:59:37 +08:00
|
|
|
// RELOCSHARED-NEXT: }
|
|
|
|
// RELOCSHARED-NEXT:]
|
|
|
|
|
2019-09-09 11:35:14 +08:00
|
|
|
// DATA: section '.data':
|
|
|
|
// DATA-NEXT: 00000000 00000000 00000000 00000000
|
|
|
|
// DATA-NEXT: 00000000 00000000 00001900 00000000
|
|
|
|
// DATA-NEXT: 00001a00 00000000 00001b00 00000000
|
|
|
|
// DATA-NEXT: 00000000 00000000 00000000 00000000
|
|
|
|
// DATA-NEXT: 00000000 00000000 0000
|
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM: <_start>:
|
2019-09-09 11:35:14 +08:00
|
|
|
// DISASM-NEXT: movl 25, %eax
|
|
|
|
// DISASM-NEXT: movl 26, %eax
|
|
|
|
// DISASM-NEXT: movl 27, %eax
|
|
|
|
// DISASM-NEXT: movl 0, %eax
|
|
|
|
// DISASM-NEXT: movl 0, %eax
|
|
|
|
// DISASM-NEXT: movl 0, %eax
|
2015-12-11 16:59:37 +08:00
|
|
|
|
|
|
|
.data
|
|
|
|
.global foo
|
|
|
|
.type foo,%object
|
|
|
|
.size foo,26
|
|
|
|
foo:
|
|
|
|
.zero 26
|
|
|
|
|
|
|
|
// R_X86_64_SIZE64:
|
|
|
|
.quad foo@SIZE-1
|
|
|
|
.quad foo@SIZE
|
|
|
|
.quad foo@SIZE+1
|
|
|
|
.quad fooshared@SIZE-1
|
|
|
|
.quad fooshared@SIZE
|
|
|
|
.quad fooshared@SIZE+1
|
|
|
|
|
2019-09-09 11:35:14 +08:00
|
|
|
.section test, "awx"
|
2015-12-11 16:59:37 +08:00
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
// R_X86_64_SIZE32:
|
|
|
|
movl foo@SIZE-1,%eax
|
|
|
|
movl foo@SIZE,%eax
|
|
|
|
movl foo@SIZE+1,%eax
|
|
|
|
movl fooshared@SIZE-1,%eax
|
|
|
|
movl fooshared@SIZE,%eax
|
|
|
|
movl fooshared@SIZE+1,%eax
|