[Bug c/28194] New: R_ARM_GOTOFF32 breaks execute-in-place
sjackman at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 28 17:30:00 GMT 2006
Execute-in-place (XIP) code, commonly used with uClinux, places the .text
section in flash and the .data section in RAM. GCC 4.1 emits R_ARM_GOTOFF32
relocations for symbols in the .text segment relative to the GOT, which is in
the .data segment. This new behaviours breaks XIP. See the following diff,
which illustrates this 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"
--
Summary: R_ARM_GOTOFF32 breaks execute-in-place
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sjackman at gmail dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-unknown-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28194
More information about the Gcc-bugs
mailing list