ia32 lsb does not match de facto Linux ia32 ABI, e.g. in stack alignment

Bug #1327843 reported by Jeff Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RPM
New
Undecided
Unassigned
lsb
In Progress
Medium
Unassigned
Mandriva
In Progress
High

Bug Description

http://refspecs.freestandards.org/LSB_4.1.0/LSB-Core-IA32/LSB-Core-IA32/cstackframe.html
points to http://www.sco.com/developers/devspecs/abi386-4.pdf
which says
"The stack is word aligned. Although the architecture does not require any
alignment of the stack, software convention and the operating system
requires that the stack be aligned on a word boundary."

But http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38496#c7
dated Dec 6th 2006, says
"[ abi386-4.pdf ] should be considered of only marginal relevant to current
systems; it may have described an ABI for some particular system that is
now obsolete, but is not an accurate description of (for example) the ABI
used on IA32 GNU/Linux, which is a de facto ABI with no written document
corresponding precisely.
http://groups.google.com/group/ia32-abi/browse_thread/thread/4f9b3e5069943bf1
(and the messages linked from it) is a description of this area of the de
facto ABI."

http://groups.google.com/group/ia32-abi/browse_thread/thread/4f9b3e5069943bf1
says:

-- snip --
From: <email address hidden>
To: "IA32 System V Application Binary Interface" <email address hidden>
Subject: Gcc defaults to 128bit alignment for stack
Date: Thu, 07 Dec 2006 11:46:12 -0800

Gcc now defaults to 128bit alignment for stack:

http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00252.html

to address a few gcc bugs:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13685
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28621
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27537

The original IA32 psABI only requires stack to be aligned at 32bit.
This change means that functions in object files generated by gcc
may not work correctly when called from object files which only
guarantee 32bit stack alignment. Since it is very unlikely for gcc to
default to 32bit stack alignment, it is highly recommended that
functions should have stack aligned at 128bit before calling functions
generated by gcc.
-- snip --

It appears that the de facto ABI changed some time ago, and the LSB
hasn't caught up. As a result, LSB-compliant-ish apps that use SSE
will not run on current Linux systems

So, is the correct stack alignment 4 bytes? 8 bytes? 16 bytes?
Without a standard that matches current hardware and software practice,
arguments, confusion, and friction can arise; see e.g.
http://bugs.winehq.org/show_bug.cgi?id=22316

Please fix this in LSB 4.2.
I suppose that means pulling in some spec that defines SSE operations;
I'm sure H.J.Lu would have some suggestions.

(He's helping author a new ABI supplement for 'x32', a 32 bit x86-64 abi; see
https://sites.google.com/site/x32abi/
but asking for x32 to be added to LSB is beyond the scope of this bug report.)

Changed in mandriva:
importance: Unknown → High
status: Unknown → In Progress
Jeff Johnson (n3npq)
tags: added: lsb rpm x32abi
Jeff Johnson (n3npq)
tags: added: zdecide
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.