1
1
Fork
You've already forked bittricks
1

aarch64: Use macros to define resolver & dispatch funcs #11

Merged
jjl merged 1 commit from jepler/bittricks:ifunc-dispatch-macros into main 2026年03月27日 17:19:28 +01:00
Collaborator
Copy link

This incidentally fixes the fact that wrapping of the s_1 functions was not done for aarch64 without ifunc.

For aarch64, this removes the hand-written resolver functions & dispatch functions and replaces them with invocations of a macro called MULTI_FUN:

MULTI_FUN(uint64_t, bt_pext_u64, (uint64_t a, uint64_t b), (a, b))
MULTI_FUN(uint32_t, bt_pext_u32, (uint32_t a, uint32_t b), (a, b))
// etc

The macro itself is defined in different ways according to whether _BT_IFUNC_ATTR is defined, but basically it expands to a function which checks for each possible implementation in turn, taking the one indicated by bt_best_impl.

Although it is not tested, this should work correctly if fewer than all variants are compile-time enabled.

x86_64 could be handled similarly, if desired.

Diff is better viewed locally with git show --patience 04fd924da8

With any luck this should not conflict with #10, which problem I discovered while working on this.

This incidentally fixes the fact that wrapping of the `s_1` functions was not done for aarch64 without ifunc. For aarch64, this removes the hand-written resolver functions & dispatch functions and replaces them with invocations of a macro called `MULTI_FUN`: ```c MULTI_FUN(uint64_t, bt_pext_u64, (uint64_t a, uint64_t b), (a, b)) MULTI_FUN(uint32_t, bt_pext_u32, (uint32_t a, uint32_t b), (a, b)) // etc ``` The macro itself is defined in different ways according to whether `_BT_IFUNC_ATTR` is defined, but basically it expands to a function which checks for each possible implementation in turn, taking the one indicated by `bt_best_impl`. Although it is not tested, this should work correctly if fewer than all variants are compile-time enabled. x86_64 could be handled similarly, if desired. Diff is better viewed locally with `git show --patience 04fd924da8` With any luck this should not conflict with #10, which problem I discovered while working on this.
aarch64: Use macros to define resolver & dispatch funcs
All checks were successful
Build & Test / build (pull_request) Successful in 1m53s
04fd924da8
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jjl/bittricks!11
Reference in a new issue
jjl/bittricks
No description provided.
Delete branch "jepler/bittricks:ifunc-dispatch-macros"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?