summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-01-08 08:44:43 +0000
committerPaul Mundt <lethal@linux-sh.org>2008-01-08 08:44:43 +0000
commitb20e5adb661f95f639324b252a3028ac0abeca2f (patch)
tree19a5b2c0ae734b93029a80263afa486d7376cb02
parentb4937a448bcd897c84de6abb36c39eff492a2b91 (diff)
Bring sh64 support back from the dead.
-rw-r--r--libc/sysdeps/linux/sh64/Makefile61
-rw-r--r--libc/sysdeps/linux/sh64/Makefile.arch12
-rw-r--r--libc/sysdeps/linux/sh64/__longjmp.S (renamed from libc/sysdeps/linux/sh64/longjmp.S)17
-rw-r--r--libc/sysdeps/linux/sh64/bits/stackinfo.h28
-rw-r--r--libc/sysdeps/linux/sh64/crt1.S (renamed from libc/sysdeps/linux/sh64/crt0.S)0
-rw-r--r--libc/sysdeps/linux/sh64/sys/procfs.h126
6 files changed, 181 insertions, 63 deletions
diff --git a/libc/sysdeps/linux/sh64/Makefile b/libc/sysdeps/linux/sh64/Makefile
index 020cc76c8..ecbf14228 100644
--- a/libc/sysdeps/linux/sh64/Makefile
+++ b/libc/sysdeps/linux/sh64/Makefile
@@ -5,60 +5,11 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_srcdir=../../../../
+top_builddir=../../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.arch
+include $(top_srcdir)Makerules
TOPDIR=../../../../
include $(TOPDIR)Rules.mak
-
-CFLAGS += -I..
-ASFLAGS += -I.. -D__ASSEMBLER__ -DASM_GLOBAL_DIRECTIVE=.globl
-
-TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
-
-CRT_SRC := crt0.S
-CRT_OBJ := crt0.o crt1.o
-CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
-
-SSRC := setjmp.S longjmp.S
-SOBJ := $(patsubst %.S,%.o, $(SSRC))
-
-CSRC := __init_brk.c brk.c sbrk.c syscall.c
-COBJ := $(patsubst %.c,%.o, $(CSRC))
-
-OBJS := $(SOBJ) $(COBJ)
-
-OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH)
-
-all: $(OBJ_LIST) $(CTOR_TARGETS)
-
-$(OBJ_LIST): $(OBJS) $(CRT_OBJ)
- $(STRIPTOOL) -x -R .note -R .comment $^
- $(INSTALL) -d $(TOPDIR)lib/
- cp $(CRT_OBJ) $(TOPDIR)lib/
- echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@
-
-$(CRT_OBJ): $(CRT_SRC)
- $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
-
-$(SOBJ): %.o : %.S
- $(CC) $(ASFLAGS) -c $< -o $@
-
-$(COBJ): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-ifeq ($(UCLIBC_CTOR_DTOR),y)
-$(TOPDIR)lib/crti.o: crti.S
- $(INSTALL) -d $(TOPDIR)lib/
- $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@
-
-$(TOPDIR)lib/crtn.o: crtn.S
- $(INSTALL) -d $(TOPDIR)lib/
- $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@
-else
-$(CTOR_TARGETS):
- $(INSTALL) -d $(TOPDIR)lib/
- $(AR) $(ARFLAGS) $@
-endif
-
-headers:
-
-clean:
- $(RM) *.o *~ core
diff --git a/libc/sysdeps/linux/sh64/Makefile.arch b/libc/sysdeps/linux/sh64/Makefile.arch
new file mode 100644
index 000000000..d49540ebe
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/Makefile.arch
@@ -0,0 +1,12 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+CSRC := __init_brk.c brk.c sbrk.c syscall.c
+
+SSRC := setjmp.S __longjmp.S
+
+include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/sh64/longjmp.S b/libc/sysdeps/linux/sh64/__longjmp.S
index d22a1677d..ca7925f76 100644
--- a/libc/sysdeps/linux/sh64/longjmp.S
+++ b/libc/sysdeps/linux/sh64/__longjmp.S
@@ -1,4 +1,4 @@
-/* longjmp for SH-5.
+/* __longjmp for SH-5.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -27,17 +27,17 @@
#define DOUBLE(reg,offset) fld.d r2, offset*8, reg
- .file "longjmp.S"
+ .file "__longjmp.S"
.section .text64,"xa"
.align 2
- .global longjmp
- .type longjmp,@function
+ .global __longjmp
+ .type __longjmp,@function
-longjmp:
+__longjmp:
/*
- * extern void longjmp(jmp_buf env, int val);
+ * extern void __longjmp(jmp_buf env, int val);
*
* r2 == env
* r3 == val
@@ -124,12 +124,12 @@ longjmp:
#error __SETJMP_NUM_TRG does agree with expected value
#endif
- /* restore Linkage Register (LR) for longjmp return */
+ /* restore Linkage Register (LR) for __longjmp return */
INTEGER(r18, __SETJMP_LR)
ptabs/l r18, tr0
/*
- * must ensure longjmp() never returns 0.
+ * must ensure __longjmp() never returns 0.
* if 'val' == 0, then return 1.
*/
cmpeq r3, r63, r2 /* r2 = (r3==0) ? 1 : 0; */
@@ -138,3 +138,4 @@ longjmp:
/* return to caller */
blink tr0, r63
+libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/sh64/bits/stackinfo.h b/libc/sysdeps/linux/sh64/bits/stackinfo.h
new file mode 100644
index 000000000..e65338f25
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/bits/stackinfo.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This file contains a bit of information about the stack allocation
+ of the processor. */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H 1
+
+/* On SH the stack grows down. */
+#define _STACK_GROWS_DOWN 1
+
+#endif /* stackinfo.h */
diff --git a/libc/sysdeps/linux/sh64/crt0.S b/libc/sysdeps/linux/sh64/crt1.S
index 271dfbaca..271dfbaca 100644
--- a/libc/sysdeps/linux/sh64/crt0.S
+++ b/libc/sysdeps/linux/sh64/crt1.S
diff --git a/libc/sysdeps/linux/sh64/sys/procfs.h b/libc/sysdeps/linux/sh64/sys/procfs.h
new file mode 100644
index 000000000..aad21e5f8
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/sys/procfs.h
@@ -0,0 +1,126 @@
+/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H 1
+
+/* This is somehow modelled after the file of the same name on SysVr4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. */
+
+#include <features.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/*
+ * ELF register definitions...
+ */
+typedef unsigned long elf_greg_t;
+
+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+typedef struct user_fpu_struct elf_fpregset_t;
+
+struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_code; /* Extra code. */
+ int si_errno; /* Errno. */
+ };
+
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ gdb doesn't really use excluded. Fields present but not used are
+ marked with "XXX". */
+struct elf_prstatus
+ {
+#if 0
+ long int pr_flags; /* XXX Process flags. */
+ short int pr_why; /* XXX Reason for process halt. */
+ short int pr_what; /* XXX More detailed reason. */
+#endif
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned long int pr_sigpend; /* Set of pending signals. */
+ unsigned long int pr_sighold; /* Set of held signals. */
+#if 0
+ struct sigaltstack pr_altstack; /* Alternate stack info. */
+ struct sigaction pr_action; /* Signal action for current sig. */
+#endif
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct timeval pr_utime; /* User time. */
+ struct timeval pr_stime; /* System time. */
+ struct timeval pr_cutime; /* Cumulative user time. */
+ struct timeval pr_cstime; /* Cumulative system time. */
+#if 0
+ long int pr_instr; /* Current instruction. */
+#endif
+ elf_gregset_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+#define ELF_PRARGSZ (80) /* Number of chars for args */
+
+struct elf_prpsinfo
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned long int pr_flag; /* Flags. */
+ long pr_uid;
+ long pr_gid;
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+
+/* Addresses. */
+typedef void *psaddr_t;
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+ therefore habe only ine PID type. */
+typedef __pid_t lwpid_t;
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif /* sys/procfs.h */