brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 4b0f638 Raw
72 lines · plain
1; REQUIRES: x862;; LTO-generated relocatable files may reference _GLOBAL_OFFSET_TABLE_ while3;; the IR does not mention _GLOBAL_OFFSET_TABLE_.4;; Test that there is no spurious "undefined symbol" error.5 6; RUN: rm -rf %t && split-file %s %t && cd %t7; RUN: opt -module-summary b.ll -o b.bc8 9;; Test Thin LTO.10; RUN: cat a.ll medium.ll | opt -module-summary - -o medium.bc11; RUN: ld.lld -pie --no-relax medium.bc b.bc -o medium12; RUN: llvm-objdump -dt medium | FileCheck %s13 14;; Test regular LTO.15; RUN: cat a.ll large.ll | llvm-as - -o large.bc16; RUN: ld.lld -pie large.bc b.bc -o large17; RUN: llvm-objdump -dt large | FileCheck %s18 19;; Explicit reference of _GLOBAL_OFFSET_TABLE_ is fine.20; RUN: cat a.ll medium.ll ref.ll | opt -module-summary - -o ref.bc21; RUN: ld.lld -pie -u ref ref.bc b.bc -y _GLOBAL_OFFSET_TABLE_ -o ref 2>&1 | FileCheck %s --check-prefix=TRACE22; RUN: llvm-objdump -dt ref | FileCheck %s23 24; TRACE:      ref.bc: reference to _GLOBAL_OFFSET_TABLE_25; TRACE-NEXT: ref.bc: reference to _GLOBAL_OFFSET_TABLE_26; TRACE-NEXT: <internal>: definition of _GLOBAL_OFFSET_TABLE_27; TRACE-NEXT: ref.lto.ref.o: reference to _GLOBAL_OFFSET_TABLE_28 29;; The IR symbol table references _GLOBAL_OFFSET_TABLE_, which causes lld to define the symbol.30; CHECK: .got.plt       0000000000000000 .hidden _GLOBAL_OFFSET_TABLE_31; CHECK: movabsq32 33;--- a.ll34target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"35target triple = "x86_64-unknown-linux-gnu"36 37@i = external global i3238 39define dso_local void @_start() {40entry:41  %0 = load i32, ptr @i42  %inc = add nsw i32 %0, 143  store i32 %inc, ptr @i44  ret void45}46 47!llvm.module.flags = !{!0, !1, !2, !3}48 49!0 = !{i32 8, !"PIC Level", i32 2}50!1 = !{i32 7, !"PIE Level", i32 2}51!2 = !{i32 1, !"Large Data Threshold", i64 0}52 53;--- medium.ll54!3 = !{i32 1, !"Code Model", i32 3}55 56;--- large.ll57!3 = !{i32 1, !"Code Model", i32 4}58 59;--- ref.ll60@_GLOBAL_OFFSET_TABLE_ = external global [0 x i8]61 62define dso_local ptr @ref() {63entry:64  ret ptr @_GLOBAL_OFFSET_TABLE_65}66 67;--- b.ll68target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"69target triple = "x86_64-unknown-linux-gnu"70 71@i = global i32 072