| 1 |
; RUN: llvm-as %s -o %t.o |
| 2 |
|
| 3 |
;; Non-PIC source. |
| 4 |
|
| 5 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 6 |
; RUN: --shared \ |
| 7 |
; RUN: --plugin-opt=save-temps %t.o -o %t-out |
| 8 |
; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC |
| 9 |
|
| 10 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 11 |
; RUN: --export-dynamic --noinhibit-exec -pie \ |
| 12 |
; RUN: --plugin-opt=save-temps %t.o -o %t-out |
| 13 |
; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC |
| 14 |
|
| 15 |
;; PIC source. |
| 16 |
|
| 17 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 18 |
; RUN: --shared \ |
| 19 |
; RUN: --plugin-opt=save-temps %t.o -o %t-out |
| 20 |
; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC |
| 21 |
|
| 22 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 23 |
; RUN: --export-dynamic --noinhibit-exec -pie \ |
| 24 |
; RUN: --plugin-opt=save-temps %t.o -o %t-out |
| 25 |
; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC |
| 26 |
|
| 27 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 28 |
; RUN: -r \ |
| 29 |
; RUN: --plugin-opt=save-temps %t.o -o %t-out |
| 30 |
; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC |
| 31 |
|
| 32 |
|
| 33 |
; PIC: R_X86_64_GOTPCREL foo |
| 34 |
|
| 35 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 36 |
target triple = "x86_64-unknown-linux-gnu" |
| 37 |
|
| 38 |
@foo = external global i32 |
| 39 |
define i32 @main() { |
| 40 |
%t = load i32, ptr @foo |
| 41 |
ret i32 %t |
| 42 |
} |
| 43 |
|
| 44 |
!llvm.module.flags = !{!0} |
| 45 |
!0 = !{i32 1, !"PIC Level", i32 2} |