1 ; RUN: cat %s >%t.pic.ll
2 ; RUN: echo '!llvm.module.flags = !{!0}' >>%t.pic.ll
3 ; RUN: echo '!0 = !{i32 1, !"PIC Level", i32 2}' >>%t.pic.ll
5 ; RUN: llvm-as %s -o %t.o
6 ; RUN: llvm-as %t.pic.ll -o %t.pic.o
10 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
12 ; RUN: --plugin-opt=save-temps %t.o -o %t-out
13 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=PIC
15 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
16 ; RUN: --export-dynamic --noinhibit-exec -pie \
17 ; RUN: --plugin-opt=save-temps %t.o -o %t-out
18 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=PIC
20 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
21 ; RUN: --export-dynamic --noinhibit-exec \
22 ; RUN: --plugin-opt=save-temps %t.o -o %t-out
23 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=STATIC
25 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
27 ; RUN: --plugin-opt=save-temps %t.o -o %t-out
28 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=STATIC
32 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
34 ; RUN: --plugin-opt=save-temps %t.pic.o -o %t-out
35 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=PIC
37 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
38 ; RUN: --export-dynamic --noinhibit-exec -pie \
39 ; RUN: --plugin-opt=save-temps %t.pic.o -o %t-out
40 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=PIC
42 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
43 ; RUN: --export-dynamic --noinhibit-exec \
44 ; RUN: --plugin-opt=save-temps %t.pic.o -o %t-out
45 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=STATIC
47 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
49 ; RUN: --plugin-opt=save-temps %t.pic.o -o %t-out
50 ; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=PIC
53 ; PIC: R_X86_64_GOTPCREL foo
54 ; STATIC: R_X86_64_PC32 foo
56 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
57 target triple = "x86_64-unknown-linux-gnu"
59 @foo = external global i32
61 %t = load i32, i32* @foo