Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Apr 2009 22:54:35 GMT
From:      Arnar Mar Sig <antab@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 160838 for review
Message-ID:  <200904192254.n3JMsZ9v019601@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=160838

Change 160838 by antab@antab_farm on 2009/04/19 22:54:06

	* Fix bug in avr32 binutils bfd related to linker relaxing
	* Add avr32 gcc patches for shared libgcc
	* Add LIB1ASM* to libgcc makefile
	* Add syscall stubs to libc

Affected files ...

.. //depot/projects/avr32/src/contrib/binutils/bfd/elf32-avr32.c#2 edit
.. //depot/projects/avr32/src/contrib/gcc/config.gcc#3 edit
.. //depot/projects/avr32/src/contrib/gcc/config/avr32/avr32.h#2 edit
.. //depot/projects/avr32/src/contrib/gcc/config/avr32/freebsd.h#5 edit
.. //depot/projects/avr32/src/contrib/gcc/config/avr32/libgcc-avr32.ver#1 add
.. //depot/projects/avr32/src/contrib/gcc/config/avr32/t-avr32#2 edit
.. //depot/projects/avr32/src/gnu/lib/libgcc/Makefile#3 edit
.. //depot/projects/avr32/src/lib/libc/Makefile#3 edit
.. //depot/projects/avr32/src/lib/libc/avr32/SYS.h#2 edit
.. //depot/projects/avr32/src/lib/libc/avr32/Symbol.map#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/Makefile.inc#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/_ctx_start.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/_set_tp.c#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/_setjmp.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/alloca.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/fabs.c#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/infinity.c#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/makecontext.c#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/modf.c#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/setjmp.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/signalcontext.c#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/gen/sigsetjmp.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/softfloat/avr32-gcc.h#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/softfloat/milieu.h#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/softfloat/softfloat.h#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/stdlib/Makefile.inc#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/sys/Makefile.inc#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/sys/Ovfork.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/sys/brk.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/sys/cerror.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/sys/pipe.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/sys/ptrace.S#1 add
.. //depot/projects/avr32/src/lib/libc/avr32/sys/sbrk.S#1 add
.. //depot/projects/avr32/src/sys/avr32/include/asm.h#3 edit
.. //depot/projects/avr32/src/sys/avr32/include/ieee.h#1 add
.. //depot/projects/avr32/src/sys/avr32/include/sigframe.h#1 add

Differences ...

==== //depot/projects/avr32/src/contrib/binutils/bfd/elf32-avr32.c#2 (text+ko) ====

@@ -1332,7 +1332,6 @@
 retrieve_contents (bfd *abfd, asection *sec, bfd_boolean keep_memory)
 {
   bfd_byte *contents;
-  bfd_byte *buffer;
   bfd_size_type sec_size;
   bfd_size_type sz;
 
@@ -1342,16 +1341,18 @@
 
   if (contents == NULL && sec_size != 0)
     {
-        sz = sec->_raw_size ? sec->_raw_size : sec->_cooked_size;
-        if (sz == 0)
-          return NULL;
+      sz = (sec->_raw_size > sec->_cooked_size) ? sec->_raw_size : sec->_cooked_size;
+      if (sz == 0)
+        return NULL;
 
-        buffer = bfd_malloc (sz);
+      contents = bfd_malloc (sz);
+      if (contents == NULL)
+	return NULL;
 
-      if (! bfd_get_section_contents (abfd, sec, buffer, (file_ptr) 0, sz))
+      if (! bfd_get_section_contents (abfd, sec, contents, (file_ptr) 0, sz))
         {
-	  if (buffer)
-	    free (buffer);
+	  if (contents)
+	    free (contents);
 	  return NULL;
 	}
       if (keep_memory)

==== //depot/projects/avr32/src/contrib/gcc/config.gcc#3 (text+ko) ====

@@ -783,21 +783,26 @@
 	use_fixproto=yes
 	;;
 avr32*-*-linux*)
-    tm_file="dbxelf.h elfos.h linux.h avr32/linux-elf.h avr32/avr32.h "
-    tmake_file="t-linux avr32/t-avr32 avr32/t-elf"
+	tm_file="dbxelf.h elfos.h linux.h avr32/linux-elf.h avr32/avr32.h "
+	tmake_file="${tmake_file} t-linux avr32/t-avr32 avr32/t-elf"
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
 	extra_modes=avr32/avr32-modes.def
 	gnu_ld=yes
 	;;
 avr32*-*-uclinux*)
 	tm_file="dbxelf.h elfos.h linux.h avr32/linux-elf.h avr32/uclinux-elf.h avr32/avr32.h"
