Xtensa support for uClibc [1/9]

Chris Zankel chris at zankel.net
Thu Dec 6 20:49:37 UTC 2007


Hi,

The following patches add support for the Xtensa processor architecture
to uClibc. They are based on a recent SVN checkout (12/05/2007).

The first patch (attached to this post) adds Xtensa support to various
shared configuration and make files. The following patches then include
the Xtensa specific files and directories.

I welcome any feedback and would appreciate it if you could include the
patches into the mainline tree. I am certainly committed to maintain the port. 

Bob Wilson was kind enough to review the patches.

Some notes about the architecture: Xtensa is a configurable and
extensible processor architecture developed by Tensilica. For more
information, please visit: www.linux-xtensa.org.

Thanks
-Chris

---

diff -Nurd uClibc-0.9.29.orig/Rules.mak uClibc-0.9.29/Rules.mak
--- uClibc-0.9.29.orig/Rules.mak	2007-12-05 13:28:19.515972000 -0800
+++ uClibc-0.9.29/Rules.mak	2007-12-05 14:04:52.126164000 -0800
@@ -50,7 +50,8 @@
 export ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun.*/sparc/ -e s/sparc.*/sparc/ \
 				  -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh.*/sh/ \
 				  -e s/s390x/s390/ -e s/parisc.*/hppa/ \
-				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
+				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
+				  -e s/xtensa.*/xtensa/ )
 
 
 #---------------------------------------------------------
diff -Nurd uClibc-0.9.29.orig/extra/Configs/Config.in uClibc-0.9.29/extra/Configs/Config.in
--- uClibc-0.9.29.orig/extra/Configs/Config.in	2007-11-19 16:38:30.393414000 -0800
+++ uClibc-0.9.29/extra/Configs/Config.in	2007-12-05 14:04:52.209086000 -0800
@@ -82,6 +82,9 @@
 config TARGET_x86_64
 	bool "x86_64"
 
+config TARGET_xtensa
+	bool "xtensa"
+
 endchoice
 
 
@@ -183,6 +186,10 @@
 source "extra/Configs/Config.x86_64"
 endif
 
+if TARGET_xtensa
+source "extra/Configs/Config.xtensa"
+endif
+
 config TARGET_SUBARCH
 	string
 	default "e500" if CONFIG_E500
diff -Nurd uClibc-0.9.29.orig/extra/Configs/Config.xtensa uClibc-0.9.29/extra/Configs/Config.xtensa
--- uClibc-0.9.29.orig/extra/Configs/Config.xtensa	1969-12-31 16:00:00.000000000 -0800
+++ uClibc-0.9.29/extra/Configs/Config.xtensa	2007-12-05 14:04:52.278023000 -0800
@@ -0,0 +1,12 @@
+#
+# For a description of the syntax of this configuration file,
+# see extra/config/kconfig-language.txt
+#
+
+config TARGET_ARCH
+	string
+	default "xtensa"
+
+config ARCH_CFLAGS
+	string
+
diff -Nurd uClibc-0.9.29.orig/ldso/include/dl-string.h uClibc-0.9.29/ldso/include/dl-string.h
--- uClibc-0.9.29.orig/ldso/include/dl-string.h	2007-11-19 16:38:40.647151000 -0800
+++ uClibc-0.9.29/ldso/include/dl-string.h	2007-12-05 14:06:03.570648000 -0800
@@ -286,7 +286,7 @@
  * This requires that load_addr must already be defined... */
 #if defined(mc68000)  || defined(__arm__) || defined(__thumb__) || \
     defined(__mips__) || defined(__sh__)  || defined(__powerpc__) || \
-       defined(__avr32__)
+	defined(__avr32__) || defined(__xtensa__)
 # define CONSTANT_STRING_GOT_FIXUP(X) \
 	if ((X) < (const char *) load_addr) (X) += load_addr
 # define NO_EARLY_SEND_STDERR
