unix,windows: Force _FILE_OFFSET_BITS=64 to fix 32-bit file ABI.

On 64-bit systems this should have no effect.

On 32-bit systems it will force 64-bit file sizes and fixes directory
listing on certain 32-bit ports.  This option should work on pretty much
all 32-bit systems these days.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-12-16 11:56:03 +11:00
parent 5f2d05d417
commit 8e4c809694
2 changed files with 8 additions and 0 deletions

View File

@@ -48,6 +48,10 @@ CWARN = -Wall -Werror
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)
# Force the use of 64-bits for file sizes in C library functions on 32-bit platforms.
# This option has no effect on 64-bit builds.
CFLAGS += -D_FILE_OFFSET_BITS=64
# Debugging/Optimization
ifdef DEBUG
COPT ?= -Og

View File

@@ -42,6 +42,10 @@ INC += -I$(VARIANT_DIR)
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(COPT) $(CFLAGS_EXTRA)
LDFLAGS += -lm -lbcrypt $(LDFLAGS_EXTRA)
# Force the use of 64-bits for file sizes in C library functions on 32-bit platforms.
# This option has no effect on 64-bit builds.
CFLAGS += -D_FILE_OFFSET_BITS=64
# Debugging/Optimization
ifdef DEBUG
CFLAGS += -g