mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 12:36:07 +00:00

Unlike ELF targets, MachO does not support the same kind of dynamic symbol resolution at load time. Instead, the corresponding MachO feature resolves symbols lazily on first call. Reviewers: JDevlieghere, dmpolukhin, ahmedbougacha, tahonermann, echristo, MaskRay, erichkeane Reviewed By: MaskRay, echristo, ahmedbougacha Pull Request: https://github.com/llvm/llvm-project/pull/73687
19 lines
897 B
C++
19 lines
897 B
C++
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
|
|
// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck %s
|
|
// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s
|
|
|
|
extern "C" {
|
|
__attribute__((used)) static void *resolve_foo() { return 0; }
|
|
__attribute__((ifunc("resolve_foo"))) char *foo();
|
|
__attribute__((ifunc("resolve_foo"))) void foo2(int);
|
|
__attribute__((ifunc("resolve_foo"))) char foo3(float);
|
|
__attribute__((ifunc("resolve_foo"))) char foo4(float);
|
|
}
|
|
|
|
// CHECK: @resolve_foo = internal alias ptr (), ptr @_ZL11resolve_foov
|
|
// CHECK: @foo = ifunc ptr (), ptr @_ZL11resolve_foov
|
|
// CHECK: @foo2 = ifunc void (i32), ptr @_ZL11resolve_foov
|
|
// CHECK: @foo3 = ifunc i8 (float), ptr @_ZL11resolve_foov
|
|
// CHECK: @foo4 = ifunc i8 (float), ptr @_ZL11resolve_foov
|
|
// CHECK: define internal noundef ptr @_ZL11resolve_foov()
|