diff mbox

[build] Move sync, mips16.S to toplevel libgcc

Message ID yddliv9ukg8.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Aug. 4, 2011, 5:59 p.m. UTC
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Another easy part in the toplevel libgcc move was sync.c and related
> stuff.  While doing this, it turned out to be easier to move the rest of
> gcc/config/mips/t-libgcc-mips16 rather than leave it behind.
>
> The patch is untested except for including it in a mips-sgi-irix6.5
> build to make sure it is syntactically correct, but I don't have mips16
> system to actually test.

Since Richard had found that that patch didn't work on systems where
mips16.S is actually used since LIB1ASMSRC is only searched in
gcc/config, I'm deferring that part to a followup patch to deal with
libgcc1 (LIB1* etc.) as a whole.  That patch is almost ready, just needs
a final read-over and a couple of finishing touches.

So this patch only deals with the sync functions proper and should be
relatively straightforward.  Richard, could you please try this one,
too?

It is relative to the three previous patches (unwinder, fp-bit, and
soft-fp), so it might no apply cleanly for libgcc/config.host.

Ok for mainline if it passes?

Thanks.
	Rainer


2011-07-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config/sync.c: Move to ../libgcc.
	* Makefile.in (libgcc.mvars): Remove LIBGCC_SYNC,
	LIBGCC_SYNC_CFLAGS.
	* config/mips/t-libgcc-mips16 (LIBGCC_SYNC, LIBGCC_SYNC_CFLAGS):
	Remove.

	libgcc:
	* sync.c: New file.
	* config/mips/t-mips16: New file.
	* config.host (mips64*-*-linux*): Add mips/t-mips16 to tmake_file.
	(mips*-*-linux*): Likewise.
	(mips*-sde-elf*): Likewise.
	(mipsisa32-*-elf*): Join with mipsisa32r2-*-elf*,
	mipsisa64-*-elf*, mipsisa64r2-*-elf*.
	Add mips/t-mips16 to tmake_file.
	(mipsisa64sb1-*-elf*): Add mips/t-mips16 to tmake_file.
	(mips-*-elf*): Likewise.
	(mips64-*-elf*): Likewise.
	(mips64orion-*-elf*): Likewise.
	(mips*-*-rtems*): Likewise.
	(mipstx39-*-elf*): Likewise.
	* Makefile.in: Use SYNC instead of LIBGCC_SYNC.
	($(libgcc-sync-size-funcs-o)): Use SYNC_CFLAGS instead of
	LIBGCC_SYNC_CFLAGS.
	Use $(srcdir) to refer to sync.c.
	Use $<.
	($(libgcc-sync-funcs-o)): Likewise.
	($(libgcc-sync-size-funcs-s-o)): Likewise.
	($(libgcc-sync-funcs-s-o)): Likewise.

Comments

Richard Sandiford Aug. 6, 2011, 6:45 p.m. UTC | #1
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>> Another easy part in the toplevel libgcc move was sync.c and related
>> stuff.  While doing this, it turned out to be easier to move the rest of
>> gcc/config/mips/t-libgcc-mips16 rather than leave it behind.
>>
>> The patch is untested except for including it in a mips-sgi-irix6.5
>> build to make sure it is syntactically correct, but I don't have mips16
>> system to actually test.
>
> Since Richard had found that that patch didn't work on systems where
> mips16.S is actually used since LIB1ASMSRC is only searched in
> gcc/config, I'm deferring that part to a followup patch to deal with
> libgcc1 (LIB1* etc.) as a whole.  That patch is almost ready, just needs
> a final read-over and a couple of finishing touches.
>
> So this patch only deals with the sync functions proper and should be
> relatively straightforward.  Richard, could you please try this one,
> too?

Sure.  Tested on mips64-linux-gnu, where it works fine, thanks.

