Equivalent of __packed for arm-linux-gcc ?
Hi all,
Quoted from "http://www.arm.com/support/faqdev/1228.html".
-------------------------------------------------------------------------------------------------------------------------------------------------------
"For example if a pointer pointing at the address 0x8006 was loaded
from, then you might expect to load the contents of bytes from 0x8006,
0x8007, 0x8008 and 0x8009. However on the ARM, such an access would
actually load the rotated contents of bytes from 0x8004, 0x8005, 0x8006
and 0x8007.
Thus if you wish to define a pointer to a word that can be at any
address (i.e. that can be at a non-natural alignment) then you must
specify this using the __packed qualifier when defining the pointer:
__packed int *pi; // pointer to unaligned int
The ARM compilers will not then use an LDR, but instead generate code
which correctly accesses the value regardless of the alignment of the
pointer. This code generated will be a sequence of byte accesses, or
variable alignment-dependent shifting and masking (depending on the
compile options) and will therefore incur a performance and code size
penalty. "
----------------------------------------------------------------------------------------------------------------------------------------------------
iam stuck with this problem, since many days. I have read about this
problem from several arm-mailing lists.Now the scene is , ive understood
the problem but failed to get a solution, from arm-linux-gcc for this .
the following definition would work armcc :
How can i declare something of this kind using arm-linux-gcc?
__packed int *pi; // pointer to unaligned int
thanks for your time.
cheers,
Amith
PS: using __attribute__((packed)) is not used for this case. i got
confused initially. Now i realise it is for something else.
Reply to: