This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Option to print word size, alignment on the target platform
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Igor Bukanov <igor dot bukanov at gmail dot com>
- Date: Wed, 25 Jan 2006 15:36:25 +0000
- Subject: Re: Option to print word size, alignment on the target platform
- References: <df0b33100601250220v693de3d3ib3bc25599c7ae69e@mail.gmail.com>
On Wednesday 25 January 2006 10:20, Igor Bukanov wrote:
> Is there any option to ask GCC to print various size and alignment
> info on the target platform? This would be very nice during cross
> compilation when one can not run the executables to autoconfigure for
> such parameters.
>
> Currently I consider for that a hack like copiling the following source:
>
> #include <stddef.h>
> union aligned_fields {
> double d;
> void (*f)();
> ...
> };
>
> struct align_test {
> union aligned_fields u1;
> char c;
> };
Autoconf already has tests for things like this. Something along the lines of:
const char D_P_S_4[sizeof(void *) == 4 : -1 : 1];
const char D_P_S_8[sizeof(void *) == 8 : -1 : 1];
Then see which compiles, or grep the error messages.
Paul