> 2011-07-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	gcc:
> 	* config/sync.c: Move to ../libgcc.
> 	* Makefile.in (libgcc.mvars): Remove LIBGCC_SYNC,
> 	LIBGCC_SYNC_CFLAGS.
> 	* config/mips/t-libgcc-mips16 (LIBGCC_SYNC, LIBGCC_SYNC_CFLAGS):
> 	Remove.
>
> 	libgcc:
> 	* sync.c: New file.
> 	* config/mips/t-mips16: New file.
> 	* config.host (mips64*-*-linux*): Add mips/t-mips16 to tmake_file.
> 	(mips*-*-linux*): Likewise.
> 	(mips*-sde-elf*): Likewise.
> 	(mipsisa32-*-elf*): Join with mipsisa32r2-*-elf*,
> 	mipsisa64-*-elf*, mipsisa64r2-*-elf*.
> 	Add mips/t-mips16 to tmake_file.
> 	(mipsisa64sb1-*-elf*): Add mips/t-mips16 to tmake_file.
> 	(mips-*-elf*): Likewise.
> 	(mips64-*-elf*): Likewise.
> 	(mips64orion-*-elf*): Likewise.
> 	(mips*-*-rtems*): Likewise.
> 	(mipstx39-*-elf*): Likewise.
> 	* Makefile.in: Use SYNC instead of LIBGCC_SYNC.
> 	($(libgcc-sync-size-funcs-o)): Use SYNC_CFLAGS instead of
> 	LIBGCC_SYNC_CFLAGS.
> 	Use $(srcdir) to refer to sync.c.
> 	Use $<.
> 	($(libgcc-sync-funcs-o)): Likewise.
> 	($(libgcc-sync-size-funcs-s-o)): Likewise.
> 	($(libgcc-sync-funcs-s-o)): Likewise.

OK for the MIPS parts.

Richard
Rainer Orth Aug. 9, 2011, 12:14 p.m. UTC | #2
Richard Sandiford <rdsandiford@googlemail.com> writes:

>> So this patch only deals with the sync functions proper and should be
>> relatively straightforward.  Richard, could you please try this one,
>> too?
>
> Sure.  Tested on mips64-linux-gnu, where it works fine, thanks.

Fine, thanks for testing.

>> 2011-07-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>> 	gcc:
>> 	* config/sync.c: Move to ../libgcc.
>> 	* Makefile.in (libgcc.mvars): Remove LIBGCC_SYNC,
>> 	LIBGCC_SYNC_CFLAGS.
>> 	* config/mips/t-libgcc-mips16 (LIBGCC_SYNC, LIBGCC_SYNC_CFLAGS):
>> 	Remove.
>>
>> 	libgcc:
>> 	* sync.c: New file.
>> 	* config/mips/t-mips16: New file.
>> 	* config.host (mips64*-*-linux*): Add mips/t-mips16 to tmake_file.
>> 	(mips*-*-linux*): Likewise.
>> 	(mips*-sde-elf*): Likewise.
>> 	(mipsisa32-*-elf*): Join with mipsisa32r2-*-elf*,
>> 	mipsisa64-*-elf*, mipsisa64r2-*-elf*.
>> 	Add mips/t-mips16 to tmake_file.
>> 	(mipsisa64sb1-*-elf*): Add mips/t-mips16 to tmake_file.
>> 	(mips-*-elf*): Likewise.
>> 	(mips64-*-elf*): Likewise.
>> 	(mips64orion-*-elf*): Likewise.
>> 	(mips*-*-rtems*): Likewise.
>> 	(mipstx39-*-elf*): Likewise.
>> 	* Makefile.in: Use SYNC instead of LIBGCC_SYNC.
>> 	($(libgcc-sync-size-funcs-o)): Use SYNC_CFLAGS instead of
>> 	LIBGCC_SYNC_CFLAGS.
>> 	Use $(srcdir) to refer to sync.c.
>> 	Use $<.
>> 	($(libgcc-sync-funcs-o)): Likewise.
>> 	($(libgcc-sync-size-funcs-s-o)): Likewise.
>> 	($(libgcc-sync-funcs-s-o)): Likewise.
>
> OK for the MIPS parts.

Paolo, are you ok with the build parts?

Thanks.
	Rainer
Paolo Bonzini Aug. 9, 2011, 3:30 p.m. UTC | #3
On 08/09/2011 02:14 PM, Rainer Orth wrote:
>> >  OK for the MIPS parts.
> Paolo, are you ok with the build parts?

Yes.

