Skip to content

Commit 26b47b5

Browse files
author
Maxim Egorushkin
committed
Fix clang-14 on aarch64 -march=native error better.
1 parent 74e9a68 commit 26b47b5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,26 @@ AR := ${ar.${TOOLSET}}
3737

3838
uname_m := $(shell uname -m)
3939

40-
cxxflags.gcc.debug := -Og -fstack-protector-all -fno-omit-frame-pointer # -D_GLIBCXX_DEBUG
41-
cxxflags.gcc.release.x86_64 := -march=native -mtune=native
42-
cxxflags.gcc.release := -O3 -falign-{functions,loops}=64 -DNDEBUG ${cxxflags.gcc.release.${uname_m}}
40+
cxxflags.gcc.debug := -Og -march=native -fstack-protector-all -fno-omit-frame-pointer # -D_GLIBCXX_DEBUG
41+
cxxflags.gcc.release := -O3 -march=native -mtune=native -falign-{functions,loops}=64 -DNDEBUG
4342
cxxflags.gcc.sanitize := ${cxxflags.gcc.release} -fsanitize=thread
4443
cxxflags.gcc := -f{no-plt,no-math-errno,finite-math-only,message-length=0} -W{all,extra,error,no-{array-bounds,maybe-uninitialized,unused-variable,unused-function,unused-local-typedefs}} ${cxxflags.gcc.${BUILD}}
4544
ldflags.gcc.sanitize := ${ldflags.gcc.release} -fsanitize=thread
4645
ldflags.gcc := ${ldflags.gcc.${BUILD}}
4746

48-
cxxflags.clang.debug := -O0 -fstack-protector-all
49-
cxxflags.clang.release.x86_64 := -march=native -mtune=native
50-
cxxflags.clang.release := -O3 -falign-functions=64 -DNDEBUG ${cxxflags.clang.release.${uname_m}}
47+
cxxflags.clang.debug := -O0 -march=native -fstack-protector-all
48+
cxxflags.clang.release := -O3 -march=native -mtune=native -falign-functions=64 -DNDEBUG
5149
cxxflags.clang.sanitize := ${cxxflags.clang.release} -fsanitize=thread
5250
cxxflags.clang := -stdlib=libstdc++ -f{no-plt,no-math-errno,finite-math-only,message-length=0} -W{all,extra,error,no-{unused-variable,unused-function,unused-local-typedefs}} ${cxxflags.clang.${BUILD}}
5351
ldflags.clang.sanitize := ${ldflags.clang.release} -fsanitize=thread
5452
ldflags.clang.debug := -latomic # A work-around for clang bug.
5553
ldflags.clang := -stdlib=libstdc++ ${ldflags.clang.${BUILD}}
5654

55+
# clang-14 for arm doesn't support -march=native.
56+
ifneq (,$(and $(findstring clang,${CXX}), $(findstring aarch64,${uname_m}), $(shell ${CXX} -c -xc++ -march=native -o/dev/null /dev/null 2>&1)))
57+
cxxflags.clang := $(filter-out native,${cxxflags.clang})
58+
endif
59+
5760
# Additional CPPFLAGS, CXXFLAGS, LDLIBS, LDFLAGS can come from the command line, e.g. make CPPFLAGS='-I<my-include-dir>', or from environment variables.
5861
cxxflags := -std=c++14 -pthread -g ${cxxflags.${TOOLSET}} ${CXXFLAGS}
5962
cppflags := -Iinclude ${CPPFLAGS}

0 commit comments

Comments
 (0)