[PATCH] Add segmented stack support for DragonFlyBSD

Michael Neumann mneumann at ntecs.de
Wed Aug 6 03:16:08 PDT 2014


Ping!

Am 29.07.2014 um 15:20 schrieb Michael Neumann:
> 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;
>     }
>

http://reviews.llvm.org/D4705






More information about the llvm-commits mailing list