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]

Re: [Patch, microblaze]: Add a small Linux BSP


On 07/23/2013 02:25 AM, David Holsgrove wrote:
diff --git a/libgloss/microblaze/linux-crt0.S b/libgloss/microblaze/linux-crt0.S
...
+	brlid	r15, __init
+	nop
+
...
+	/* Replacement for the GCC provided crti.S. This one avoids the
+	   setup of stack protection regs (which result in privilieged
+	   insn exceptions when running in user-space).  */
+        .section .init, "ax"
+	.global __init
+	.align 2
+__init:
+	addik   r1, r1, -8
+	sw      r15, r0, r1
+
+	.section .fini, "ax"
+	.global __fini
+	.align 2
+__fini:
+	addik   r1, r1, -8
+	sw      r15, r0, r1

David:

It seems a bit odd that neither __init() nor __fini() have rtsd instructions at their end. Given the way that __init() is called from _start(), it does not appear that this would work correctly. Is this really the way it should be?

I normally run with the standalone BSP, which does end up with the GCC crti. With respect to that, this is not just leaving out the stack protection setup. It is also missing a couple of function calls, as well as the return. It's almost like an edit of it took from the SHR setup through the end of __init(), rather than just the 4 instructions for SHR setup. (This observation is based on the comment which says it is a crti replacement without SHR.) __fini() is similar.

Craig


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