This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR33396 - add --enable-intermodule for libgcc
- From: Bernhard Fischer <rep dot dot dot nop at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: ian at airs dot com, rep dot dot dot nop at gmail dot com
- Date: Mon, 19 Nov 2007 18:51:46 +0100
- Subject: [PATCH] PR33396 - add --enable-intermodule for libgcc
:ADDPATCH libgcc:
Hi,
The attached patch adds an optional IMA mode to libgcc's configury as
per PR33396. Included are some small fixes exposed by IMA. A few warnings
exposed by it are left unfixed for now, help on those is very welcome.
It is currently regtesting on i686-linux-gnu.
Ok for trunk when regtesting passes fine?
thanks,
libgcc/ChangeLog:
2007-11-19 Bernhard Fischer <>
* configure.ac: Add option --enable-intermodule for onestep
compile.
* Makefile.in: Use onestep.
gcc/ChangeLog:
2007-11-19 Bernhard Fischer <>
* gbl-ctors.h: Add header guard.
* libgcc2.c: Avoid redefinition of FUNC, use FUNCU for
__floatundi?f
* config/libbid/bid64_div.c: Extern decls of
__bid_{convert_table,factors,packed_10000_zeros} have to be const.
* libgcc/config/libbid/bid128_div.c: Likewise.
Index: gcc-4.3/libgcc/Makefile.in
===================================================================
--- gcc-4.3/libgcc/Makefile.in (revision 130291)
+++ gcc-4.3/libgcc/Makefile.in (working copy)
@@ -326,8 +326,27 @@
$(LIB2_DIVMOD_FUNCS))
# Build "libgcc1" (assembly) components.
+
+lib1asmfuncs-onestep-sources += $(gcc_srcdir)/config/$(LIB1ASMSRC)
+lib1asmfuncs-onestep-defines += $(patsubst %,-DL%,$(LIB1ASMFUNCS))
+libgcc-objects-onestep += $(if $(LIB1ASMSRC),lib1asmfuncs_onestep.o)
+
ifeq ($(enable_shared),yes)
+libgcc-objects-onestep += $(if $(LIB1ASMSRC),lib1asmfuncs_s_onestep.o)
+#libgcc-objects-onestep += $(lib1asmfuncs-o) $(lib1asmfuncs-s-o)
+
+lib1asmfuncs-onestep-prereq += $(patsubst %,%.vis,$(LIB1ASMFUNCS))
+
+lib1asmfuncs_onestep.o: $(lib1asmfuncs-onestep-sources) \
+ $(lib1asmfuncs-onestep-prereq)
+ $(gcc_compile) $(lib1asmfuncs-onestep-defines) -xassembler-with-cpp \
+ -c $(gcc_srcdir)/config/$(LIB1ASMSRC) \
+ $(patsubst %,-include %,$(lib1asmfuncs-onestep-prereq)) -combine
+lib1asmfuncs_s_onestep.o: $(lib1asmfuncs-onestep-sources)
+ $(gcc_s_compile) $(lib1asmfuncs-onestep-defines) -xassembler-with-cpp \
+ -c $(gcc_srcdir)/config/$(LIB1ASMSRC) -combine
+
lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC) %.vis
$(gcc_compile) -DL$* -xassembler-with-cpp \
@@ -344,6 +363,11 @@
else
+#libgcc-objects-onestep += $(lib1asmfuncs-o)
+lib1asmfuncs_onestep.o: $(lib1asmfuncs-onestep-sources)
+ $(gcc_compile) $(lib1asmfuncs-onestep-defines) -xassembler-with-cpp \
+ -c $(gcc_srcdir)/config/$(LIB1ASMSRC) -combine
+
lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
$(gcc_compile) -DL$* -xassembler-with-cpp \
@@ -358,6 +382,8 @@
$(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
$(vis_hide)
libgcc-objects += $(lib2funcs-o)
+libgcc-onestep-sources += $(gcc_srcdir)/libgcc2.c
+libgcc-onestep-defines += $(patsubst %,-DL%,$(lib2funcs) $(LIB2FUNCS_ST))
ifeq ($(enable_shared),yes)
lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
@@ -394,6 +420,8 @@
$(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
-fexceptions -fnon-call-exceptions $(vis_hide)
libgcc-objects += $(lib2-divmod-o)
+libgcc-onestep-sources += $(gcc_srcdir)/libgcc2.c
+libgcc-onestep-defines += $(patsubst %,-DL%,$(LIB2_DIVMOD_FUNCS))
ifeq ($(enable_shared),yes)
lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
@@ -426,6 +454,8 @@
$(fpbit-o): %$(objext): $(FPBIT)
$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
libgcc-objects += $(fpbit-o)
+libgcc-onestep-sources += $(FPBIT)
+libgcc-onestep-defines += $(patsubst %,-DL%,$(FPBIT_FUNCS))
ifeq ($(enable_shared),yes)
fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
@@ -441,6 +471,8 @@
$(dpbit-o): %$(objext): $(DPBIT)
$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
libgcc-objects += $(dpbit-o)
+libgcc-onestep-sources += $(DPBIT)
+libgcc-onestep-defines += $(patsubst %,-DL%,$(DPBIT_FUNCS))
ifeq ($(enable_shared),yes)
dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
@@ -456,6 +488,8 @@
$(tpbit-o): %$(objext): $(TPBIT)
$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT) $(vis_hide)
libgcc-objects += $(tpbit-o)
+libgcc-onestep-sources += $(TPBIT)
+libgcc-onestep-defines += $(patsubst %,-DL%,$(TPBIT_FUNCS))
ifeq ($(enable_shared),yes)
tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
@@ -496,8 +530,10 @@
dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
ifeq ($(enable_decimal_float),bid)
+libgcc-onestep-sources += $(patsubst %,$(srcdir)/config/libbid/%.c,$(dfp-filenames))
$(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
else
+libgcc-onestep-sources += $(patsubst %,$(srcdir)/../libdecnumber/%.c,$(dfp-filenames))
$(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
endif
$(gcc_compile) -c $<
@@ -520,8 +556,10 @@
decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
ifeq ($(enable_decimal_float),bid)
+libgcc-onestep-sources += $(patsubst %,$(srcdir)/config/libbid/%.c,$(decbits-filenames))
$(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
else
+libgcc-onestep-sources += $(patsubst %,$(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c,$(decbits-filenames))
$(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
endif
$(gcc_compile) -c $<
@@ -543,36 +581,49 @@
endif
ifneq ($(D32PBIT),)
+libgcc-objects-onestep += libgcc_32_onestep.o
d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
ifeq ($(enable_decimal_float),bid)
+libgcc-32-onestep-sources += $(patsubst %,$(srcdir)/config/libbid/%.c,$(D32PBIT_FUNCS))
$(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
else
+libgcc-32-onestep-sources += $(gcc_srcdir)/config/dfp-bit.c
$(d32pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
endif
$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
libgcc-objects += $(d32pbit-o)
+libgcc-32-onestep-defines += $(patsubst %,-DL%,$(D32PBIT_FUNCS)) -DWIDTH=32
endif
ifneq ($(D64PBIT),)
+libgcc-objects-onestep += libgcc_64_onestep.o
d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
ifeq ($(enable_decimal_float),bid)
+libgcc-64-onestep-sources += $(patsubst %,$(srcdir)/config/libbid/%.c,$(D64PBIT_FUNCS))
$(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
else
+libgcc-64-onestep-sources += $(gcc_srcdir)/config/dfp-bit.c
$(d64pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
+
endif
$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
libgcc-objects += $(d64pbit-o)
+libgcc-64-onestep-defines += $(patsubst %,-DL%,$(D64PBIT_FUNCS)) -DWIDTH=64
endif
ifneq ($(D128PBIT),)
+libgcc-objects-onestep += libgcc_128_onestep.o
d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
ifeq ($(enable_decimal_float),bid)
+libgcc-128-onestep-sources += $(patsubst %,$(srcdir)/config/libbid/%.c,$(D128PBIT_FUNCS))
$(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
else
+libgcc-128-onestep-sources += $(gcc_srcdir)/config/dfp-bit.c
$(d128pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
endif
$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
libgcc-objects += $(d128pbit-o)
+libgcc-128-onestep-defines += $(patsubst %,-DL%,$(D128PBIT_FUNCS)) -DWIDTH=128
endif
endif
@@ -623,7 +674,9 @@
ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
$(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
endif
-
+ifneq (@onestep@,)
+libgcc-objects:=# reset, empty
+endif
libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
@@ -678,8 +731,29 @@
$(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcov.c
+libgcc-objects-onestep += libgcc_onestep.o
+ifneq (@onestep@,)
+# add the rest
+libgcc-objects-onestep += $(libgcc-objects)
+endif
+
+libgcc_onestep.o: $(libgcc-onestep-sources)
+ $(gcc_compile) $^ $(libgcc-onestep-defines) \
+ -DFINE_GRAINED_LIBRARIES $(vis_hide) -c -combine
+
+libgcc_32_onestep.o: $(libgcc-32-onestep-sources)
+ $(gcc_compile) $^ $(libgcc-32-onestep-defines) \
+ -DFINE_GRAINED_LIBRARIES -c -combine
+libgcc_64_onestep.o: $(libgcc-64-onestep-sources)
+ $(gcc_compile) $^ $(libgcc-64-onestep-defines) \
+ -DFINE_GRAINED_LIBRARIES -c -combine
+libgcc_128_onestep.o: $(libgcc-128-onestep-sources)
+ $(gcc_compile) $^ $(libgcc-128-onestep-defines) \
+ -DFINE_GRAINED_LIBRARIES -c -combine
+
+
# Static libraries.
-libgcc.a: $(libgcc-objects)
+libgcc.a: $(libgcc-objects@onestep@)
libgcov.a: $(libgcov-objects)
libunwind.a: $(libunwind-objects)
libgcc_eh.a: $(libgcc-eh-objects)
Index: gcc-4.3/libgcc/configure.ac
===================================================================
--- gcc-4.3/libgcc/configure.ac (revision 130291)
+++ gcc-4.3/libgcc/configure.ac (working copy)
@@ -77,6 +77,18 @@
fi)
AC_SUBST(slibdir)
+# Build with intermodule optimisations
+AC_MSG_CHECKING([for --enable-intermodule])
+AC_ARG_ENABLE(intermodule,
+[ --enable-intermodule build the library in one step],
+[case "$enable_intermodule" in
+ yes) onestep="-onestep";;
+ *) onestep="";;
+esac],
+[onestep=""])
+AC_MSG_RESULT($enable_intermodule)
+AC_SUBST(onestep)
+
AC_PROG_INSTALL
AC_PROG_AWK
Index: gcc-4.3/libgcc/config/libbid/bid128_div.c
===================================================================
--- gcc-4.3/libgcc/config/libbid/bid128_div.c (revision 130291)
+++ gcc-4.3/libgcc/config/libbid/bid128_div.c (working copy)
@@ -34,9 +34,9 @@
#define FE_ALL_FLAGS FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW|FE_INEXACT
#endif
-extern UINT32 convert_table[5][128][2];
-extern SINT8 factors[][2];
-extern UINT8 packed_10000_zeros[];
+extern const UINT32 convert_table[5][128][2];
+extern const SINT8 factors[][2];
+extern const UINT8 packed_10000_zeros[];
BID128_FUNCTION_ARG2 (bid128_div, x, y)
Index: gcc-4.3/libgcc/config/libbid/bid64_div.c
===================================================================
--- gcc-4.3/libgcc/config/libbid/bid64_div.c (revision 130291)
+++ gcc-4.3/libgcc/config/libbid/bid64_div.c (working copy)
@@ -66,9 +66,9 @@
#define FE_ALL_FLAGS FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW|FE_INEXACT
#endif
-extern UINT32 convert_table[5][128][2];
-extern SINT8 factors[][2];
-extern UINT8 packed_10000_zeros[];
+extern const UINT32 convert_table[5][128][2];
+extern const SINT8 factors[][2];
+extern const UINT8 packed_10000_zeros[];
#if DECIMAL_CALL_BY_REFERENCE
@@ -1366,11 +1366,6 @@
//#define LEAVE_TRAILING_ZEROS
-extern UINT32 convert_table[5][128][2];
-extern SINT8 factors[][2];
-extern UINT8 packed_10000_zeros[];
-
-
//UINT64* bid64_div128x128(UINT64 res, UINT128 *px, UINT128 *py, unsigned rnd_mode, unsigned *pfpsf)
TYPE0_FUNCTION_ARG128_ARG128 (UINT64, bid64qq_div, x, y)
Index: gcc-4.3/gcc/gbl-ctors.h
===================================================================
--- gcc-4.3/gcc/gbl-ctors.h (revision 130291)
+++ gcc-4.3/gcc/gbl-ctors.h (working copy)
@@ -38,6 +38,8 @@
Note that this file should only be compiled with GCC.
*/
+#ifndef GCC_GBL_CTORS_H
+#define GCC_GBL_CTORS_H
/* Declare a pointer to void function type. */
typedef void (*func_ptr) (void);
@@ -84,3 +86,4 @@
} while (0)
#endif
+#endif /* GCC_GBL_CTORS_H */
Index: gcc-4.3/gcc/libgcc2.c
===================================================================
--- gcc-4.3/gcc/libgcc2.c (revision 130291)
+++ gcc-4.3/gcc/libgcc2.c (working copy)
@@ -1538,17 +1538,17 @@
&& SIZE > (DI_SIZE - SIZE + FSSIZE) \
&& !AVOID_FP_TYPE_CONVERSION(SIZE))
#if defined(L_floatundisf)
-#define FUNC __floatundisf
+#define FUNCU __floatundisf
#define FSTYPE SFtype
#define FSSIZE SF_SIZE
#else
-#define FUNC __floatundidf
+#define FUNCU __floatundidf
#define FSTYPE DFtype
#define FSSIZE DF_SIZE
#endif
FSTYPE
-FUNC (UDWtype u)
+FUNCU (UDWtype u)
{
#if FSSIZE >= W_TYPE_SIZE
/* When the word size is small, we never get any rounding error. */