This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How do disable generation of LDRD in ARM
- From: Roger Cruz <roger_r_cruz at yahoo dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 24 Dec 2012 11:53:54 -0800 (PST)
- Subject: How do disable generation of LDRD in ARM
- Reply-to: Roger Cruz <roger_r_cruz at yahoo dot com>
I am compiling this piece of code from an open source project that I wish not to have to change.? The problem is that when compiled for ARM, it generates an LDRD instruction, which when executed, causes a bus error since the address in ptr is not doubleword aligned.? I know I can change the code but I prefer to leave it intact as there may be many more instances of this and I don't wish to maintain the code.? I found the compiler option -mfix-cortex-m3-ldrd but the code still being generated with the LDRD instruction.? Any suggestions on how to tell the compiler to avoid LDRD instructions?
248??? static DWORD64 dwarf2_get_u8(const unsigned char* ptr)
249??? {
250??? ??? return *(const UINT64*)ptr;
251??? }
(gdb) x/5i $pc
=> 0x4325ffd4 <dwarf2_get_u8+20>:??? ldrd??? r2, [r3]
gdb) p ptr
$6 = (const unsigned char *) 0x435a2fa5 ""
(gdb) p $r3
$7 = 0x435a2fa5
Happy Holidays,
Roger R. Cruz