-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[AIX] Implement the ifunc attribute. #153049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 10 commits
c562d40
7defcf4
916b94e
5a1b3ce
36f1e88
27da809
896b543
13868e8
204ea53
8f81cc6
4956ea2
28f128c
62b6e6f
9b7b796
4c7462d
d453395
e55fb54
40856e1
a25cbf1
c8094b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| // RUN: %clang_cc1 -triple x86_64-apple-macosx -verify -emit-llvm-only %s | ||
| // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -verify -emit-llvm-only %s | ||
| // RUN: %clang_cc1 -triple aarch64-pc-windows-msvcu -verify -emit-llvm-only %s | ||
| // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify -emit-llvm-only %s | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shud have at least one 32-bit test here or in anothe LIT
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since the test case only test whether the source code is compiled pass or not ? do it matter 32bit or 64bit ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, maybe in this test it's not useful to test 32-bit, but we need some where to test that ifunc is supported in 32-bit AIX. |
||
| // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify -emit-llvm-only -DCHECK_ALIASES %s | ||
|
|
||
| #if defined(_WIN32) && !defined(__aarch64__) | ||
| void foo(void) {} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| typedef void* Ptr; | ||
| typedef struct { Ptr addr, toc, env; } Descr; | ||
| typedef struct { Descr* desc; Ptr (*resolver)(); } IFUNC_PAIR; | ||
|
|
||
| // A zero-length entry in section "ifunc_sec" to satisfy the __start_ifunc_sec | ||
| // and __stop_ifunc_sec references in this file, when no user code has any. | ||
| __attribute__((section("ifunc_sec"))) static int dummy_ifunc_sec[0]; | ||
w2yehia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| extern IFUNC_PAIR __start_ifunc_sec, __stop_ifunc_sec; | ||
|
|
||
| __attribute__((constructor)) | ||
w2yehia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| void __init_ifuncs() { | ||
| void *volatile ref = &dummy_ifunc_sec; // hack to keep dummy_ifunc_sec alive | ||
|
|
||
| // hack to prevent compiler from assuming __start_ifunc_sec and | ||
| // __stop_ifunc_sec occupy different addresses. | ||
| IFUNC_PAIR *volatile volatile_end = &__stop_ifunc_sec; | ||
w2yehia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for (IFUNC_PAIR *pair = &__start_ifunc_sec, *end = volatile_end; pair != end; | ||
| pair++) | ||
| pair->desc->addr = ((Descr*)(pair->resolver()))->addr; | ||
w2yehia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
w2yehia marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.