This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: arm-elf-gcc : change default data alignement depending on ARM/THUMB
- From: Yves Rutschle <y dot rutschle at indigovision dot com>
- To: Bill Gatliff <bgat at billgatliff dot com>
- Cc: Vincent Rubiolo <vincent dot rubiolo at st dot com>, gcc-help at gcc dot gnu dot org,crossgcc at sources dot redhat dot com
- Date: Thu, 21 Aug 2003 16:18:43 +0100
- Subject: Re: arm-elf-gcc : change default data alignement depending on ARM/THUMB
- References: <3F43E014.3070800@st.com> <3F44DBCF.9090508@billgatliff.com>
On Thu, Aug 21, 2003 at 09:48:47AM -0500, Bill Gatliff
wrote:
> As you've seen, structure implementations can change in
> response to changes in compiler settings and versions---
> but the hardware doesn't!
Hey. Get your hardware developer to make hardware that can
read the software's mind as it should. :-)
> Oh, and I left the "volatile" keyword out of all of the above, but you
> absolutely, positively need it as well when you're touching hardware.
Linus Torvalds said somewhere he didn't like volatile
because it never did what people expected. Linux people
usually use a macro as follows:
#define barrier() __asm__ __volatile__("": : :"memory")
which invalidates all assumption on memory: it forces things
to be pushed to the hardware.
E.g:
int i;
i = 0;
i = 5;
will typically compile as one memory set (and if i is used
a few lines later, no memory access at all), whereas:
int i;
i = 0;
barrier();
i = 5;
will perform garantee a write instruction will be issued
(then you hope someone switched off the cache, but that's
another story entirely).
/Y
--
This signature left empty.