Merge pull request #12864 from carlocab/dylib-id-rewriting

os/mac/{keg,mach}: fix cache invalidation
This commit is contained in:
Carlo Cabrera 2022-02-11 23:43:11 +08:00 committed by GitHub
commit 78a5a2b7b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -7,7 +7,7 @@ class Keg
@require_relocation = true
odebug "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}"
MachO::Tools.change_dylib_id(file, id, strict: false)
file.change_dylib_id(id, strict: false)
apply_ad_hoc_signature(file)
rescue MachO::MachOError
onoe <<~EOS
@ -23,7 +23,7 @@ class Keg
@require_relocation = true
odebug "Changing install name in #{file}\n from #{old}\n to #{new}"
MachO::Tools.change_install_name(file, old, new, strict: false)
file.change_install_name(old, new, strict: false)
apply_ad_hoc_signature(file)
rescue MachO::MachOError
onoe <<~EOS
@ -39,7 +39,7 @@ class Keg
@require_relocation = true
odebug "Changing rpath in #{file}\n from #{old}\n to #{new}"
MachO::Tools.change_rpath(file, old, new, strict: false)
file.change_rpath(old, new, strict: false)
apply_ad_hoc_signature(file)
rescue MachO::MachOError
onoe <<~EOS

View File

@ -64,6 +64,21 @@ module MachOShim
macho.write!
end
def change_rpath(old, new, **options)
macho.change_rpath(old, new, options)
macho.write!
end
def change_dylib_id(id, **options)
macho.change_dylib_id(id, options)
macho.write!
end
def change_install_name(old, new, **options)
macho.change_install_name(old, new, options)
macho.write!
end
def dynamically_linked_libraries(except: :none)
lcs = macho.dylib_load_commands.reject { |lc| lc.type == except }