This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: RX: Add support for PID mode


Hi Guys,

  I would like to apply the patch below to add support for the new
  Position Independent Data mode to the RX libgloss port.  The patch
  fixes crt0 so that it initialised the __pid_base register, if PID mode
  is enabled.  It also provides a weak definition of __pid_base in the
  user has not specified one, and to allow the testsuites to run.

  Tested with an rx-elf toolchain.

  OK to apply ?

Cheers
  Nick

libgloss/ChangeLog
2011-10-05  Nick Clifton  <nickc@redhat.com>

	* rx/crt0.S: Initialise the PID address register.
	(__pid_base): Define weakly.

Index: libgloss/rx/crt0.S
===================================================================
RCS file: /cvs/src/src/libgloss/rx/crt0.S,v
retrieving revision 1.1
diff -u -3 -p -r1.1 crt0.S
--- libgloss/rx/crt0.S	26 Oct 2009 10:05:23 -0000	1.1
+++ libgloss/rx/crt0.S	5 Oct 2011 11:06:48 -0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009 Red Hat Incorporated.
+/* Copyright (c) 2008, 2009, 2011 Red Hat Incorporated.
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -50,11 +50,20 @@ _start:
 	mov	#__bsssize, r3
 	sstr.l
 
-	/* Initialise the small data area pointer.
-	   The register used here must agree with the definition of
-	   GP_BASE_REGNUM in gcc/config/rx/rx.h.  */
+	/* Initialize data pointer register(s).
+           Note: The registers used here should agree with the definition of
+	   GP_BASE_REGNUM in gcc/config/rx/rx.h.
+           Note: We are assuming that -mint-register has not been used when
+	   compiling the application.  */
+#ifdef _RX_PID
+	/* Initialise the constant data pointer and small data pointers.  */
+	mov	#__pid_base, r13
+	mov	#__gp, r12
+#else
+	/* Initialise the small data area pointer.  */
 	mov	#__gp, r13
-
+#endif
+	
 	bsr.a	__rx_init
 
 #ifdef PROFILE_SUPPORT	/* Defined in gcrt0.S.  */
@@ -129,6 +138,12 @@ __rx_init:
 __rx_fini:
 	bsr.a	_rx_run_fini_array
 
+        .section .rodata
+        .balign 4
+        .global __pid_base
+	.weak   __pid_base
+__pid_base:   
+
         .section .sdata
         .balign 4
         .global __gp


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