Patchwork New port for TILEPro and TILE-Gx 3/7: gcc port

login
register
mail settings
Submitter Walter Lee
Date Oct. 20, 2011, 4:10 p.m.
Message ID <4EA047EC.8020407@tilera.com>
Download mbox | patch
Permalink /patch/120832/
State New
Headers show

Comments

Walter Lee - Oct. 20, 2011, 4:10 p.m.
Hi Joseph,

Thanks for the feedback.  I am attaching a gcc patch that addresses most 
of the comments.  Here are replies to a few of the comments:

> > +#undef SYSROOT_SUFFIX_SPEC
> > +#define SYSROOT_SUFFIX_SPEC "%{mbme:/usr/lib/bme;mnewlib:/usr/lib/newlib}"
> > +
> > +#undef SYSROOT_HEADERS_SUFFIX_SPEC
> > +#define SYSROOT_HEADERS_SUFFIX_SPEC SYSROOT_SUFFIX_SPEC
>
> These specs seem rather unusual.  Typically such specs would be generated
> depending on what multilibs were being built (see t-sysroot-suffix), and
> since a subdirectory sysroot itself contains directories such as usr/lib
> and usr/include, you would not expect a /usr/lib path within those specs.

I've reverted the SYSROOT changes to support -mbme and -mnewlib for now.

> > +#undef MCOUNT_NAME
> > +#define MCOUNT_NAME "mcount"
>
> For a new target it seems much better to define your ABI to use a name in
> the reserved namespace for this - that is, starting with two underscores.

I've changed it to use "_mcount" with one underscore.  That seems to be 
what glibc support by default, and it's consistent with x86, and we'd 
prefer to be consistent with x86 whenever possible.

> > +/* For __clear_cache in libgcc2.c.  */
> > +#ifdef IN_LIBGCC2
> > +
> > +#include <arch/icache.h>
>
> Where does this header come from?  Linux kernel, glibc, somewhere else?
> In general you want to condition header includes on inhibit_libc to
> facilitate bootstrapping (including building a partial static libgcc)
> before the libc headers are installed, since configuring glibc to install
> its headers requires a working compiler to run configure tests.

We plan to include this as part of the Linux kernel, as the kernel 
itself depends on it.

> > diff -r -u -p -N /home/packages/gcc-4.7.0-179959/gcc/config/tilegx/mul_tables.c ./gcc/config/tilegx/mul_tables.c
> > --- /home/packages/gcc-4.7.0-179959/gcc/config/tilegx/mul_tables.c    1969-12-31 19:00:00.000000000 -0500
> > +++ ./gcc/config/tilegx/mul_tables.c  2011-10-14 18:14:11.524757000 -0400
> > @@ -0,0 +1,19853 @@
>
> Are you really sure that this 19853-line file is source code - "the
> preferred form of the work for making modifications to it"?  How was it
> written?

I've included the source code from which the tables are generated, and 
I've updated the makefiles with rules to generate the tables.  The 
script takes a minute to run, so I'd prefer not to generate it for every 
build, so I've kept the generated taables as part of the patch and 
updated the gcc_update script accordingly.

> You should also verify that if you build the compiler using a current
> trunk compiler as your starting point, it passes a
> --enable-werror-always build as both C and C++

I've verified this condition using the config-list.mk script.

Thanks,

