aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/RISCV/option-nopic.ll
blob: b781f95d6e90ebe02e7fbd97dc550b0e8afebbb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
; RUN: llc -mtriple=riscv32 -filetype=obj --relocation-model=pic < %s\
; RUN: | llvm-objdump --triple=riscv32 --mattr=+c -d -M no-aliases -\
; RUN: | FileCheck -check-prefix=CHECK %s

; This test demonstrates that .option nopic has no effect on codegen when
; emitting an ELF directly.

@symbol = global i32 zeroinitializer

define i32 @get_symbol() nounwind {
; CHECK-LABEL: <get_symbol>:
; CHECK: auipc	a0, 0x0
; CHECK: lw	a0, 0x0(a0)
; CHECK: lw	a0, 0x0(a0)
  tail call void asm sideeffect ".option nopic", ""()
  %v = load i32, ptr @symbol
  ret i32 %v
}