Skip to content

Commit

Permalink
Improve type stability of rpaths(RPath(oh::ELFHandle))
Browse files Browse the repository at this point in the history
Previously, we'd get `Vector{Any}`, but we actually want
`Vector{AbstractString}`.
  • Loading branch information
staticfloat committed May 8, 2024
1 parent 2dce787 commit 6ec5680
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/ELF/ELFDynamicLink.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Stores the RPath entries from an ELF object
"""
struct ELFRPath{H <: ELFHandle} <: RPath{H}
section_ref::SectionRef{H}
rpath::Vector
rpath::Vector{<:AbstractString}
end

"""
Expand All @@ -106,13 +106,18 @@ function RPath(oh::ELFHandle)
des = ELFDynEntries(oh, [DT_RPATH, DT_RUNPATH])

# Lookup each and every one of those strings, split them out into paths
colon_paths = [strtab_lookup(d) for d in des]
paths = vcat([split(p, ":") for p in colon_paths]...)
colon_paths = String[strtab_lookup(d) for d in des]
paths = AbstractString[]
for colon_path in colon_paths
for component in split(colon_path, ':')
push!(paths, component)
end
end

# Return our RPath object
return ELFRPath(dyn_section, paths)
end

Section(rpath::ELFRPath) = rpath.section_ref
handle(rpath::ELFRPath) = handle(Section(rpath))
rpaths(rpath::ELFRPath) = rpath.rpath
rpaths(rpath::ELFRPath) = rpath.rpath

0 comments on commit 6ec5680

Please sign in to comment.