Merge pull request #18759 from alebcay/restrict-native-optflags

shared: only fall back to -march=native on supported architectures
This commit is contained in:
Mike McQuaid 2024-11-13 16:45:26 +00:00 committed by GitHub
commit 5a2c264d19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -7,8 +7,10 @@ module SharedEnvExtension
@bottle_arch.to_sym
elsif @build_bottle
Hardware.oldest_cpu
else
elsif Hardware::CPU.intel? || Hardware::CPU.arm?
:native
else
:none
end
end
end

View File

@ -27,6 +27,7 @@ module Hardware
sig { returns(T::Hash[Symbol, String]) }
def optimization_flags
@optimization_flags ||= T.let({
none: "",
native: arch_flag("native"),
ivybridge: "-march=ivybridge",
sandybridge: "-march=sandybridge",