Skip to content

Commit ab6f9ad

Browse files
tryfix windows linux freebsd
1 parent 9009385 commit ab6f9ad

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

test/stdlib_dependencies.jl

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,15 @@ try
7373

7474
# For ELF files, get dynamic dependencies
7575
if isa(obj, ObjectFile.ELFHandle)
76-
# Look for the dynamic section
77-
for section in ObjectFile.Sections(obj)
78-
if ObjectFile.section_name(section) == ".dynamic"
79-
# Read dynamic entries
80-
for entry in ObjectFile.DynamicEntries(section)
81-
if ObjectFile.tag(entry) == ObjectFile.DT_NEEDED
82-
lib_name = ObjectFile.needed_library(entry)
83-
if lib_name !== nothing
84-
push!(raw_libs, basename(lib_name))
85-
end
86-
end
76+
# Get all dynamic entries
77+
dyn_entries = ObjectFile.ELFDynEntries(obj)
78+
for entry in dyn_entries
79+
# Check if the entry is of type DT_NEEDED
80+
if ObjectFile.dyn_entry_type(entry) == ObjectFile.DT_NEEDED
81+
lib_name = ObjectFile.strtab_lookup(entry)
82+
if lib_name !== nothing && !isempty(lib_name)
83+
push!(raw_libs, basename(lib_name))
8784
end
88-
break
8985
end
9086
end
9187
end
@@ -104,17 +100,13 @@ try
104100

105101
# For COFF/PE files, get import table
106102
if isa(obj, ObjectFile.COFFHandle)
107-
# Look for import table
108-
for section in ObjectFile.Sections(obj)
109-
if ObjectFile.section_name(section) == ".idata" ||
110-
startswith(ObjectFile.section_name(section), ".idata")
111-
# Parse import table entries
112-
for entry in ObjectFile.ImportEntries(section)
113-
lib_name = ObjectFile.dll_name(entry)
114-
if lib_name !== nothing
115-
push!(raw_libs_set, lowercase(lib_name))
116-
end
117-
end
103+
# Get dynamic links
104+
dls = ObjectFile.DynamicLinks(obj)
105+
for link in dls
106+
lib_name = ObjectFile.path(link)
107+
if lib_name !== nothing && !isempty(lib_name)
108+
# COFF library names are case-insensitive
109+
push!(raw_libs_set, lowercase(lib_name))
118110
end
119111
end
120112
end

0 commit comments

Comments
 (0)