[LLVMbugs] [Bug 1024] NEW: use 16-byte stack alignment on x86-64 ELF

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Nov 28 14:06:31 PST 2006


http://llvm.org/bugs/show_bug.cgi?id=1024

           Summary: use 16-byte stack alignment on x86-64 ELF
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: djg at cray.com


The ELF gABI for x86-64 requires the stack-pointer to be 16-byte aligned.
Right now LLVM is not doing this and I'm seeing lots of segfaults on
x86_64-unknown-linux-gnu without this.

Here's the reference:
http://www.x86-64.org/documentation/abi.pdf
Section 3.2.2, second paragraph.

Here's a patch:

Index: X86Subtarget.cpp
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/Target/X86/X86Subtarget.cpp,v
retrieving revision 1.40
diff -u -r1.40 X86Subtarget.cpp
--- X86Subtarget.cpp    20 Nov 2006 18:16:05 -0000      1.40
+++ X86Subtarget.cpp    28 Nov 2006 21:59:54 -0000
@@ -255,6 +255,8 @@
     }
   }
 
-  if (TargetType == isDarwin || TargetType == isCygwin)
+  if (TargetType == isDarwin ||
+      TargetType == isCygwin ||
+      (TargetType == isELF && Is64Bit))
     stackAlignment = 16;
 }



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list