public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jeroen Hofstee <jeroen@myspectrum.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] arm: U-Boot API - clang support broke ABI
Date: Tue, 19 Nov 2013 23:42:51 +0100	[thread overview]
Message-ID: <528BE96B.9050802@myspectrum.nl> (raw)
In-Reply-To: <20131118112659.GB1567@rocoto.smurfnet.nu>

Hi Leif,

On 11/18/2013 12:26 PM, Leif Lindholm wrote:
> Commit fe1378a - "ARM: use r9 for gd" - broke the ABI for users of the
> U-Boot API on ARM. Users I am aware of are GRUB and the FreeBSD loader.
> Since I only spotted this on Saturday, this code is well and truly in
> the wild, so any users of the API will need to preserve both r8 and r9
> on syscalls for the foreseeable future (which is not the end of the
> world).
I actually broke it a bit more than that, since the stubs appear
to use the gd register directly (where I wasn't aware of and
still surprises me a bit, I will have a better look later why this is).
The patch below should help for the hello_world example on master.
(as in both u-boot and the application use r9 for gd)

I am aware this doesn't answer your question and I will come
back on that if I have a bit more time to look into it (Saterday
I guess).

Regards,
Jeroen

diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 8fb1765..5d2ab56 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -40,14 +40,14 @@ gd_t *global_data;
         : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : 
"r11");
  #elif defined(CONFIG_ARM)
  /*
- * r8 holds the pointer to the global_data, ip is a call-clobbered
+ * r9 holds the pointer to the global_data, ip is a call-clobbered
   * register
   */
  #define EXPORT_FUNC(x) \
         asm volatile (                  \
  "      .globl " #x "\n"                \
  #x ":\n"                               \
-"      ldr     ip, [r8, %0]\n"         \
+"      ldr     ip, [r9, %0]\n"         \
  "      ldr     pc, [ip, %1]\n"         \
         : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : 
"ip");
  #elif defined(CONFIG_MIPS)

  parent reply	other threads:[~2013-11-19 22:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 11:26 [U-Boot] arm: U-Boot API - clang support broke ABI Leif Lindholm
2013-11-19  9:09 ` Michal Simek
2013-11-19 20:07   ` Tom Rini
2013-11-20  7:59     ` [U-Boot] standalone u-boot app - bootm issue was the part of: (Re: arm: U-Boot API - clang support broke ABI) Michal Simek
2013-11-20 13:49       ` Tom Rini
2013-11-20 13:53         ` Michal Simek
2013-11-20 14:01           ` Tom Rini
2013-11-21 15:54             ` Michal Simek
2013-11-19 22:42 ` Jeroen Hofstee [this message]
2013-11-23 11:20 ` [U-Boot] arm: U-Boot API - clang support broke ABI Jeroen Hofstee
2013-11-25 10:43   ` Leif Lindholm

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=528BE96B.9050802@myspectrum.nl \
    --to=jeroen@myspectrum.nl \
    --cc=u-boot@lists.denx.de \
    /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