Files
TheRock/compiler/amd-llvm/lld/test/MachO/lto-symbol-resolution.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

107 lines
4.5 KiB
LLVM

; REQUIRES: x86
; RUN: rm -rf %t; split-file %s %t
; RUN: opt -module-summary %t/defined.ll -o %t/defined.o
; RUN: opt -module-summary %t/weak-defined.ll -o %t/weak-defined.o
; RUN: opt -module-summary %t/archive.ll -o %t/archive.o
; RUN: opt -module-summary %t/calls-foo.ll -o %t/calls-foo.o
; RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/weak-defined.s -o %t/weak-defined-asm.o
; RUN: %lld -lSystem -dylib %t/defined.o -o %t/libfoo.dylib
; RUN: %lld -lSystem -dylib %t/weak-defined.o -o %t/libweakfoo.dylib
; RUN: llvm-ar rcs %t/archive.a %t/archive.o
;; Regular defined symbols take precedence over weak ones.
; RUN: %lld -lSystem %t/defined.o %t/weak-defined.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DEFINED
; RUN: %lld -lSystem %t/weak-defined.o %t/defined.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DEFINED
;; Regular defined symbols take precedence over weak non-bitcode ones.
; RUN: %lld -lSystem %t/defined.o %t/weak-defined-asm.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DEFINED
; RUN: %lld -lSystem %t/weak-defined-asm.o %t/defined.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DEFINED
;; NOTE: we are deviating from ld64's behavior here.
;; ld64: Weak non-bitcode symbols take precedence over weak bitcode ones.
;; lld: Weak non-bitcode symbols have the same precedence as weak bitcode ones.
; RUN: %lld -lSystem %t/weak-defined.o %t/weak-defined-asm.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED
; COM (ld64): llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED-ASM
; RUN: %lld -lSystem %t/weak-defined-asm.o %t/weak-defined.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED-ASM
;; Weak defined symbols take precedence over dylib symbols.
; RUN: %lld -lSystem %t/weak-defined.o %t/libfoo.dylib %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED
; RUN: %lld -lSystem %t/libfoo.dylib %t/weak-defined.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED
;; Weak defined symbols take precedence over archive symbols.
; RUN: %lld -lSystem %t/archive.a %t/weak-defined.o %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED
; RUN: %lld -lSystem %t/weak-defined.o %t/archive.a %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=WEAK-DEFINED
;; Archive symbols have the same precedence as dylib symbols.
; RUN: %lld -lSystem %t/archive.a %t/libfoo.dylib %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=ARCHIVE
; RUN: %lld -lSystem %t/libfoo.dylib %t/archive.a %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=DYLIB
;; Archive symbols take precedence over weak dylib symbols.
; RUN: %lld -lSystem %t/archive.a %t/libweakfoo.dylib %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=ARCHIVE
; RUN: %lld -lSystem %t/libweakfoo.dylib %t/archive.a %t/calls-foo.o -o %t/test
; RUN: llvm-objdump --syms %t/test | FileCheck %s --check-prefix=ARCHIVE
; DEFINED: g O __TEXT,defined _foo
; WEAK-DEFINED: w O __TEXT,weak_defined _foo
; WEAK-DEFINED-ASM: w O __TEXT,weak_defined_asm _foo
; ARCHIVE: g O __TEXT,archive _foo
; DYLIB: *UND* _foo
;--- defined.ll
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.15.0"
define void @foo() section "__TEXT,defined" {
ret void
}
;--- weak-defined.ll
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.15.0"
define weak void @foo() section "__TEXT,weak_defined" {
ret void
}
;--- weak-defined.s
.globl _foo
.weak_definition _foo
.section __TEXT,weak_defined_asm
_foo:
;--- archive.ll
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.15.0"
define void @foo() section "__TEXT,archive" {
ret void
}
;--- calls-foo.ll
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.15.0"
declare void @foo()
define void @main() {
call void @foo()
ret void
}