-	tmake_file="t-linux avr32/t-avr32 avr32/t-elf"
+	tmake_file="${tmake_file} t-linux avr32/t-avr32 avr32/t-elf"
 	extra_modes=avr32/avr32-modes.def
 	gnu_ld=yes
 	;;
+avr32*-*-freebsd*)
+	tm_file="dbxelf.h elfos.h ${fbsd_tm_file} avr32/freebsd.h avr32/avr32.h"
+	tmake_file="${tmake_file} avr32/t-avr32 avr32/t-elf"
+	extra_modes=avr32/avr32-modes.def
+	;;
 avr32-*-*)
-    tm_file="dbxelf.h elfos.h avr32/avr32.h avr32/avr32-elf.h"
-    tmake_file="avr32/t-avr32 avr32/t-elf"
+	tm_file="dbxelf.h elfos.h avr32/avr32.h avr32/avr32-elf.h"
+	tmake_file="${tmake_file} avr32/t-avr32 avr32/t-elf"
 	extra_modes=avr32/avr32-modes.def
 	;;
 bfin*-elf*)

==== //depot/projects/avr32/src/contrib/gcc/config/avr32/avr32.h#2 (text+ko) ====

@@ -3294,11 +3294,18 @@
 
 #define RENAME_LIBRARY_SET ".set"
 
