Files
TheRock/compiler/amd-llvm/lld/test/ELF/lto/x86-64-global-offset-table.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

72 lines
2.2 KiB
LLVM

; REQUIRES: x86
;; LTO-generated relocatable files may reference _GLOBAL_OFFSET_TABLE_ while
;; the IR does not mention _GLOBAL_OFFSET_TABLE_.
;; Test that there is no spurious "undefined symbol" error.
; RUN: rm -rf %t && split-file %s %t && cd %t
; RUN: opt -module-summary b.ll -o b.bc
;; Test Thin LTO.
; RUN: cat a.ll medium.ll | opt -module-summary - -o medium.bc
; RUN: ld.lld -pie --no-relax medium.bc b.bc -o medium
; RUN: llvm-objdump -dt medium | FileCheck %s
;; Test regular LTO.
; RUN: cat a.ll large.ll | llvm-as - -o large.bc
; RUN: ld.lld -pie large.bc b.bc -o large
; RUN: llvm-objdump -dt large | FileCheck %s
;; Explicit reference of _GLOBAL_OFFSET_TABLE_ is fine.
; RUN: cat a.ll medium.ll ref.ll | opt -module-summary - -o ref.bc
; RUN: ld.lld -pie -u ref ref.bc b.bc -y _GLOBAL_OFFSET_TABLE_ -o ref 2>&1 | FileCheck %s --check-prefix=TRACE
; RUN: llvm-objdump -dt ref | FileCheck %s
; TRACE: ref.bc: reference to _GLOBAL_OFFSET_TABLE_
; TRACE-NEXT: ref.bc: reference to _GLOBAL_OFFSET_TABLE_
; TRACE-NEXT: <internal>: definition of _GLOBAL_OFFSET_TABLE_
; TRACE-NEXT: ref.lto.ref.o: reference to _GLOBAL_OFFSET_TABLE_
;; The IR symbol table references _GLOBAL_OFFSET_TABLE_, which causes lld to define the symbol.
; CHECK: .got.plt 0000000000000000 .hidden _GLOBAL_OFFSET_TABLE_
; CHECK: movabsq
;--- a.ll
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@i = external global i32
define dso_local void @_start() {
entry:
%0 = load i32, ptr @i
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @i
ret void
}
!llvm.module.flags = !{!0, !1, !2, !3}
!0 = !{i32 8, !"PIC Level", i32 2}
!1 = !{i32 7, !"PIE Level", i32 2}
!2 = !{i32 1, !"Large Data Threshold", i64 0}
;--- medium.ll
!3 = !{i32 1, !"Code Model", i32 3}
;--- large.ll
!3 = !{i32 1, !"Code Model", i32 4}
;--- ref.ll
@_GLOBAL_OFFSET_TABLE_ = external global [0 x i8]
define dso_local ptr @ref() {
entry:
ret ptr @_GLOBAL_OFFSET_TABLE_
}
;--- b.ll
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@i = global i32 0