|
From: Philippe W. <phi...@sk...> - 2012-06-22 22:10:04
|
On Fri, 2012-06-22 at 14:41 -0700, John Reiser wrote:
> >> pub_core_threadstate.h explicitely tells to align vex on 32 bytes:
> >> ...
> >> /* Saved machine context. */
> >> VexGuestArchState vex __attribute__((aligned(32)));
> >> ...
> >>
> >> The failing assert is:
> >> Addr a_vex = (Addr) & tst->arch.vex;
> >> ....
> >> vg_assert(VG_IS_32_ALIGNED(a_vex));
> >
> > Not sufficient. attribute(aligned) won't work unless all of the containing structs are also aligned. You need the ThreadState and ThreadArchState to be aligned as well.
>
> That's a compiler bug. The compiler must automatically propagate
> alignment requirements: first by maximum within a union, then
> outward to each enclosing union or struct.
Effectively, the compiler is supposed to align the field.
Here is an extract of the gcc doc:
As in the preceding examples, you can explicitly specify the
alignment (in bytes) that you wish the compiler to use for a given
variable or structure field.
A little bit after, however, one find the below.
Is the MacOs linker not supporting 32 bytes alignment ?
Note that the effectiveness of `aligned' attributes may be limited
by inherent limitations in your linker. On many systems, the
linker is only able to arrange for variables to be aligned up to a
certain maximum alignment. (For some linkers, the maximum
supported alignment may be very very small.) If your linker is
only able to align variables up to a maximum of 8 byte alignment,
then specifying `aligned(16)' in an `__attribute__' will still
only provide you with 8 byte alignment. See your linker
documentation for further information.
|