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

Re: Tuple and changes for m68k with -malign-int



On Sun, May 18, 2025 at 9:09 AM John Paul Adrian Glaubitz
<glaubitz@physik.fu-berlin.de> wrote:
>
> Hi James,
>
> On Sat, 2023-08-26 at 09:53 +0100, James Le Cuirot wrote:
> > Once that is agreed, I'm happy to put together the patch to automatically
> > enable the flag for this tuple in GCC. The part I do need help with is
> > necessary changes to glibc, if any. Assembly is not my area at all, so what I
> > came up with here was a total guess.
> >
> >
> > --- a/sysdeps/m68k/crti.S       2022-07-29 23:03:09.000000000 +0100
> > +++ b/sysdeps/m68k/crti.S       2022-11-30 21:41:52.710135230 +0000
> > @@ -56,7 +56,7 @@
> >  #endif
> >
> >         .section .init,"ax",@progbits
> > -       .align  2
> > +       .p2align        2
> >         .globl  _init
> >         .hidden _init
> >         .type   _init, @function
> > @@ -74,7 +74,7 @@
> >  #endif
> >
> >         .section .fini,"ax",@progbits
> > -       .align  2
> > +       .p2align        2
> >         .globl  _fini
> >         .hidden _fini
> >         .type   _fini, @function
> >
> >
> > I did try this out, and it largely seemed to work, although processes
> > occasionally hung. Perhaps this was unrelated.
>
> I was just looking at the necessary changes to switch m68k to 32-bit alignment
> and I'm not sure we need to do anything about glibc. I am documenting my current
> findings here [1].
>
> What I have found out so far is that official ELF ABI documentation from AT&T
> mandates a default alignment of four bytes and any SVR4-based distribution such
> as Amiga Unix and NetBSD/ELF actually adheres to that. Why Linux uses a 2 bytes
> alignment when the official ELF ABI documentation clearly says 4 bytes, remains
> a mystery to me.

It correlates with the default in AmigaOS, which was originally
optimized to fit in 256K of RAM.

> I'm not even sure whether we would have to change the target triplet since the
> current implementation for Linux is actually violating the standard and any
> application adhering to spec written for Linux ELF m68k would actually not work.
>
> Anyway, looking at crti.s for other 32-bit architectures such as powerpc, I'm not
> sure we actually need to do anything about glibc. I think just changing the
> default value for BIGGEST_ALIGNMENT from 16 to 64 similar to NetBSD/ELF in GCC
> should be enough, shouldn't it?
>
> Adrian
>
> > [1] https://wiki.debian.org/M68k/Alignment
>
> --
>  .''`.  John Paul Adrian Glaubitz
> : :' :  Debian Developer
> `. `'   Physicist
>   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
>


-- 
Antonio Vargas Gonzalez | winden ^ capsule ^ rgba ^ network ^
batman.group | +windenntw | windenntw@gmail.com


Reply to: