[PATCH] Add segmented stack support for DragonFlyBSD
Michael Neumann
mneumann at ntecs.de
Tue Jul 29 06:20:41 PDT 2014
This patch adds support for segmented stacks for DragonFlyBSD. It is required to port the Rust programming language to DragonFly. With this patch rustc can generate code targeted at DragonFly.
http://reviews.llvm.org/D4705
Files:
lib/Target/X86/X86FrameLowering.cpp
lib/Target/X86/X86Subtarget.h
Index: lib/Target/X86/X86FrameLowering.cpp
===================================================================
--- lib/Target/X86/X86FrameLowering.cpp
+++ lib/Target/X86/X86FrameLowering.cpp
@@ -1328,7 +1328,8 @@
if (MF.getFunction()->isVarArg())
report_fatal_error("Segmented stacks do not support vararg functions.");
if (!STI.isTargetLinux() && !STI.isTargetDarwin() &&
- !STI.isTargetWin32() && !STI.isTargetWin64() && !STI.isTargetFreeBSD())
+ !STI.isTargetWin32() && !STI.isTargetWin64() &&
+ !STI.isTargetFreeBSD() && !STI.isTargetDragonFly())
report_fatal_error("Segmented stacks not supported on this platform.");
// Eventually StackSize will be calculated by a link-time pass; which will
@@ -1382,6 +1383,9 @@
} else if (STI.isTargetFreeBSD()) {
TlsReg = X86::FS;
TlsOffset = 0x18;
+ } else if (STI.isTargetDragonFly()) {
+ TlsReg = X86::FS;
+ TlsOffset = 0x20; // use tls_tcb.tcb_segstack
} else {
report_fatal_error("Segmented stacks not supported on this platform.");
}
@@ -1404,6 +1408,9 @@
} else if (STI.isTargetWin32()) {
TlsReg = X86::FS;
TlsOffset = 0x14; // pvArbitrary, reserved for application use
+ } else if (STI.isTargetDragonFly()) {
+ TlsReg = X86::FS;
+ TlsOffset = 0x10; // use tls_tcb.tcb_segstack
} else if (STI.isTargetFreeBSD()) {
report_fatal_error("Segmented stacks not supported on FreeBSD i386.");
} else {
Index: lib/Target/X86/X86Subtarget.h
===================================================================
--- lib/Target/X86/X86Subtarget.h
+++ lib/Target/X86/X86Subtarget.h
@@ -371,6 +371,9 @@
bool isTargetFreeBSD() const {
return TargetTriple.getOS() == Triple::FreeBSD;
}
+ bool isTargetDragonFly() const {
+ return TargetTriple.getOS() == Triple::DragonFly;
+ }
bool isTargetSolaris() const {
return TargetTriple.getOS() == Triple::Solaris;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4705.11978.patch
Type: text/x-patch
Size: 1952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140729/5eea455a/attachment.bin>
More information about the llvm-commits
mailing list