Paolo
diff mbox

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1879,8 +1879,6 @@  libgcc.mvars: config.status Makefile $(L
 	echo SHLIB_NM_FLAGS = '$(SHLIB_NM_FLAGS)' >> tmp-libgcc.mvars
 	echo LIBGCC2_CFLAGS = '$(LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
 	echo TARGET_LIBGCC2_CFLAGS = '$(TARGET_LIBGCC2_CFLAGS)' >> tmp-libgcc.mvars
-	echo LIBGCC_SYNC = '$(LIBGCC_SYNC)' >> tmp-libgcc.mvars
-	echo LIBGCC_SYNC_CFLAGS = '$(LIBGCC_SYNC_CFLAGS)' >> tmp-libgcc.mvars
 	echo CRTSTUFF_CFLAGS = '$(CRTSTUFF_CFLAGS)' >> tmp-libgcc.mvars
 	echo CRTSTUFF_T_CFLAGS = '$(CRTSTUFF_T_CFLAGS)' >> tmp-libgcc.mvars
 	echo CRTSTUFF_T_CFLAGS_S = '$(CRTSTUFF_T_CFLAGS_S)' >> tmp-libgcc.mvars
diff --git a/gcc/config/mips/t-libgcc-mips16 b/gcc/config/mips/t-libgcc-mips16
--- a/gcc/config/mips/t-libgcc-mips16
+++ b/gcc/config/mips/t-libgcc-mips16
@@ -1,4 +1,4 @@ 
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -38,8 +38,5 @@  LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m1
 	_m16stubdc0 _m16stubdc1 _m16stubdc2 _m16stubdc5 _m16stubdc6 \
 	_m16stubdc9 _m16stubdc10
 
-LIBGCC_SYNC = yes
-LIBGCC_SYNC_CFLAGS = -mno-mips16
-
 # Version these symbols if building libgcc.so.
 SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -650,7 +650,7 @@  endif
 
 endif
 
-ifeq ($(LIBGCC_SYNC),yes)
+ifeq ($(SYNC),yes)
 libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
 			    sync_fetch_and_$(op) \
 			    sync_$(op)_and_fetch) \
@@ -663,37 +663,37 @@  libgcc-sync-size-funcs := $(foreach pref
 			      $(prefix)_$(suffix)))
 
 libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
-$(libgcc-sync-size-funcs-o): %$(objext): $(gcc_srcdir)/config/sync.c
-	$(gcc_compile) $(LIBGCC_SYNC_CFLAGS) \
+$(libgcc-sync-size-funcs-o): %$(objext): $(srcdir)/sync.c
+	$(gcc_compile) $(SYNC_CFLAGS) \
 	  -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
 	  -DSIZE=`echo "$*" | sed 's/.*_//'` \
-	  -c $(gcc_srcdir)/config/sync.c $(vis_hide)
+	  -c $< $(vis_hide)
 libgcc-objects += $(libgcc-sync-size-funcs-o)
 
 libgcc-sync-funcs := sync_synchronize
 
 libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
-$(libgcc-sync-funcs-o): %$(objext): $(gcc_srcdir)/config/sync.c
-	$(gcc_compile) $(LIBGCC_SYNC_CFLAGS) \
+$(libgcc-sync-funcs-o): %$(objext): $(srcdir)/sync.c
+	$(gcc_compile) $(SYNC_CFLAGS) \
 	  -DL$* \
-	  -c $(gcc_srcdir)/config/sync.c $(vis_hide)
+	  -c $< $(vis_hide)
 libgcc-objects += $(libgcc-sync-funcs-o)
 
 ifeq ($(enable_shared),yes)
 libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
 			       $(libgcc-sync-size-funcs))
-$(libgcc-sync-size-funcs-s-o): %_s$(objext): $(gcc_srcdir)/config/sync.c
-	$(gcc_s_compile) $(LIBGCC_SYNC_CFLAGS) \
+$(libgcc-sync-size-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
+	$(gcc_s_compile) $(SYNC_CFLAGS) \
 	  -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
 	  -DSIZE=`echo "$*" | sed 's/.*_//'` \
-	  -c $(gcc_srcdir)/config/sync.c
+	  -c $<
 libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)
 
 libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
-$(libgcc-sync-funcs-s-o): %_s$(objext): $(gcc_srcdir)/config/sync.c
-	$(gcc_s_compile) $(LIBGCC_SYNC_CFLAGS) \
+$(libgcc-sync-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
+	$(gcc_s_compile) $(SYNC_CFLAGS) \
 	  -DL$*	\
-	  -c $(gcc_srcdir)/config/sync.c
+	  -c $<
 libgcc-s-objects += $(libgcc-sync-funcs-s-o)
 endif
 endif
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -537,12 +537,12 @@  mips*-*-netbsd*)			# NetBSD/mips, either
 	;;
 mips64*-*-linux* | mipsisa64*-*-linux*)
 	extra_parts="$extra_parts crtfastmath.o"
-	tmake_file="${tmake_file} t-crtfm mips/t-tpbit"
+	tmake_file="${tmake_file} t-crtfm mips/t-mips16 mips/t-tpbit"
 	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-linux*)				# Linux MIPS, either endian.
 	extra_parts="$extra_parts crtfastmath.o"
