summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-12-16 11:56:03 +1100
committerDamien George <damien@micropython.org>2024-12-16 11:56:03 +1100
commit8e4c8096940c83c49c3ac07acc96b0133f65ec8e (patch)
tree1cc40623fd79fbf196e28f00591909f0be38928f
parent5f2d05d41755990c1e14223475e19c7d204d9db2 (diff)
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>
-rw-r--r--ports/unix/Makefile4
-rw-r--r--ports/windows/Makefile4
2 files changed, 8 insertions, 0 deletions
diff --git a/ports/unix/Makefile b/ports/unix/Makefile
index f02e6c635..88fa1af04 100644
--- a/ports/unix/Makefile
+++ b/ports/unix/Makefile
@@ -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
diff --git a/ports/windows/Makefile b/ports/windows/Makefile
index cf0a92701..115d1a61e 100644
--- a/ports/windows/Makefile
+++ b/ports/windows/Makefile
@@ -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