[OSELAS.Toolchain] Aligment trap in dynamic linker
Ladislav Michl
Ladislav.Michl@seznam.cz
Tue Nov 3 21:30:00 GMT 2009
On Tue, Nov 03, 2009 at 11:53:07AM +0000, Martin Guy wrote:
> On 11/2/09, Ladislav Michl <Ladislav.Michl@seznam.cz> wrote:
> > I built ARM EABI toolchain using OSELAS.Toolchain
> > arm-v4t-linux-gnueabi_gcc-4.4.0_glibc-2.9_binutils-2.19.1_kernel-2.6.29-sanitized.ptxconfig
> > and run freshly built userland with 2.6.32-rc5 kernel on OMAP5910 (ARM925)
> > based board. Running every single binary triggers alignment trap.
>
> > Looking at process map shows that 0x4000aba8 belongs to /lib/ld-2.9.so address
>
> The current Debian testing release (squeeze) has a similar symptom,
> but only on C++ binaries as far as I know. It looks like a new bug in
> libc or the GCC startup code.
> Here is how far we got http://bugs.debian.org/548842
Just FYI, I found similar one here
http://www.opensubscriber.com/message/fedora-devel-list@redhat.com/5545902.html
but it seems that fix didn't went in, so right solution is elsewhere.
However, I blindly modified it for arm and unaligned access went away...
--- glibc-ports-2.9/sysdeps/arm/dl-machine.h.orig 2009-11-03 22:03:57.000000000 +0100
+++ glibc-ports-2.9/sysdeps/arm/dl-machine.h 2009-11-03 22:11:45.000000000 +0100
@@ -568,13 +568,22 @@
}
# endif
+union arm_unaligned_data {
+ Elf32_Addr l_addr;
+} __attribute__ ((packed));
+
auto inline void
__attribute__ ((always_inline))
elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
void *const reloc_addr_arg)
{
- Elf32_Addr *const reloc_addr = reloc_addr_arg;
- *reloc_addr += l_addr;
+ if (((long)reloc_addr_arg) & 0x3) {
+ union arm_unaligned_data *const lpdata = reloc_addr_arg;
+ lpdata->l_addr += l_addr;
+ } else {
+ Elf32_Addr *const reloc_addr = reloc_addr_arg;
+ *reloc_addr += l_addr;
+ }
}
# ifndef RTLD_BOOTSTRAP
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list