public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28194]  New: R_ARM_GOTOFF32 breaks execute-in-place
@ 2006-06-28 17:30 sjackman at gmail dot com
  2009-04-29 17:12 ` [Bug target/28194] " rearnsha at gcc dot gnu dot org
  2009-05-09  6:05 ` jsun at junsun dot net
  0 siblings, 2 replies; 3+ messages in thread
From: sjackman at gmail dot com @ 2006-06-28 17:30 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/28194] R_ARM_GOTOFF32 breaks execute-in-place
  2006-06-28 17:30 [Bug c/28194] New: R_ARM_GOTOFF32 breaks execute-in-place sjackman at gmail dot com
@ 2009-04-29 17:12 ` rearnsha at gcc dot gnu dot org
  2009-05-09  6:05 ` jsun at junsun dot net
  1 sibling, 0 replies; 3+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2009-04-29 17:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rearnsha at gcc dot gnu dot org  2009-04-29 17:12 -------
The ARM port does not currently support XIP (if it worked previously, it was by
chance, not design).  The generated code is exactly what is wanted in a normal
shared library environment, so I'm not about to start changing the default
behaviour.

If you want to have XIP, then implement an option that does this and submit the
patches for review.


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28194


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/28194] R_ARM_GOTOFF32 breaks execute-in-place
  2006-06-28 17:30 [Bug c/28194] New: R_ARM_GOTOFF32 breaks execute-in-place sjackman at gmail dot com
  2009-04-29 17:12 ` [Bug target/28194] " rearnsha at gcc dot gnu dot org
@ 2009-05-09  6:05 ` jsun at junsun dot net
  1 sibling, 0 replies; 3+ messages in thread
From: jsun at junsun dot net @ 2009-05-09  6:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jsun at junsun dot net  2009-05-09 06:04 -------
We have confirmed that this problem still exists in gcc 4.3.3.

It appears other than this problem, XIP on ARM actually works. XIP on ARM also
worked fine with gcc 3.x, with "-fpic -msingle-pic-base" compile option.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28194


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-09  6:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-28 17:30 [Bug c/28194] New: R_ARM_GOTOFF32 breaks execute-in-place sjackman at gmail dot com
2009-04-29 17:12 ` [Bug target/28194] " rearnsha at gcc dot gnu dot org
2009-05-09  6:05 ` jsun at junsun dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).