-	tmake_file="${tmake_file} t-crtfm"
+	tmake_file="${tmake_file} t-crtfm mips/t-mips16"
 	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-openbsd*)
@@ -557,33 +557,38 @@  mips*-sde-elf*)
 	    tmake_file=mips/t-sdemtk
 	    ;;
 	esac
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
-mipsisa32-*-elf* | mipsisa32el-*-elf*)
-	;;
-mipsisa32r2-*-elf* | mipsisa32r2el-*-elf*)
-	;;
-mipsisa64-*-elf* | mipsisa64el-*-elf*)
-	;;
+mipsisa32-*-elf* | mipsisa32el-*-elf* | \
+mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \
+mipsisa64-*-elf* | mipsisa64el-*-elf* | \
 mipsisa64r2-*-elf* | mipsisa64r2el-*-elf*)
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
 mipsisa64sr71k-*-elf*)
 	tmake_file=t-fdpbit
         ;;
 mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*)
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
 mips-*-elf* | mipsel-*-elf*)
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
 mips64-*-elf* | mips64el-*-elf*)
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
 mips64vr-*-elf* | mips64vrel-*-elf*)
         ;;
 mips64orion-*-elf* | mips64orionel-*-elf*)
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
 mips*-*-rtems*)
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
 mips-wrs-vxworks)
 	;;
 mipstx39-*-elf* | mipstx39el-*-elf*)
+	tmake_file="$tmake_file mips/t-mips16"
 	;;
 mmix-knuth-mmixware)
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
diff --git a/gcc/config/mips/t-libgcc-mips16 b/libgcc/config/mips/t-mips16
copy from gcc/config/mips/t-libgcc-mips16
copy to libgcc/config/mips/t-mips16
--- a/gcc/config/mips/t-libgcc-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -1,45 +1,2 @@ 
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-LIB1ASMSRC = mips/mips16.S
-LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
-	_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
-	_m16unordsf2 \
-	_m16fltsisf _m16fix_truncsfsi _m16fltunsisf \
-	_m16adddf3 _m16subdf3 _m16muldf3 _m16divdf3 \
-	_m16extsfdf2 _m16trdfsf2 \
-	_m16eqdf2 _m16nedf2 _m16gtdf2 _m16gedf2 _m16ledf2 _m16ltdf2 \
-	_m16unorddf2 \
-	_m16fltsidf _m16fix_truncdfsi _m16fltunsidf \
-	_m16retsf _m16retdf \
-	_m16retsc _m16retdc \
-	_m16stub1 _m16stub2 _m16stub5 _m16stub6 _m16stub9 _m16stub10 \
-	_m16stubsf0 _m16stubsf1 _m16stubsf2 _m16stubsf5 _m16stubsf6 \
-	_m16stubsf9 _m16stubsf10 \
-	_m16stubdf0 _m16stubdf1 _m16stubdf2 _m16stubdf5 _m16stubdf6 \
-	_m16stubdf9 _m16stubdf10 \
-	_m16stubsc0 _m16stubsc1 _m16stubsc2 _m16stubsc5 _m16stubsc6 \
-	_m16stubsc9 _m16stubsc10 \
-	_m16stubdc0 _m16stubdc1 _m16stubdc2 _m16stubdc5 _m16stubdc6 \
-	_m16stubdc9 _m16stubdc10
-
-LIBGCC_SYNC = yes
-LIBGCC_SYNC_CFLAGS = -mno-mips16
-
-# Version these symbols if building libgcc.so.
-SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+SYNC = yes
+SYNC_CFLAGS = -mno-mips16
diff --git a/gcc/config/sync.c b/libgcc/sync.c
rename from gcc/config/sync.c
rename to libgcc/sync.c
--- a/gcc/config/sync.c
+++ b/libgcc/sync.c
@@ -1,5 +1,5 @@ 
 /* Out-of-line libgcc versions of __sync_* builtins.  */
-/* Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2011  Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -22,8 +22,8 @@  a copy of the GCC Runtime Library Except
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
-/* This file is used by targets whose makefiles define LIBGCC_SYNC
-   to "yes".  It is compiled with LIBGCC_SYNC_CFLAGS and provides
+/* This file is used by targets whose makefiles define SYNC
+   to "yes".  It is compiled with SYNC_CFLAGS and provides
    out-of-line versions of all relevant __sync_* primitives.
 
    These routines are intended for targets like MIPS that have two