Skip to content

Commit 8e4c809

Browse files
committed
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 <[email protected]>
1 parent 5f2d05d commit 8e4c809

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ports/unix/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ CWARN = -Wall -Werror
4848
CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion
4949
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA)
5050

51+
# Force the use of 64-bits for file sizes in C library functions on 32-bit platforms.
52+
# This option has no effect on 64-bit builds.
53+
CFLAGS += -D_FILE_OFFSET_BITS=64
54+
5155
# Debugging/Optimization
5256
ifdef DEBUG
5357
COPT ?= -Og

ports/windows/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ INC += -I$(VARIANT_DIR)
4242
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(COPT) $(CFLAGS_EXTRA)
4343
LDFLAGS += -lm -lbcrypt $(LDFLAGS_EXTRA)
4444

45+
# Force the use of 64-bits for file sizes in C library functions on 32-bit platforms.
46+
# This option has no effect on 64-bit builds.
47+
CFLAGS += -D_FILE_OFFSET_BITS=64
48+
4549
# Debugging/Optimization
4650
ifdef DEBUG
4751
CFLAGS += -g

0 commit comments

Comments
 (0)