+#ifdef HIDE_EXPORTS
+/* Make ABI_NAME an alias for __GCC_NAME.  */
+#define RENAME_LIBRARY(GCC_NAME, ABI_NAME)		\
+  __asm__ (".hidden\t__avr32_" #ABI_NAME "\n"	\
+		   ".globl\t__avr32_" #ABI_NAME "\n"	\
+	       ".set\t__avr32_" #ABI_NAME ", __" #GCC_NAME "\n");
+#else
 /* Make ABI_NAME an alias for __GCC_NAME.  */
 #define RENAME_LIBRARY(GCC_NAME, ABI_NAME)		\
-  __asm__ (".globl\t__avr32_" #ABI_NAME "\n"		\
-	   ".set\t__avr32_" #ABI_NAME 	\
-	     ", __" #GCC_NAME "\n");
+  __asm__ (".globl\t__avr32_" #ABI_NAME "\n"	\
+	       ".set\t__avr32_" #ABI_NAME ", __" #GCC_NAME "\n");
+#endif
 
 /* Give libgcc functions avr32 ABI name.  */
 #ifdef L_muldi3

==== //depot/projects/avr32/src/contrib/gcc/config/avr32/freebsd.h#5 (text+ko) ====


==== //depot/projects/avr32/src/contrib/gcc/config/avr32/t-avr32#2 (text+ko) ====

@@ -73,5 +73,4 @@
 dp-bit.c: $(srcdir)/config/fp-bit.c
 	cat $(srcdir)/config/fp-bit.c > dp-bit.c
 
-
-
+SHLIB_MAPFILES += $(srcdir)/config/avr32/libgcc-avr32.ver

==== //depot/projects/avr32/src/gnu/lib/libgcc/Makefile#3 (text+ko) ====

@@ -109,6 +109,19 @@
 #	_fixsfsi _fixunssfsi _floatdidf _floatdisf
 .endif
 
+.if ${TARGET_ARCH} == "avr32"
+CFLAGS+= -mrelax
+LIB1ASMSRC = lib1funcs.S
+LIB1ASMFUNCS = _avr32_f64_mul _avr32_f64_mul_fast \
+	_avr32_f64_addsub _avr32_f64_addsub_fast _avr32_f64_to_u32 \
+	_avr32_f64_to_s32 _avr32_f64_to_u64 _avr32_f64_to_s64 _avr32_u32_to_f64 \
+	_avr32_s32_to_f64 _avr32_f64_cmp_eq _avr32_f64_cmp_ge _avr32_f64_cmp_lt \
+	_avr32_f32_cmp_eq _avr32_f32_cmp_ge _avr32_f32_cmp_lt _avr32_f64_div _avr32_f64_div_fast \
+	_avr32_f32_div _avr32_f32_div_fast _avr32_f32_addsub _avr32_f32_addsub_fast \
+	_avr32_f32_mul _avr32_s32_to_f32 _avr32_u32_to_f32 _avr32_f32_to_s32 \
+	_avr32_f32_to_u32 _avr32_f32_to_f64 _avr32_f64_to_f32 _mulsi3
+.endif
+
 .if ${TARGET_ARCH} == "ia64"
 #	from config/ia64/t-ia64
 LIB1ASMSRC   = lib1funcs.asm
@@ -174,7 +187,8 @@
 # Floating point emulation functions
 #
 .if ${TARGET_ARCH} == "armNOT_YET" || ${TARGET_ARCH} == "mips" || \
-    ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
+    ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64" || \
+	${TARGET_ARCH} == 'avr32'
 
 FPBIT_CFLAGS =	-DFINE_GRAINED_LIBRARIES -DFLOAT
 DPBIT_CFLAGS =	-DFINE_GRAINED_LIBRARIES

==== //depot/projects/avr32/src/lib/libc/Makefile#3 (text+ko) ====

@@ -64,7 +64,8 @@
 .include "${.CURDIR}/rpc/Makefile.inc"
 .include "${.CURDIR}/uuid/Makefile.inc"
 .include "${.CURDIR}/xdr/Makefile.inc"
-.if ${MACHINE_ARCH} == "arm"
+.if ${MACHINE_ARCH} == "arm" || \
+	${MACHINE_ARCH} == "avr32"
 .include "${.CURDIR}/softfloat/Makefile.inc"
 .endif
 .if ${MK_NIS} != "no"

==== //depot/projects/avr32/src/lib/libc/avr32/SYS.h#2 (text+ko) ====

@@ -1,11 +1,16 @@
 #include <sys/syscall.h>
 #include <machine/asm.h>
 
-/* TODO: Implement this */
+#define	RSYSCALL(x)													\
+	PSEUDO(x)
 
-#define	RSYSCALL(x)							\
-	PSEUDO(x)
+#define	PSEUDO(x)													\
+	ENTRY(__CONCAT(__sys_, x));										\
+	.weak _C_LABEL(x);												\
+	.set _C_LABEL(x), _C_LABEL(__CONCAT(__sys_,x));					\
+	.weak _C_LABEL(__CONCAT(_,x));									\
+	.set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x));		\
+	SCALL(x);														\
+	retal	sp;														\
+	END(__CONCAT(__sys_, x))
 
-#define	PSEUDO(x)							\
-	ENTRY(__sys_ ## x);						\
-	END(__sys_ ## x)

==== //depot/projects/avr32/src/sys/avr32/include/asm.h#3 (text+ko) ====

@@ -59,4 +59,16 @@
 #define __FBSDID(s)	/* nothing */
 #endif /* not lint and not STRIP_FBSDID */
 
+#define _C_LABEL(x) x
+
+/**
+ * Do syscall and pass the syscall number in thru r8
+ */
+#define SCALL(name)													\
+	breakpoint;														\
+	stm		--sp, r8;												\
+	mov		r8, SYS_ ## name;										\
+	scall;															\
+	sub		sp, -4
+
 #endif /* !_MACHINE_ASM_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904192254.n3JMsZ9v019601>