diff mbox

[build] Move unwinder to toplevel libgcc

Message ID 4E0AEEF0.7080406@gnu.org
State New
Headers show

Commit Message

Paolo Bonzini June 29, 2011, 9:22 a.m. UTC
On 06/20/2011 02:24 PM, Rainer Orth wrote:
> * The only unwinder-related macro I haven't moved is
>    LIBGCC2_UNWIND_ATTRIBUTE.  It is only defined gcc/config/mips/mips.h.
>    I suppose we would need a libgcc equivalent of tm.h for that,
>    something I didn't want to attack at this point.

Something like the attached?

Paolo

Comments

Rainer Orth June 29, 2011, 9:33 a.m. UTC | #1
Paolo Bonzini <bonzini@gnu.org> writes:

> On 06/20/2011 02:24 PM, Rainer Orth wrote:
>> * The only unwinder-related macro I haven't moved is
>>    LIBGCC2_UNWIND_ATTRIBUTE.  It is only defined gcc/config/mips/mips.h.
>>    I suppose we would need a libgcc equivalent of tm.h for that,
>>    something I didn't want to attack at this point.
>
> Something like the attached?

Yep, that should do it.

Thanks.
	Rainer
Joseph Myers June 29, 2011, 10:41 a.m. UTC | #2
On Wed, 29 Jun 2011, Paolo Bonzini wrote:

> On 06/20/2011 02:24 PM, Rainer Orth wrote:
> > * The only unwinder-related macro I haven't moved is
> >    LIBGCC2_UNWIND_ATTRIBUTE.  It is only defined gcc/config/mips/mips.h.
> >    I suppose we would need a libgcc equivalent of tm.h for that,
> >    something I didn't want to attack at this point.
> 
> Something like the attached?

This patch appears to create a *second* file called libgcc_tm.h, so there 
is one created in gcc/ and one in libgcc/, which seems incredibly 
confusing.  By all means move the libgcc_tm.h logic to libgcc/ (though 
tm.h will need to continue to include libgcc_tm.h for the target, until 
the transition away from tm.h target macros in target code is complete and 
code includes libgcc_tm.h directly instead), but don't have two headers 
with the same name in different build directories.

I interpreted Rainer's comment as meaning that a 
libgcc/config/mips/mips-lib.h (or similar) file would need to be created 
and inserted in the right place in libgcc_tm_file for the large number of 
targets presently putting mips.h in tm_file.
Paolo Bonzini June 29, 2011, 11:28 a.m. UTC | #3
On 06/29/2011 12:41 PM, Joseph S. Myers wrote:
> On Wed, 29 Jun 2011, Paolo Bonzini wrote:
>
>> On 06/20/2011 02:24 PM, Rainer Orth wrote:
>>> * The only unwinder-related macro I haven't moved is
>>>     LIBGCC2_UNWIND_ATTRIBUTE.  It is only defined gcc/config/mips/mips.h.
>>>     I suppose we would need a libgcc equivalent of tm.h for that,
>>>     something I didn't want to attack at this point.
>>
>> Something like the attached?
>
> This patch appears to create a *second* file called libgcc_tm.h, so there
> is one created in gcc/ and one in libgcc/, which seems incredibly
> confusing.  By all means move the libgcc_tm.h logic to libgcc/ (though
> tm.h will need to continue to include libgcc_tm.h for the target, until
> the transition away from tm.h target macros in target code is complete and
> code includes libgcc_tm.h directly instead), but don't have two headers
> with the same name in different build directories.

Yes, the patch was not complete and only meant to be the plumbing for 
what you describe.

I think Rainer missed the existence of libgcc_tm_file. :)

Paolo
Rainer Orth June 29, 2011, 11:30 a.m. UTC | #4
"Joseph S. Myers" <joseph@codesourcery.com> writes:

> I interpreted Rainer's comment as meaning that a 
> libgcc/config/mips/mips-lib.h (or similar) file would need to be created 
> and inserted in the right place in libgcc_tm_file for the large number of 
> targets presently putting mips.h in tm_file.

Indeed, that's why I refrained from attacking this by other means.

	Rainer
Rainer Orth June 29, 2011, 11:32 a.m. UTC | #5
Paolo Bonzini <bonzini@gnu.org> writes:

> I think Rainer missed the existence of libgcc_tm_file. :)

I didn't, but it lives in gcc/config.gcc, which is contrary to the move
from gcc to libgcc.

	Rainer
diff mbox

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 169877)
+++ configure.ac	(working copy)
@@ -267,6 +267,16 @@  done
 tmake_file="${tmake_file_}"
 AC_SUBST(tmake_file)
 
+# Likewise export definitions for libgcc_tm.h
+tm_file_=
+for f in ${tm_file}
+do
+	tm_file_="${tm_file_} \$(srcdir)/config/$f"
+done
+tm_file="${tm_file_}"
+AC_SUBST(tm_file)
+AC_SUBST(tm_defines)
+
 # Substitute configuration variables
 AC_SUBST(extra_parts)
 AC_SUBST(asm_hidden_op)
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 169877)
+++ Makefile.in	(working copy)
@@ -253,6 +253,16 @@  objects = $(filter %$(objext),$^)
 tmake_file = @tmake_file@
 include $(srcdir)/empty.mk $(tmake_file)
 
+# Collect target defines and headers from config.host.
+libgcc_tm_defines = @tm_defines@
+libgcc_tm_file = @tm_file@
+libgcc_tm.h: libgcc_tm.stamp; @true
+libgcc_tm.stamp:
+	DEFINES='$(libgcc_tm_defines)' HEADERS='$(libgcc_tm_file)' \
+		$(srcdir)/mkheader.sh > tmp-libgcc_tm.h
+	$(SHELL) $(srcdir)/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
+	echo timestamp > $@
+
 # Only handle shared libraries if both:
 #   - the user requested them
 #   - we know how to build them
Index: config.host
===================================================================
--- config.host	(revision 169877)
+++ config.host	(working copy)
@@ -57,6 +57,8 @@ 
 asm_hidden_op=.hidden
 extra_parts=
 tmake_file=
+tm_defines=
+tm_file=
 
 # Set default cpu_type so it can be updated in each machine entry.
 cpu_type=`echo ${host} | sed 's/-.*$//'`
Index: mkheader.sh
===================================================================
--- mkheader.sh	(revision 0)
+++ mkheader.sh	(revision 0)
@@ -0,0 +1,41 @@ 
+#! /bin/sh
+
+# Copyright (C) 2001, 2002, 2006, 2007, 2010, 2011 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/>.  
+
+
+# Print libgcc_tm.h to the standard output.
+# DEFINES and HEADERS are expected to be set in the environment.
+
+# Add multiple inclusion protection guard, part one.
+echo "#ifndef LIBGCC_TM_H"
+echo "#define LIBGCC_TM_H"
+
+# Generate the body of the file
+echo "/* Automatically generated by mkheader.sh.  */"
+for def in $DEFINES; do
+    echo "#ifndef $def" | sed 's/=.*//'
+    echo "# define $def" | sed 's/=/ /'
+    echo "#endif"
+done
+
+for file in $HEADERS; do
+    echo "#include \"$file\""
+done
+
+# Add multiple inclusion protection guard, part two.
+echo "#endif /* LIBGCC_TM_H"