Skip to content
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

Add lbt_forwarded_funcs() to debug LBT forwarding issues #55302

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions stdlib/LinearAlgebra/src/lbt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,25 @@ function lbt_find_backing_library(symbol_name, interface::Symbol;
end


"""
lbt_forwarded_funcs(config::LBTConfig, lib::LBTLibraryInfo)

Given a backing library `lib`, return the list of all functions that are
forwarded to that library, as a vector of `String`s.
"""
function lbt_forwarded_funcs(config::LBTConfig, lib::LBTLibraryInfo)
forwarded_funcs = String[]
for (symbol_idx, symbol) in enumerate(config.exported_symbols)
forward_byte_offset = div(symbol_idx - 1, 8)
forward_byte_mask = 1 << mod(symbol_idx - 1, 8)
if lib.active_forwards[forward_byte_offset+1] & forward_byte_mask != 0x00
push!(forwarded_funcs, symbol)
end
end
return forwarded_funcs
end


## NOTE: Manually setting forwards is referred to as the 'footgun API'. It allows truly
## bizarre and complex setups to be created. If you run into strange errors while using
## it, the first thing you should ask yourself is whether you've set things up properly.
Expand Down