Skip to content

Commit

Permalink
Merge pull request #43 from staticfloat/sf/rpath_type_stability
Browse files Browse the repository at this point in the history
Improve type stability of `rpaths(RPath(oh::ELFHandle))`
  • Loading branch information
staticfloat authored May 8, 2024
2 parents 2dce787 + 6ec5680 commit e05cacd
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 e05cacd

Please sign in to comment.