Re: Plan needed for switching m68k to 32-bit alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 14 Nov 2024, Geert Uytterhoeven wrote:

On i686 (i.e. gcc -m32 on amd64):

   __alignof__(long long) = 8

but

   sizeof(struct baa) = 12
   __alignof__(struct baa) = 4

???
Isn't the alignment of a struct the largest alignment of any of its
members?

I’d say yes. Probably the i386 psABI is so old that it is very
weird and nōn-standard in some ways.

(Another question: does -malign-int switch to natural
alignment for all types, i.e. 64 bit for llong and double,
etc. or are we going to have to change GCC first as well
to avoid more surprises?)

It only changes alignment for short and larger from 2 to 4 bytes.
So long long and double are still aligned to 4 bytes instead of 8.

Hmm hmm.

If we decide to change alignment, I'd rather change all types to
natural alignment, to avoid future nasty surprises.

That was my thought; the question is whether toolchain maintainers
(upstreams) will be amenable and helpful.

What to do with long double, which is 12 bytes on m68k and i386?
I386 kept its alignment at 4, while amd64 changed both size and
alignment to 16.

amd64’s long double is an SSE2 data type whereas i386’s is actually
an 80387 data type (same as m68k’s really), so they aren’t comparable.

I’d probably suggest aligning long double to 8 octets, like double.

It’s not a common data type (and probably one best avoided) anyway.

bye,
//mirabilos
-- 
(gnutls can also be used, but if you are compiling lynx for your own use,
there is no reason to consider using that package)
	-- Thomas E. Dickey on the Lynx mailing list, about OpenSSL





[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux