[lfs] 02/02: Add a note about the new sed in gcc

"Git Owner" ([email protected] via lfs-book Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.book
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch multilib
in repository lfs.

commit 2fbddc9fece0f4a5a9c665d94888ea129344b88d
Author: Thomas Trepl <[email protected]>
AuthorDate: Tue Nov 12 08:12:40 2024 +0100

    Add a note about the new sed in gcc
---
 chapter05/gcc-pass1.xml | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml
index 1ac142dde..d5051f0bd 100644
--- a/chapter05/gcc-pass1.xml
+++ b/chapter05/gcc-pass1.xml
@@ -80,12 +80,37 @@ esac</userinput></screen>
     -i.orig gcc/config/i386/t-linux64
 </userinput></screen>
 
-    <para arch="ml_32,ml_all">Make <literal>-mstackrealign</literal> a default for 32bit
-      objects:</para>
+    <para arch="ml_32,ml_all">Make <literal>-mstackrealign</literal>
+      a default for 32bit objects:</para>
 
 <screen arch="ml_32,ml_all"><userinput remap="pre">sed '/STACK_REALIGN_DEFAULT/s/0/(!TARGET_64BIT \&amp;\&amp; TARGET_SSE)/' \
       -i gcc/config/i386/i386.h</userinput></screen>
 
+    <note arch="ml_32,ml_all">
+      <para>Adding the <literal>-mstackrealign</literal> flag by default
+        helps to overcome issues with old binaries which cannot be
+        recompiled on the actual OS.</para>
+
+      <!-- Thanks to xry111 for explaining the technical background: -->
+
+      <para>Today the x86-32 SysV psABI (used by all Linux programs)
+        mandates a 16-byte alignment of the stack frame, so the routines
+        using SSE will save/load SSE vectors onto/from the stack using a
+        <literal>movaps</literal> instruction (which only works with
+        aligned addresses, but faster than its counterpart allowing
+        unaligned addresses, <literal>movups</literal>).</para>
+
+      <para>But some really old x86-32 Linux binaries (compiled about
+        15 years ago), and all Windows x86-32 binaries which might be
+        run via <application>Wine</application> or <application>Steam</application>
+        only aligns the
+        stack frame to 4-byte. Thus, when it calls a SSE routine in LFS
+        built without <literal>-mstackrealign</literal>, the
+        <literal>movdqa</literal> instruction fails with a General
+        Protection Error and the Linux kernel terminates the process
+        with a SIGSEGV.</para>
+    </note>
+
     <para>The GCC documentation recommends building GCC
     in a dedicated build directory:</para>
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-book
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.