This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] Re: sparc64-elf crt0.o fails to compile
- From: Yaakov Selkowitz <yselkowi at redhat dot com>
- Cc: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Thu, 25 Dec 2014 22:52:40 -0600
- Subject: [PATCH] Re: sparc64-elf crt0.o fails to compile
- Authentication-results: sourceware.org; auth=none
- References: <549C6D6C dot 5010005 at redhat dot com> <CAC82fA14ROuoqV_T4A38Zpd_BgfBZ+o0TMbuewQQvNpT1Wu1Qw at mail dot gmail dot com>
On 2014-12-25 21:48, Gedare Bloom wrote:
Without looking at the source--this error refers to using a global
register other than g0 or g1 without "declaring" it as used. Most
often this presents as g2 or g3. The ABI restricts the use of global
registers. You need to add:
.register %g2, #scratch
to the top of the assembly file to specify that g2 is used in the assembly.
OK, thanks for the hint. I used the attached patch to get
newlib/libgloss to compile for sparc64-elf.
--
Yaakov Selkowitz
Associate Software Engineer, ARM
Red Hat, Inc.
2014-12-25 Yaakov Selkowitz <yselkowi@...>
libgloss/
* sparc/crt0.S: Declare use of system registers.
* sparc/cygmon-crt0.S: Ditto.
* sparc/erc32-crt0.S: Ditto.
* sparc/traps.S: Ditto.
newlib/
* libc/sys/sparc64/sys/time.h: #include <time.h> for time_t.
Index: libgloss/sparc/crt0.S
===================================================================
RCS file: /cvs/src/src/libgloss/sparc/crt0.S,v
retrieving revision 1.1
diff -u -p -r1.1 crt0.S
--- libgloss/sparc/crt0.S 17 Mar 2000 22:48:52 -0000 1.1
+++ libgloss/sparc/crt0.S 26 Dec 2014 04:46:21 -0000
@@ -14,6 +14,9 @@
* they apply.
*/
#include "asm.h"
+
+.register %g2, #scratch
+.register %g3, #scratch
.data
.align 8
Index: libgloss/sparc/cygmon-crt0.S
===================================================================
RCS file: /cvs/src/src/libgloss/sparc/cygmon-crt0.S,v
retrieving revision 1.1
diff -u -p -r1.1 cygmon-crt0.S
--- libgloss/sparc/cygmon-crt0.S 17 Mar 2000 22:48:52 -0000 1.1
+++ libgloss/sparc/cygmon-crt0.S 26 Dec 2014 04:46:21 -0000
@@ -21,6 +21,9 @@
#else
#define SAVE_SIZE -64
#endif
+
+.register %g2, #scratch
+.register %g3, #scratch
.data
.align 8
Index: libgloss/sparc/erc32-crt0.S
===================================================================
RCS file: /cvs/src/src/libgloss/sparc/erc32-crt0.S,v
retrieving revision 1.1
diff -u -p -r1.1 erc32-crt0.S
--- libgloss/sparc/erc32-crt0.S 17 Mar 2000 22:48:52 -0000 1.1
+++ libgloss/sparc/erc32-crt0.S 26 Dec 2014 04:46:21 -0000
@@ -6,6 +6,9 @@
#include "asm.h"
+ .register %g2, #scratch
+ .register %g3, #scratch
+
.data
.align 8
SYM(environ):
Index: libgloss/sparc/traps.S
===================================================================
RCS file: /cvs/src/src/libgloss/sparc/traps.S,v
retrieving revision 1.1
diff -u -p -r1.1 traps.S
--- libgloss/sparc/traps.S 17 Mar 2000 22:48:52 -0000 1.1
+++ libgloss/sparc/traps.S 26 Dec 2014 04:46:21 -0000
@@ -15,6 +15,9 @@
#include "asm.h"
#include "slite.h"
+ .register %g2, #scratch
+ .register %g3, #scratch
+
.text
.align 4
Index: newlib/libc/sys/sparc64/sys/time.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/sparc64/sys/time.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 time.h
--- newlib/libc/sys/sparc64/sys/time.h 17 Feb 2000 19:39:50 -0000 1.1.1.1
+++ newlib/libc/sys/sparc64/sys/time.h 26 Dec 2014 04:46:21 -0000
@@ -1,6 +1,8 @@
#ifndef _SYS_TIME_H
#define _SYS_TIME_H
+#include <time.h> /* for time_t */
+
#ifdef __cplusplus
extern "C" {
#endif