2018-06-27 06:20:04 +08:00
|
|
|
// REQUIRES: x86
|
2019-09-07 18:42:11 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
|
|
|
|
// RUN: ld.lld %t.o -o %t
|
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
|
|
|
|
// RUN: ld.lld -pie %t.o -o %t2
|
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck --check-prefix=PIE %s
|
2015-10-06 09:16:17 +08:00
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
call __preinit_array_start
|
|
|
|
call __preinit_array_end
|
|
|
|
call __init_array_start
|
|
|
|
call __init_array_end
|
|
|
|
call __fini_array_start
|
|
|
|
call __fini_array_end
|
|
|
|
|
2018-05-18 11:01:06 +08:00
|
|
|
// With no .init_array section the symbols resolve to .text.
|
2019-09-16 15:05:34 +08:00
|
|
|
// 0x201120 - (0x201120 + 5) = -5
|
|
|
|
// 0x201120 - (0x201125 + 5) = -10
|
2018-05-18 11:01:06 +08:00
|
|
|
// ...
|
2015-10-06 09:16:17 +08:00
|
|
|
|
|
|
|
// CHECK: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
// CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK-NEXT: <_start>:
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: 201120: callq -5
|
2019-09-07 18:42:11 +08:00
|
|
|
// CHECK-NEXT: callq -10
|
|
|
|
// CHECK-NEXT: callq -15
|
|
|
|
// CHECK-NEXT: callq -20
|
|
|
|
// CHECK-NEXT: callq -25
|
|
|
|
// CHECK-NEXT: callq -30
|
2017-03-14 00:40:20 +08:00
|
|
|
|
2018-05-18 11:01:06 +08:00
|
|
|
// In position-independent binaries, they resolve to .text too.
|
2017-03-14 00:40:20 +08:00
|
|
|
|
|
|
|
// PIE: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
// PIE-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
// PIE-NEXT: <_start>:
|
2019-09-16 15:05:34 +08:00
|
|
|
// PIE-NEXT: 1210: callq -5
|
2019-09-07 18:42:11 +08:00
|
|
|
// PIE-NEXT: callq -10
|
|
|
|
// PIE-NEXT: callq -15
|
|
|
|
// PIE-NEXT: callq -20
|
|
|
|
// PIE-NEXT: callq -25
|
|
|
|
// PIE-NEXT: callq -30
|