rts.cabal.in: force inclusion of findPtr/_findPtr symbol only with debug flag
authorAlp Mestanogullari <alp@well-typed.com>
Thu, 22 Nov 2018 16:47:48 +0000 (11:47 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 22 Nov 2018 18:14:01 +0000 (13:14 -0500)
The previous strategy caused problems on Windows, as pointed out
at [1]

[1]: https://phabricator.haskell.org/rGHC900c47f88784#133905

Reviewers: Phyx, bgamari, erikd, simonmar

Reviewed By: Phyx

Subscribers: rwbarton, carter

GHC Trac Issues: #15671

Differential Revision: https://phabricator.haskell.org/D5356

rts/Printer.c
rts/package.conf.in
rts/rts.cabal.in

index 7f7e83c..291f529 100644 (file)
@@ -24,8 +24,6 @@
 
 #include <string.h>
 
 
 #include <string.h>
 
-void findPtr(P_ p, int follow);
-
 #if defined(DEBUG)
 
 #include "Disassembler.h"
 #if defined(DEBUG)
 
 #include "Disassembler.h"
@@ -777,6 +775,8 @@ extern void DEBUG_LoadSymbols( const char *name STG_UNUSED )
 
 #endif /* USING_LIBBFD */
 
 
 #endif /* USING_LIBBFD */
 
+void findPtr(P_ p, int);                /* keep gcc -Wall happy */
+
 int searched = 0;
 
 static int
 int searched = 0;
 
 static int
@@ -876,12 +876,7 @@ void printObj( StgClosure *obj )
     debugBelch("obj 0x%p (enable -DDEBUG for more info) " , obj );
 }
 
     debugBelch("obj 0x%p (enable -DDEBUG for more info) " , obj );
 }
 
-void findPtr(P_ p, int follow)
-{
-    // we're printing the arguments just to silence the unused parameter warning
-    debugBelch("recompile your program with -debug in order to run ");
-    debugBelch("findPtr(0x%p, %d)\n", p, follow);
-}
+
 #endif /* DEBUG */
 
 /* -----------------------------------------------------------------------------
 #endif /* DEBUG */
 
 /* -----------------------------------------------------------------------------
index b6dac76..b5ed26d 100644 (file)
@@ -174,9 +174,11 @@ ld-options:
 #if WORD_SIZE_IN_BITS == 64
          , "-Wl,-u,_hs_atomicwrite64"
 #endif
 #if WORD_SIZE_IN_BITS == 64
          , "-Wl,-u,_hs_atomicwrite64"
 #endif
+#if defined(DEBUG)
           /* This symbol is useful in gdb, but not referred to anywhere,
            * so we need to force it to be included in the binary. */
          , "-Wl,-u,_findPtr"
           /* This symbol is useful in gdb, but not referred to anywhere,
            * so we need to force it to be included in the binary. */
          , "-Wl,-u,_findPtr"
+#endif
 #else
            "-Wl,-u,base_GHCziTopHandler_runIO_closure"
          , "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
 #else
            "-Wl,-u,base_GHCziTopHandler_runIO_closure"
          , "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
@@ -275,10 +277,12 @@ ld-options:
 #if WORD_SIZE_IN_BITS == 64
          , "-Wl,-u,hs_atomicwrite64"
 #endif
 #if WORD_SIZE_IN_BITS == 64
          , "-Wl,-u,hs_atomicwrite64"
 #endif
+#if defined(DEBUG)
           /* This symbol is useful in gdb, but not referred to anywhere,
            * so we need to force it to be included in the binary. */
          , "-Wl,-u,findPtr"
 #endif
           /* This symbol is useful in gdb, but not referred to anywhere,
            * so we need to force it to be included in the binary. */
          , "-Wl,-u,findPtr"
 #endif
+#endif
 
 /*  Pick up static libraries in preference over dynamic if in earlier search
  *  path.  This is important to use the static gmp in preference on Mac OS.
 
 /*  Pick up static libraries in preference over dynamic if in earlier search
  *  path.  This is important to use the static gmp in preference on Mac OS.
index 76fd353..a20aa57 100644 (file)
@@ -260,9 +260,13 @@ library
          "-Wl,-u,_hs_atomicwrite8"
          "-Wl,-u,_hs_atomicwrite16"
          "-Wl,-u,_hs_atomicwrite32"
          "-Wl,-u,_hs_atomicwrite8"
          "-Wl,-u,_hs_atomicwrite16"
          "-Wl,-u,_hs_atomicwrite32"
-         -- This symbol is useful in gdb, but not referred to anywhere,
-         -- so we need to force it to be included in the binary.
          "-Wl,-u,_findPtr"
          "-Wl,-u,_findPtr"
+
+      if flag(debug)
+        -- This symbol is useful in gdb, but not referred to anywhere,
+        -- so we need to force it to be included in the binary.
+        ld-options: "-Wl,-u,_findPtr"
+
     else
       ld-options:
          "-Wl,-u,base_GHCziTopHandler_runIO_closure"
     else
       ld-options:
          "-Wl,-u,base_GHCziTopHandler_runIO_closure"
@@ -333,9 +337,11 @@ library
          "-Wl,-u,hs_atomicwrite8"
          "-Wl,-u,hs_atomicwrite16"
          "-Wl,-u,hs_atomicwrite32"
          "-Wl,-u,hs_atomicwrite8"
          "-Wl,-u,hs_atomicwrite16"
          "-Wl,-u,hs_atomicwrite32"
-         -- This symbol is useful in gdb, but not referred to anywhere,
-         -- so we need to force it to be included in the binary.
-         "-Wl,-u,findPtr"
+
+      if flag(debug)
+        -- This symbol is useful in gdb, but not referred to anywhere,
+        -- so we need to force it to be included in the binary.
+        ld-options: "-Wl,-u,_findPtr"
 
     if os(osx)
       ld-options: "-Wl,-search_paths_first"
 
     if os(osx)
       ld-options: "-Wl,-search_paths_first"