xref: /llvm-project/lld/test/ELF/lto/i386-global-offset-table.ll (revision 99e7350235055654aaa923701bf36adaf01739d0)
1; REQUIRES: x86
2;; LTO-generated relocatable files may reference _GLOBAL_OFFSET_TABLE_ while
3;; the IR does not mention _GLOBAL_OFFSET_TABLE_.
4;; Test that there is no spurious "undefined symbol" error.
5
6; RUN: rm -rf %t && mkdir %t && cd %t
7; RUN: llvm-as %s -o a.bc
8; RUN: ld.lld -pie a.bc -o a
9; RUN: llvm-nm a | FileCheck %s
10
11; CHECK: d _GLOBAL_OFFSET_TABLE_
12
13target datalayout = "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128"
14target triple = "i386-pc-linux-gnu"
15
16@i = global i32 0
17
18define dso_local void @_start() {
19entry:
20  %0 = load i32, ptr @i
21  %inc = add nsw i32 %0, 1
22  store i32 %inc, ptr @i
23  ret void
24}
25
26!llvm.module.flags = !{!0, !1}
27
28!0 = !{i32 8, !"PIC Level", i32 2}
29!1 = !{i32 7, !"PIE Level", i32 2}
30