Merge pull request #20434 from Homebrew/new-protodesc_cold-fix
os/linux/keg_relocate: skip ELF files with `protodesc_cold` only when bottling
This commit is contained in:
commit
e0a69316b7
@ -4,7 +4,7 @@
|
|||||||
require "compilers"
|
require "compilers"
|
||||||
|
|
||||||
class Keg
|
class Keg
|
||||||
def relocate_dynamic_linkage(relocation)
|
def relocate_dynamic_linkage(relocation, skip_protodesc_cold: false)
|
||||||
# Patching the dynamic linker of glibc breaks it.
|
# Patching the dynamic linker of glibc breaks it.
|
||||||
return if name.match? Version.formula_optionally_versioned_regex(:glibc)
|
return if name.match? Version.formula_optionally_versioned_regex(:glibc)
|
||||||
|
|
||||||
@ -12,14 +12,19 @@ class Keg
|
|||||||
|
|
||||||
elf_files.each do |file|
|
elf_files.each do |file|
|
||||||
file.ensure_writable do
|
file.ensure_writable do
|
||||||
change_rpath!(file, old_prefix, new_prefix)
|
change_rpath!(file, old_prefix, new_prefix, skip_protodesc_cold:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_rpath!(file, old_prefix, new_prefix)
|
def change_rpath!(file, old_prefix, new_prefix, skip_protodesc_cold: false)
|
||||||
return false if !file.elf? || !file.dynamic_elf?
|
return false if !file.elf? || !file.dynamic_elf?
|
||||||
|
|
||||||
|
# Skip relocation of files with `protodesc_cold` sections because patchelf.rb seems to break them,
|
||||||
|
# but only when bottling (as we don't want to break existing bottles that require relocation).
|
||||||
|
# https://github.com/Homebrew/homebrew-core/pull/232490#issuecomment-3161362452
|
||||||
|
return false if skip_protodesc_cold && file.section_names.include?("protodesc_cold")
|
||||||
|
|
||||||
updated = {}
|
updated = {}
|
||||||
old_rpath = file.rpath
|
old_rpath = file.rpath
|
||||||
new_rpath = if old_rpath
|
new_rpath = if old_rpath
|
||||||
|
|||||||
@ -20,7 +20,7 @@ module OS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def relocate_dynamic_linkage(relocation)
|
def relocate_dynamic_linkage(relocation, skip_protodesc_cold: false)
|
||||||
mach_o_files.each do |file|
|
mach_o_files.each do |file|
|
||||||
file.ensure_writable do
|
file.ensure_writable do
|
||||||
modified = T.let(false, T::Boolean)
|
modified = T.let(false, T::Boolean)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def relocate_dynamic_linkage(_relocation)
|
def relocate_dynamic_linkage(_relocation, skip_protodesc_cold: false)
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class Keg
|
|||||||
|
|
||||||
def replace_locations_with_placeholders
|
def replace_locations_with_placeholders
|
||||||
relocation = prepare_relocation_to_placeholders.freeze
|
relocation = prepare_relocation_to_placeholders.freeze
|
||||||
relocate_dynamic_linkage(relocation)
|
relocate_dynamic_linkage(relocation, skip_protodesc_cold: true)
|
||||||
replace_text_in_files(relocation)
|
replace_text_in_files(relocation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user