Skip to content
Snippets Groups Projects
Unverified Commit 032ed07b authored by William Woodruff's avatar William Woodruff
Browse files

os/mac: Allow MachO.dynamically_linked_libraries to be filtered by dylib type.

This allows us to filter out weak linkages during audits, preventing
a false error from occurring when the dylib cannot be found.
parent 7e093796
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,10 @@ class LinkageChecker
@keg.find do |file|
next if file.symlink? || file.directory?
next unless file.dylib? || file.mach_o_executable? || file.mach_o_bundle?
file.dynamically_linked_libraries.each do |dylib|
# weakly loaded dylibs may not actually exist on disk, so skip them
# when checking for broken linkage
file.dynamically_linked_libraries(except: :LC_LOAD_WEAK_DYLIB).each do |dylib|
@reverse_links[dylib] << file
if dylib.start_with? "@"
@variable_dylibs << dylib
......
......@@ -51,8 +51,10 @@ module MachO
end
end
def dynamically_linked_libraries
macho.linked_dylibs
def dynamically_linked_libraries(except: :none)
lcs = macho.dylib_load_commands.reject { |lc| lc.type == except }
lcs.map(&:name).map(&:to_s)
end
def dylib_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment