From 0f3394bc844bdf2f00e911e3359da22759112812 Mon Sep 17 00:00:00 2001 From: Volker Mauel Date: Sun, 3 Aug 2025 20:19:01 +0200 Subject: [PATCH] Use large code model for 64-bit builds --- CMakeLists.txt | 5 +++++ Makefile | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edb9e6570d..227e706c72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,6 +145,11 @@ if (NOT MSVC) endif() endif() +# Ensure large code model for 64-bit x86 builds to handle large static tables +if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64") + add_compile_options(-mcmodel=large) +endif() + # # build the library # diff --git a/Makefile b/Makefile index fc26d4ae7c..52af9f1217 100644 --- a/Makefile +++ b/Makefile @@ -435,13 +435,13 @@ endif ifndef RISCV ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64)) - # Use all CPU extensions that are available: - MK_CFLAGS += -march=native -mtune=native - HOST_CXXFLAGS += -march=native -mtune=native + # Use all CPU extensions that are available: + MK_CFLAGS += -march=native -mtune=native -mcmodel=large + HOST_CXXFLAGS += -march=native -mtune=native -mcmodel=large - # Usage AVX-only - #MK_CFLAGS += -mfma -mf16c -mavx - #MK_CXXFLAGS += -mfma -mf16c -mavx + # Usage AVX-only + #MK_CFLAGS += -mfma -mf16c -mavx + #MK_CXXFLAGS += -mfma -mf16c -mavx # Usage SSSE3-only (Not is SSE3!) #MK_CFLAGS += -mssse3