From c76c902dbc1c4f424453d9332bfa237e7a94bb3d Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Tue, 1 Oct 2024 05:32:58 +0100 Subject: [PATCH] os/linux/elf: fix arch compat check on ppc --- Library/Homebrew/os/linux/elf.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index 116c9ea23f4d0..05277cc223b59 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -31,6 +31,8 @@ module ELFShim private_constant :ARCHITECTURE_I386 ARCHITECTURE_POWERPC = 0x14 private_constant :ARCHITECTURE_POWERPC + ARCHITECTURE_POWERPC64 = 0x15 + private_constant :ARCHITECTURE_POWERPC64 ARCHITECTURE_ARM = 0x28 private_constant :ARCHITECTURE_ARM ARCHITECTURE_X86_64 = 0x3E @@ -61,7 +63,8 @@ def arch @arch ||= case read_uint16(ARCHITECTURE_OFFSET) when ARCHITECTURE_I386 then :i386 when ARCHITECTURE_X86_64 then :x86_64 - when ARCHITECTURE_POWERPC then :powerpc + when ARCHITECTURE_POWERPC then :ppc32 + when ARCHITECTURE_POWERPC64 then :ppc64 when ARCHITECTURE_ARM then :arm when ARCHITECTURE_AARCH64 then :arm64 else :dunno @@ -71,6 +74,9 @@ def arch def arch_compatible?(wanted_arch) return true unless elf? + # Treat ppc64le and ppc64 the same + wanted_arch = :ppc64 if wanted_arch == :ppc64le + wanted_arch == arch end