shared: only fall back to -march=native on supported architectures

This commit is contained in:
Caleb Xu 2024-11-12 11:34:40 -05:00
parent acb3675911
commit a70d15c80d
No known key found for this signature in database
GPG Key ID: 47E6040D07B8407D
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",