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 4 5; RUN: llvm-as %s -o %t.o 6; RUN: llvm-as %t.pic.ll -o %t.pic.o 7 8;; Non-PIC source. 9 10; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 11; RUN: --shared \ 12; RUN: --plugin-opt=save-temps %t.o -o %t-out 13; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=PIC 14 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 19 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 24 25; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 26; RUN: -r \ 27; RUN: --plugin-opt=save-temps %t.o -o %t-out 28; RUN: llvm-readobj -r %t-out.o | FileCheck %s --check-prefix=STATIC 29 30;; PIC source. 31 32; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 33; RUN: --shared \ 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 36 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 41 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 46 47; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ 48; RUN: -r \ 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 51 52 53; PIC: R_X86_64_GOTPCREL foo 54; STATIC: R_X86_64_PC32 foo 55 56target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 57target triple = "x86_64-unknown-linux-gnu" 58 59@foo = external global i32 60define i32 @main() { 61 %t = load i32, i32* @foo 62 ret i32 %t 63} 64