1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/tools/gold/X86/relocation-model-static.ll
Fangrui Song 92f2c530f2 [test] Add explicit dso_local to constant/global variable declarations
They are currently implicit because TargetMachine::shouldAssumeDSOLocal implies
dso_local.

For external data, clang -fno-pic emits the dso_local specifier for ELF and
non-MinGW COFF. Adding explicit dso_local makes these tests in align with the
clang behavior and helps implementing an option to use GOT indirection for
external data access in -fno-pic mode (to avoid copy relocations).
2020-12-04 13:51:01 -08:00

24 lines
747 B
LLVM

; RUN: llvm-as %s -o %t.o
;; --noinhibit-exec allows undefined foo.
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: --export-dynamic --noinhibit-exec \
; RUN: --plugin-opt=save-temps %t.o -o %t-out
; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: -r \
; RUN: --plugin-opt=save-temps %t.o -o %t-out
; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
; STATIC: R_X86_64_PC32 foo
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@foo = external dso_local global i32
define i32 @main() {
%t = load i32, i32* @foo
ret i32 %t
}