# Stefan Teleman <[email protected]>
# Make sure libgcc_s.so.1 is built correctly, and with the
# right compiler flags. Namely LARGEFILE and EXTENSIONS.
# Internal patch. Not submitted upstream yet.
--- libgcc/Makefile.in 2014-01-08 08:37:08.000000000 -0800
+++ libgcc/Makefile.in 2015-08-09 21:01:50.367886911 -0700
@@ -46,6 +46,9 @@
host_noncanonical = @host_noncanonical@
target_noncanonical = @target_noncanonical@
+# Who are we?
+HOSTOS = $(shell uname -s)
+
# List of extra object files that should be compiled for this target machine.
# The rules for compiling them should be in the t-* file for the machine.
EXTRA_PARTS = @extra_parts@
@@ -73,17 +76,24 @@
CC = @CC@
CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
RANLIB = @RANLIB@
LN_S = @LN_S@
PWD_COMMAND = $${PWDCMD-pwd}
+ifeq ($(HOSTOS),SunOS)
+ CPPFLAGS += -D_REENTRANT=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+ CPPFLAGS += -D__EXTENSIONS__=1
+endif
+
# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
"AR=$(AR)" \
"AR_FLAGS=$(AR_FLAGS)" \
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
+ "CPPFLAGS=$(CPPFLAGS)" \
"DESTDIR=$(DESTDIR)" \
"EXTRA_OFILES=$(EXTRA_OFILES)" \
"HDEFINES=$(HDEFINES)" \
@@ -296,7 +306,7 @@
inst_libdir = $(libsubdir)$(MULTISUBDIR)
inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
-gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
+gcc_compile_bare = $(CC) $(CPPFLAGS) $(INTERNAL_CFLAGS)
compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
gcc_s_compile = $(gcc_compile) -DSHARED
@@ -962,7 +972,7 @@
endif
# Build the standard GCC startfiles and endfiles.
-ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
+ALL_CRT_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
ifeq ($(CUSTOM_CRTSTUFF),)