Merge pull request #1460 from woodruffw/audit-ignore-weak-linkage
os/mac: MachO.dynamically_linked_libraries filtering.
This commit is contained in:
commit
1fb7d0fa57
@ -23,7 +23,10 @@ class LinkageChecker
|
|||||||
@keg.find do |file|
|
@keg.find do |file|
|
||||||
next if file.symlink? || file.directory?
|
next if file.symlink? || file.directory?
|
||||||
next unless file.dylib? || file.mach_o_executable? || file.mach_o_bundle?
|
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
|
@reverse_links[dylib] << file
|
||||||
if dylib.start_with? "@"
|
if dylib.start_with? "@"
|
||||||
@variable_dylibs << dylib
|
@variable_dylibs << dylib
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
require "vendor/macho/macho"
|
require "vendor/macho/macho"
|
||||||
require "os/mac/architecture_list"
|
require "os/mac/architecture_list"
|
||||||
|
|
||||||
module MachO
|
module MachOShim
|
||||||
# @private
|
# @private
|
||||||
def macho
|
def macho
|
||||||
@macho ||= begin
|
@macho ||= begin
|
||||||
@ -51,8 +51,10 @@ module MachO
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def dynamically_linked_libraries
|
def dynamically_linked_libraries(except: :none)
|
||||||
macho.linked_dylibs
|
lcs = macho.dylib_load_commands.reject { |lc| lc.type == except }
|
||||||
|
|
||||||
|
lcs.map(&:name).map(&:to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dylib_id
|
def dylib_id
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
require "os/mac/mach"
|
require "os/mac/mach"
|
||||||
|
|
||||||
class Pathname
|
class Pathname
|
||||||
include MachO
|
include MachOShim
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user