This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Adding SH support to glibc-2.2


Hi,

Here's a patch for current libc to support new sh-linux-gnu target for
Linux on Hitachi SH processors. This is a part of patch for non SH-specific
files.
We need the second diff for csu/Makefile to get cststuff routines directly.
This is needed because we couldn't use generated files.   The constant (for
label) is emitted far away than expected by the generation, after the function
epilogue. The third diff adds the relocation types for SH ELF. The relocation
types from R_SH_GOT32 to R_SH_GOTPC are newly added under the consensus with
Hitachi and we use them in adding PIC support to binutils for SH target.
--
	Kazumoto Kojima


2000-06-12  Kazumoto Kojima  <kkojima@rr.iij4u.or.jp>
	    Yutaka Niibe  <gniibe@chroot.org>

	* configure.in: Add machine sh3, sh4.
	* csu/Makefile: Add new variable crts-predefined whose non-zero
	value means to generate crt[in].o from system dependent predefined
	crt[in].S instead of initfini.c.
	* elf/elf.h: Add SH specific declarations of relocations.
	* shlib-versions: Add sh*-*-linux* case. 

diff -urN glibc-original/configure.in glibc/configure.in
--- glibc-original/configure.in	Thu May 25 00:51:39 2000
+++ glibc/configure.in	Sun Jun 11 20:30:31 2000
@@ -277,6 +277,8 @@
 		IP22) machine=mips/mips3 ;;
 		*)    machine=mips/$machine ;;
 		esac ;;
+sh3*)		base_machine=sh machine=sh/sh3 ;;
+sh4*)		base_machine=sh machine=sh/sh4 ;;
 sparc | sparcv[67])
 		base_machine=sparc machine=sparc/sparc32 ;;
 sparcv8 | supersparc | hypersparc)
diff -urN glibc-original/csu/Makefile glibc/csu/Makefile
--- glibc-original/csu/Makefile	Fri May 26 00:51:12 2000
+++ glibc/csu/Makefile	Sun Jun 11 20:30:32 2000
@@ -76,12 +76,19 @@
 
 install-lib += $(crtstuff:=.o)
 extra-objs += $(crtstuff:=.o)
+ifneq (yes,$(crts-predefined))
 generated += $(crtstuff:=.S) initfini.s defs.h
 omit-deps += $(crtstuff)
 
 # Special rules for the building of crti.o and crtn.o
 $(objpfx)crt%.o: $(objpfx)crt%.S $(objpfx)defs.h
 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
+else
+generated += initfini.s defs.h
+
+$(objpfx)crti.o: $(objpfx)defs.h
+$(objpfx)crtn.o: $(objpfx)defs.h
+endif
 
 CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions
 
@@ -93,6 +100,7 @@
 
 # We only have one kind of startup code files.  Static binaries and
 # shared libraries are build using the PIC version.
+ifneq (yes,$(crts-predefined))
 $(objpfx)crti.S: $(objpfx)initfini.s
 	sed -n -e '1,/@HEADER_ENDS/p' \
 	       -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
@@ -102,6 +110,7 @@
 	sed -n -e '1,/@HEADER_ENDS/p' \
 	       -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
 	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
+endif
 
 $(objpfx)defs.h: $(objpfx)initfini.s
 	sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
diff -urN glibc-original/elf/elf.h glibc/elf/elf.h
--- glibc-original/elf/elf.h	Mon Jun  5 00:51:54 2000
+++ glibc/elf/elf.h	Sun Jun 11 20:30:32 2000
@@ -1874,6 +1874,41 @@
 #define R_IA64_LTOFF22X		0x86	/* LTOFF22, relaxable.  */
 #define R_IA64_LDXMOV		0x87	/* Use of LTOFF22X.  */
 
+/* SH specific declarations */
+
+/* SH relocs.  */
+#define	R_SH_NONE		0
+#define	R_SH_DIR32		1
+#define	R_SH_REL32		2
+#define	R_SH_DIR8WPN		3
+#define	R_SH_IND12W		4
+#define	R_SH_DIR8WPL		5
+#define	R_SH_DIR8WPZ		6
+#define	R_SH_DIR8BP		7
+#define	R_SH_DIR8W		8
+#define	R_SH_DIR8L		9
+#define	R_SH_SWITCH16		25
+#define	R_SH_SWITCH32		26
+#define	R_SH_USES		27
+#define	R_SH_COUNT		28
+#define	R_SH_ALIGN		29
+#define	R_SH_CODE		30
+#define	R_SH_DATA		31
+#define	R_SH_LABEL		32
+#define	R_SH_SWITCH8		33
+#define	R_SH_GNU_VTINHERIT	34
+#define	R_SH_GNU_VTENTRY	35
+#define	R_SH_GOT32		160
+#define	R_SH_PLT32		161
+#define	R_SH_COPY		162
+#define	R_SH_GLOB_DAT		163
+#define	R_SH_JMP_SLOT		164
+#define	R_SH_RELATIVE		165
+#define	R_SH_GOTOFF		166
+#define	R_SH_GOTPC		167
+/* Keep this the last entry.  */
+#define	R_SH_NUM		256
+
 __END_DECLS
 
 #endif	/* elf.h */
diff -urN glibc-original/shlib-versions glibc/shlib-versions
--- glibc-original/shlib-versions	Sat Apr 29 00:51:06 2000
+++ glibc/shlib-versions	Sun Jun 11 20:30:32 2000
@@ -27,6 +27,7 @@
 mips.*-.*-.*		libm=6
 arm.*-.*-.*		libm=6
 ia64-.*-.*		libm=6			GLIBC_2.2
+sh.*-.*-.*		libm=6
 
 # We provide libc.so.6 for Linux kernel versions 2.0 and later.
 alpha.*-.*-linux.*	libc=6.1
@@ -54,6 +55,7 @@
 sparc.*-.*-linux.*	ld=ld-linux.so.2
 alpha.*-.*-linux.*	ld=ld-linux.so.2
 arm.*-.*-linux.*	ld=ld-linux.so.2
+sh.*-.*-linux.*		ld=ld-linux.so.2
 ia64-.*-linux.*		ld=ld-linux-ia64.so.1	GLIBC_2.2
 mips.*-.*-linux.*	ld=ld.so.1		GLIBC_2.0 GLIBC_2.2
 # We use the ELF ABI standard name for the default.


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