This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] Altera Nios II: libgcc


On Thu, 18 Apr 2013, Chung-Lin Tang wrote:

> +nios2-*-linux*)
> +	tmake_file="$tmake_file nios2/t-nios2 nios2/t-linux t-libgcc-pic t-slibgcc-libgcc"
> +	extra_parts="$extra_parts crti.o crtn.o"
> +	md_unwind_header=nios2/linux-unwind.h
> +	;;
> +nios2-*-*)
> +	tmake_file="$tmake_file nios2/t-nios2 t-fdpbit"
> +	extra_parts="$extra_parts crti.o crtn.o"
> +	;;

As I understand it, the port uses soft-fp in glibc so doesn't need it in 
libgcc for nios2-*-linux*.  But why use the old fp-bit in libgcc for bare 
metal (use of t-fdpbit here), rather than soft-fp?

> Index: libgcc/config/nios2/lib2-nios2.h
> ===================================================================
> --- libgcc/config/nios2/lib2-nios2.h	(revision 0)
> +++ libgcc/config/nios2/lib2-nios2.h	(revision 409063)
> @@ -0,0 +1,49 @@
> +/* Integer arithmetic support for Altera Nios II.
> +   
> +   Copyright (C) 2012 Free Software Foundation, Inc.

GCC now uses copyright year ranges <year>-2013 everywhere, automatically 
updated in all files at the start of the year.  So a single range 
<year>-2013 should be used in all new files in all patches for this port.

> +/* Kernel helper for compare-and-exchange a 32-bit value.  */
> +static inline long
> +__kernel_cmpxchg (int oldval, int newval, int *mem)
> +{
> +  register int r2 asm ("r2") = __NR_nios2cmpxchg;
> +  register unsigned long lws_mem asm("r4") = (unsigned long) (mem);
> +  register int lws_old asm("r5") = oldval;
> +  register int lws_new asm("r6") = newval;
> +  register int err asm ("r7");

Consistently use a space between "asm" and '('; you're missing some here.

> +      if(__builtin_expect (r2 == EFAULT || r2 == ENOSYS,0))

Space between "if" and '('.  You may want to check the patches more 
generally for such missing spaces before '('....

> Index: libgcc/config/nios2/t-nios2
> ===================================================================
> --- libgcc/config/nios2/t-nios2	(revision 0)
> +++ libgcc/config/nios2/t-nios2	(revision 409063)
> @@ -0,0 +1,18 @@
> +LIB2ADD += $(srcdir)/config/nios2/lib2-divmod.c \
> +	   $(srcdir)/config/nios2/lib2-divmod-hi.c \
> +	   $(srcdir)/config/nios2/lib2-divtable.c \
> +	   $(srcdir)/config/nios2/lib2-mul.c \
> +	   $(srcdir)/config/nios2/tramp.c
> +
> +# We have some non *.S named assembly files
> +CUSTOM_CRTIN = yes

But why the special naming?  No other architecture has .asm files in 
libgcc so I think you should just name them *.S and then eliminate special 
rules as far as possible.

> +#ifdef linux

Use __linux__ rather than legacy user-namespace predefines.

> +void __trampoline_setup (unsigned int *addr,

Return type on separate line from function name.

> +			 void *fnptr,
> +			 void *chainptr)
> +{
> +  unsigned int fn = (unsigned int)fnptr;
> +  unsigned int chain = (unsigned int)chainptr;

Missing spaces in casts.

> +	.file	"crtn.asm"

Such .file directives in libgcc assembly sources should generally be 
avoided; see <http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00123.html> for 
rationale.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]