diff -Nurd uClibc-0.9.29.orig/test/Rules.mak uClibc-0.9.29/test/Rules.mak
--- uClibc-0.9.29.orig/test/Rules.mak	2007-11-19 16:38:13.085739000 -0800
+++ uClibc-0.9.29/test/Rules.mak	2007-12-05 14:04:52.446847000 -0800
@@ -39,6 +39,7 @@
 	-e 's/sh[234]/sh/' \
 	-e 's/mips.*/mips/' \
 	-e 's/cris.*/cris/' \
+	-e 's/xtensa.*/xtensa/' \
 	)
 endif
 export TARGET_ARCH
diff -Nurd uClibc-0.9.29.orig/include/elf.h uClibc-0.9.29/include/elf.h
--- uClibc-0.9.29.orig/include/elf.h	2006-11-16 22:51:34.000000000 -0800
+++ uClibc-0.9.29/include/elf.h	2007-12-04 11:38:00.000000000 -0800
@@ -2976,6 +2976,64 @@
 /* Keep this the last entry.  */
 #define R_NIOS2_NUM				22
 
+/* Xtensa-specific declarations */
+
+/* Xtensa values for the Dyn d_tag field.  */
+#define DT_XTENSA_GOT_LOC_OFF	(DT_LOPROC + 0)
+#define DT_XTENSA_GOT_LOC_SZ	(DT_LOPROC + 1)
+#define DT_XTENSA_NUM		2
+
+/* Xtensa relocations.  */
+#define R_XTENSA_NONE		0
+#define R_XTENSA_32		1
+#define R_XTENSA_RTLD		2
+#define R_XTENSA_GLOB_DAT	3
+#define R_XTENSA_JMP_SLOT	4
+#define R_XTENSA_RELATIVE	5
+#define R_XTENSA_PLT		6
+#define R_XTENSA_OP0		8
+#define R_XTENSA_OP1		9
+#define R_XTENSA_OP2		10
+#define R_XTENSA_ASM_EXPAND	11
+#define R_XTENSA_ASM_SIMPLIFY	12
+#define R_XTENSA_GNU_VTINHERIT	15
+#define R_XTENSA_GNU_VTENTRY	16
+#define R_XTENSA_DIFF8		17
+#define R_XTENSA_DIFF16		18
+#define R_XTENSA_DIFF32		19
+#define R_XTENSA_SLOT0_OP	20
+#define R_XTENSA_SLOT1_OP	21
+#define R_XTENSA_SLOT2_OP	22
+#define R_XTENSA_SLOT3_OP	23
+#define R_XTENSA_SLOT4_OP	24
+#define R_XTENSA_SLOT5_OP	25
+#define R_XTENSA_SLOT6_OP	26
+#define R_XTENSA_SLOT7_OP	27
+#define R_XTENSA_SLOT8_OP	28
+#define R_XTENSA_SLOT9_OP	29
+#define R_XTENSA_SLOT10_OP	30
+#define R_XTENSA_SLOT11_OP	31
+#define R_XTENSA_SLOT12_OP	32
+#define R_XTENSA_SLOT13_OP	33
+#define R_XTENSA_SLOT14_OP	34
+#define R_XTENSA_SLOT0_ALT	35
+#define R_XTENSA_SLOT1_ALT	36
+#define R_XTENSA_SLOT2_ALT	37
+#define R_XTENSA_SLOT3_ALT	38
+#define R_XTENSA_SLOT4_ALT	39
+#define R_XTENSA_SLOT5_ALT	40
+#define R_XTENSA_SLOT6_ALT	41
+#define R_XTENSA_SLOT7_ALT	42
+#define R_XTENSA_SLOT8_ALT	43
+#define R_XTENSA_SLOT9_ALT	44
+#define R_XTENSA_SLOT10_ALT	45
+#define R_XTENSA_SLOT11_ALT	46
+#define R_XTENSA_SLOT12_ALT	47
+#define R_XTENSA_SLOT13_ALT	48
+#define R_XTENSA_SLOT14_ALT	49
+/* Keep this the last entry.  */
+#define R_XTENSA_NUM		50
+
 __END_DECLS
 
 #endif	/* elf.h */



More information about the uClibc mailing list