On 6/27/06, David McCullough <[EMAIL PROTECTED]> wrote:
AFAIK,  you need to drop the -FPIC in favour of -fpic everywhere.

From the GCC manual, -fpic vs. -fPIC `makes a difference on the m68k,
PowerPC and SPARC.' For my purposes, it makes no difference on the
ARM.

You could try some experiments using the older toolchain to see how it
puts binaries together etc.  AFAIK,  thumb and most archs are supported
by it, it provides at least a working reference for fixing a new
toolchain at least,

I have experimented with GCC 4.0.3, 4.1.0, and 4.1.1. I found that
4.1.x behave the same; however, GCC 4.0.3 does not emit GOTOFF32
relocations. Apparently these are a new feature and preferable in some
instances since they do reduce the number of instructions by one.
However, GOTOFF32 does not work when a the relocation is emitted for a
symbol in the .text segment. As far as I know, any XIP application
with a static callback function should fail if it's compiled with
arm-elf-gcc 4.1.x. If anyone else is using this toolchain, I'd
appreciate the confirmation. The following diff of the output from GCC
4.0.3 to GCC 4.1.1 illustrates the new behaviour.

Cheers,
Shaun

$ cat f.c
void g(void (*h)(void)) {}
static void f(void) { g(f); }
$ diff -u f.s-4.0.3 f.s-4.1.1
--- f.s-4.0.3   2006-06-28 09:32:54.044964568 -0600
+++ f.s-4.1.1   2006-06-28 08:55:49.880089024 -0600
@@ -8,11 +8,12 @@
       .type   g, %function
g:
       push    {r7, lr}
-       mov     r7, sp
       sub     sp, sp, #4
-       sub     r3, r7, #4
+       add     r7, sp, #0
+       mov     r3, r7
       str     r0, [r3]
       mov     sp, r7
+       add     sp, sp, #4
       @ sp needed for prologue
       pop     {r7, pc}
       .size   g, .-g
@@ -22,10 +23,9 @@
       .type   f, %function
f:
       push    {r7, lr}
-       mov     r7, sp
+       add     r7, sp, #0
       ldr     r3, .L5
       add     r3, r3, sl
-       ldr     r3, [r3]
       mov     r0, r3
       bl      g
       mov     sp, r7
@@ -34,6 +34,6 @@
.L6:
       .align  2
.L5:
-       .word   f(GOT)
+       .word   f(GOTOFF)
       .size   f, .-f
-       .ident  "GCC: (GNU) 4.0.3"
+       .ident  "GCC: (GNU) 4.1.1"

Reply via email to