Walter

	* config.gcc: Handle tilegx and tilepro.
	* configure.ac (gcc_cv_as_dwarf2_debug_line): Enable test for
	tilegx and tilepro.
	Add HAVE_AS_TLS check for tilegx and tilepro.
	* configure: Regenerate.
	* doc/contrib.texi: Add Mat Hostetter and self.
	* doc/extend.texi (TILE-Gx Built-in Functions): New node.
	Document instruction intrinsics and network accessing intrinsics.
	(TILEPro Built-in Functions): New node.  Document instruction
	intrinsics and network accessing intrinsics.
	* doc/install.texi (Specific, tilegx-*-linux*): Document it.
	(Specific, tilepro-*-linux*): Likewise.
	* doc/invoke.texi (TILE-Gx Options): New section.
	(TILEPro Options): New section.
	* doc/md.texi (TILE-Gx): New section.
	(TILEPro): New section.
	* common/config/tilegx/tilegx-common.c: New file.
	* common/config/tilepro/tilepro-common.c: New file.
	* config/tilegx/constraints.md: New file.
	* config/tilegx/linux.h: New file.
	* config/tilegx/mul-tables.c: New file.
	* config/tilegx/predicates.md: New file.
	* config/tilegx/sync.md: New file.
	* config/tilegx/t-tilegx: New file.
	* config/tilegx/tilegx-builtins.h: New file.
	* config/tilegx/tilegx-c.c: New file.
	* config/tilegx/tilegx-generic.md: New file.
	* config/tilegx/tilegx-modes.def: New file.
	* config/tilegx/tilegx-multiply.h: New file.
	* config/tilegx/tilegx-protos.h: New file.
	* config/tilegx/tilegx.c: New file.
	* config/tilegx/tilegx.h: New file.
	* config/tilegx/tilegx.md: New file.
	* config/tilegx/tilegx.opt: New file.
	* config/tilepro/constraints.md: New file.
	* config/tilepro/gen-mul-tables.cc: New file.
	* config/tilepro/linux.h: New file.
	* config/tilepro/mul-tables.c: New file.
	* config/tilepro/predicates.md: New file.
	* config/tilepro/t-tilepro: New file.
	* config/tilepro/tilepro-builtins.h: New file.
	* config/tilepro/tilepro-c.c: New file.
	* config/tilepro/tilepro-generic.md: New file.
	* config/tilepro/tilepro-modes.def: New file.
	* config/tilepro/tilepro-multiply.h: New file.
	* config/tilepro/tilepro-protos.h: New file.
	* config/tilepro/tilepro.c: New file.
	* config/tilepro/tilepro.h: New file.
	* config/tilepro/tilepro.md: New file.
	* config/tilepro/tilepro.opt: New file.

The gcc testsuite change is the same as before.

	* testsuite/gcc.dg/20020312-2.c: Add a condition for
	__tile__.
Joseph S. Myers - Oct. 20, 2011, 8:07 p.m.
On Thu, 20 Oct 2011, Walter Lee wrote:

> > > +#undef MCOUNT_NAME
> > > +#define MCOUNT_NAME "mcount"
> > 
> > For a new target it seems much better to define your ABI to use a name in
> > the reserved namespace for this - that is, starting with two underscores.
> 
> I've changed it to use "_mcount" with one underscore.  That seems to be what
> glibc support by default, and it's consistent with x86, and we'd prefer to be
> consistent with x86 whenever possible.

x86 also has a newer version __fentry__ with -mfentry.  ARM has mcount and 
__gnu_mcount_nc.  I don't think consistency with the old x86 _mcount is 
particularly desirable.

> > > +/* For __clear_cache in libgcc2.c.  */
> > > +#ifdef IN_LIBGCC2
> > > +
> > > +#include <arch/icache.h>
> > 
> > Where does this header come from?  Linux kernel, glibc, somewhere else?
> > In general you want to condition header includes on inhibit_libc to
> > facilitate bootstrapping (including building a partial static libgcc)
> > before the libc headers are installed, since configuring glibc to install
> > its headers requires a working compiler to run configure tests.
> 
> We plan to include this as part of the Linux kernel, as the kernel itself
> depends on it.

So "make headers_install" for your architectures will install this header 
under than name?
Walter Lee - Oct. 23, 2011, 10:02 a.m.
On 10/20/2011 4:07 PM, Joseph S. Myers wrote:
> x86 also has a newer version __fentry__ with -mfentry.  ARM has mcount and 
> __gnu_mcount_nc.  I don't think consistency with the old x86 _mcount is 
> particularly desirable.

