From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeroen Hofstee Date: Tue, 19 Nov 2013 23:42:51 +0100 Subject: [U-Boot] arm: U-Boot API - clang support broke ABI In-Reply-To: <20131118112659.GB1567@rocoto.smurfnet.nu> References: <20131118112659.GB1567@rocoto.smurfnet.nu> Message-ID: <528BE96B.9050802@myspectrum.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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)