-
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
Open
w2yehia
wants to merge
20
commits into
llvm:main
Choose a base branch
from
w2yehia:ifunc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+595
−40
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c562d40
accept ifunc attribute on AIX
7defcf4
enable tests
916b94e
Add ppc/init_ifuncs.c to the builtins library and pass the linker opt…
5a1b3ce
create a zero-length entry in the ifunc_sec section to satisfy the st…
36f1e88
use -bdbg:namedsects:ss on AIX 7.2 and above
27da809
Address code review comments
896b543
comment changes and logic updates in TOCRestoreNeededForCallToImpleme…
13868e8
refactor TOCRestoreNeeded
204ea53
simplify IsLocalFunc by using isStrongDefinitionForLinker() && isDSOL…
8f81cc6
improve switch table detection
4956ea2
remove assert in transformCallee()
28f128c
init_ifuncs.c: copy entire descriptor
62b6e6f
code review
9b7b796
refactor TOCRestoreNeededForCallToImplementation based on code review
4c7462d
Sean's second code review
d453395
ifunc test 1
e55fb54
more ifunc tests
40856e1
update section name and refactor init_ifuncs.c
a25cbf1
improve error message
c8094b6
support large code model
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| typedef void *Ptr; | ||
| typedef struct { | ||
| Ptr addr, toc, env; | ||
| } Descr; | ||
| typedef struct { | ||
| Descr *desc; | ||
| Ptr (*resolver)(); | ||
| } IFUNCPair; | ||
|
|
||
| #define CONC2(A, B) A##B | ||
| #define CONC(A, B) CONC2(A, B) | ||
|
|
||
| #define IFUNC_SEC __ifunc_sec | ||
| #define IFUNC_SEC_STR "__ifunc_sec" | ||
| #define START_SEC CONC(__start_, IFUNC_SEC) | ||
| #define STOP_SEC CONC(__stop_, IFUNC_SEC) | ||
|
|
||
| // A zero-length entry in section "__ifunc_sec" to satisfy the START_SEC and | ||
| // STOP_SEC references in this file, when no user code has any ifuncs. | ||
| __attribute__((section(IFUNC_SEC_STR))) static int dummy_ifunc_sec[0]; | ||
|
|
||
| extern IFUNCPair START_SEC, STOP_SEC; | ||
|
|
||
| __attribute__((constructor)) void __init_ifuncs() { | ||
| void *volatile ref = &dummy_ifunc_sec; // hack to keep dummy_ifunc_sec alive | ||
|
|
||
| // hack to prevent compiler from assuming START_SEC and STOP_SEC | ||
| // occupy different addresses. | ||
| IFUNCPair *volatile volatile_end = &STOP_SEC; | ||
| for (IFUNCPair *pair = &START_SEC, *end = volatile_end; pair != end; pair++) { | ||
| // Call the resolver and copy the entire descriptor because: | ||
| // - the resolved function might be in another DSO, so copy the TOC address | ||
| // - we might be linking with objects from a language that uses the | ||
| // enviroment pointer, so copy it too. | ||
| Descr *result = (Descr *)pair->resolver(); | ||
| *(pair->desc) = *result; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.