[commit: ghc] master: rts: Use .cfi_{start|end}proc directives (86210b2)

git at git.haskell.org git at git.haskell.org
Sat Jun 16 17:27:52 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/86210b238b86d810874a2315d1715546a4006cea/ghc

>---------------------------------------------------------------

commit 86210b238b86d810874a2315d1715546a4006cea
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sat Jun 16 11:34:28 2018 -0400

    rts: Use .cfi_{start|end}proc directives
    
    Test Plan: Validate using LLVM assembler
    
    Reviewers: carter, erikd, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #15207
    
    Differential Revision: https://phabricator.haskell.org/D4781


>---------------------------------------------------------------

86210b238b86d810874a2315d1715546a4006cea
 rts/StgCRun.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 92b0696..8fea23d 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -363,6 +363,15 @@ saved on the stack by the call instruction. Then we perform regular Haskell
 stack unwinding.
 */
 
+/*
+ * gcc automatically inserts .cfi_startproc/.cfi_endproc directives around
+ * inline assembler but clang does not. This caused the build to fail with
+ * Clang (see #15207).
+ */
+
+#if defined(__clang__)
+#define NEED_EXPLICIT_CFI_START_END
+#endif
 
 static void GNUC3_ATTRIBUTE(used)
 StgRunIsImplementedInAssembler(void)
@@ -376,6 +385,10 @@ StgRunIsImplementedInAssembler(void)
         STG_HIDDEN STG_RUN "\n"
 #endif
         STG_RUN ":\n\t"
+
+#if defined(NEED_EXPLICIT_CFI_START_END)
+        ".cfi_startproc simple\n\t"
+#endif
         "subq %1, %%rsp\n\t"
         "movq %%rsp, %%rax\n\t"
         "subq %0, %%rsp\n\t"
@@ -462,6 +475,10 @@ StgRunIsImplementedInAssembler(void)
 #if !defined(mingw32_HOST_OS)
         STG_HIDDEN xstr(STG_RUN_JMP) "\n"
 #endif
+#if defined(NEED_EXPLICIT_CFI_START_END)
+        ".cfi_endproc\n\t"
+#endif
+
 #if HAVE_SUBSECTIONS_VIA_SYMBOLS
         // If we have deadstripping enabled and a label is detected as unused
         // the code gets nop'd out.
@@ -500,7 +517,7 @@ StgRunIsImplementedInAssembler(void)
         "movq 136(%%rax),%%xmm15\n\t"
 #endif
         "addq %1, %%rsp\n\t"
-        "retq"
+        "retq\n\t"
 
         :
         : "i"(RESERVED_C_STACK_BYTES),



More information about the ghc-commits mailing list