From d696250ddbeb347866e5404f74c8abf2002183de Mon Sep 17 00:00:00 2001
From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
Date: Sun, 18 Jul 2021 16:55:57 +0800
Subject: [PATCH] Fix ELF architecture offset for x86_64

The current offset results in ELF binaries returning an `#arch` of
`:dunno`.

Also, skip the `check_binary_arches` audit on the generic OS.
---
 Library/Homebrew/formula_cellar_checks.rb | 2 ++
 Library/Homebrew/os/linux/elf.rb          | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb
index 187c055ff4..cff0baa647 100644
--- a/Library/Homebrew/formula_cellar_checks.rb
+++ b/Library/Homebrew/formula_cellar_checks.rb
@@ -316,6 +316,8 @@ module FormulaCellarChecks
 
   def check_binary_arches(formula)
     return unless formula.prefix.directory?
+    # There is no `binary_executable_or_library_files` method for the generic OS
+    return if !OS.mac? && !OS.linux?
 
     keg = Keg.new(formula.prefix)
     mismatches = keg.binary_executable_or_library_files.reject do |file|
diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb
index f31a40f806..77bf6f4139 100644
--- a/Library/Homebrew/os/linux/elf.rb
+++ b/Library/Homebrew/os/linux/elf.rb
@@ -33,7 +33,7 @@ module ELFShim
   private_constant :ARCHITECTURE_POWERPC
   ARCHITECTURE_ARM = 0x28
   private_constant :ARCHITECTURE_ARM
-  ARCHITECTURE_X86_64 = 0x62
+  ARCHITECTURE_X86_64 = 0x3E
   private_constant :ARCHITECTURE_X86_64
   ARCHITECTURE_AARCH64 = 0xB7
   private_constant :ARCHITECTURE_AARCH64
-- 
GitLab