public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sjackman at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/28194]  New: R_ARM_GOTOFF32 breaks execute-in-place
Date: Wed, 28 Jun 2006 17:30:00 -0000	[thread overview]
Message-ID: <bug-28194-11470@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2006-06-28 16:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-28 17:30 sjackman at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28194-11470@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).