Skip to content

Commit

Permalink
os/linux/elf: fix arch compat check on ppc
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Oct 1, 2024
1 parent f5a12a3 commit c76c902
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Library/Homebrew/os/linux/elf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit c76c902

Please sign in to comment.