Ok attached is a new patch that uses "__mcount."

>> We plan to include this as part of the Linux kernel, as the kernel itself
>> depends on it.
> 
> So "make headers_install" for your architectures will install this header 
> under than name?

Yes.  We've made that change in linux and will be pushing that change upstream
shortly.

Walter

	
	* config.gcc: Handle tilegx and tilepro.
	* configure.ac (gcc_cv_as_dwarf2_debug_line): Enable test for
	tilegx and tilepro.
	Add HAVE_AS_TLS check for tilegx and tilepro.
	* configure: Regenerate.
	* doc/contrib.texi: Add Mat Hostetter and self.
	* doc/extend.texi (TILE-Gx Built-in Functions): New node.
	Document instruction intrinsics and network accessing intrinsics.
	(TILEPro Built-in Functions): New node.  Document instruction
	intrinsics and network accessing intrinsics.
	* doc/install.texi (Specific, tilegx-*-linux*): Document it.
	(Specific, tilepro-*-linux*): Likewise.
	* doc/invoke.texi (TILE-Gx Options): New section.
	(TILEPro Options): New section.
	* doc/md.texi (TILE-Gx): New section.
	(TILEPro): New section.
	* common/config/tilegx/tilegx-common.c: New file.
	* common/config/tilepro/tilepro-common.c: New file.
	* config/tilegx/constraints.md: New file.
	* config/tilegx/linux.h: New file.
	* config/tilegx/mul-tables.c: New file.
	* config/tilegx/predicates.md: New file.
	* config/tilegx/sync.md: New file.
	* config/tilegx/t-tilegx: New file.
	* config/tilegx/tilegx-builtins.h: New file.
	* config/tilegx/tilegx-c.c: New file.
	* config/tilegx/tilegx-generic.md: New file.
	* config/tilegx/tilegx-modes.def: New file.
	* config/tilegx/tilegx-multiply.h: New file.
	* config/tilegx/tilegx-protos.h: New file.
	* config/tilegx/tilegx.c: New file.
	* config/tilegx/tilegx.h: New file.
	* config/tilegx/tilegx.md: New file.
	* config/tilegx/tilegx.opt: New file.
	* config/tilepro/constraints.md: New file.
	* config/tilepro/gen-mul-tables.cc: New file.
	* config/tilepro/linux.h: New file.
	* config/tilepro/mul-tables.c: New file.
	* config/tilepro/predicates.md: New file.
	* config/tilepro/t-tilepro: New file.
	* config/tilepro/tilepro-builtins.h: New file.
	* config/tilepro/tilepro-c.c: New file.
	* config/tilepro/tilepro-generic.md: New file.
	* config/tilepro/tilepro-modes.def: New file.
	* config/tilepro/tilepro-multiply.h: New file.
	* config/tilepro/tilepro-protos.h: New file.
	* config/tilepro/tilepro.c: New file.
	* config/tilepro/tilepro.h: New file.
	* config/tilepro/tilepro.md: New file.
	* config/tilepro/tilepro.opt: New file.

Patch

diff -r -u -p -N /home/packages/gcc-4.7.0-180241/gcc/testsuite/gcc.dg/20020312-2.c ./gcc/testsuite/gcc.dg/20020312-2.c
--- /home/packages/gcc-4.7.0-180241/gcc/testsuite/gcc.dg/20020312-2.c	2011-10-14 00:57:27.000000000 -0400
+++ ./gcc/testsuite/gcc.dg/20020312-2.c	2011-10-20 10:23:51.377473000 -0400
@@ -64,6 +64,8 @@  extern void abort (void);
 # define PIC_REG  "12"
 #elif defined(__sparc__)
 # define PIC_REG  "l7"
+#elif defined(__tile__)
+# define PIC_REG "r51"
 #elif defined(__TMS320C6X__)
 # define PIC_REG "B14"
 #elif defined(__v850)