Skip to content

Commit

Permalink
rts.cabal.in: force inclusion of findPtr/_findPtr symbol only when gi…
Browse files Browse the repository at this point in the history
…ven the 'debug' flag
  • Loading branch information
alpmestan committed Oct 9, 2018
1 parent 4eeeb51 commit f78e0ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
11 changes: 3 additions & 8 deletions rts/Printer.c
Expand Up @@ -24,8 +24,6 @@

#include <string.h>

void findPtr(P_ p, int follow);

#if defined(DEBUG)

#include "Disassembler.h"
Expand Down Expand Up @@ -777,6 +775,8 @@ extern void DEBUG_LoadSymbols( const char *name STG_UNUSED )

#endif /* USING_LIBBFD */

void findPtr(P_ p, int); /* keep gcc -Wall happy */

This comment has been minimized.

Copy link
@bgamari

bgamari Oct 17, 2018

It would be good to clarify why this keeps -Wall happy. What warning are we preempting?


int searched = 0;

static int
Expand Down Expand Up @@ -876,12 +876,7 @@ void printObj( StgClosure *obj )
debugBelch("obj 0x%p (enable -DDEBUG for more info) " , obj );
}

void findPtr(P_ p, int follow)

This comment has been minimized.

Copy link
@bgamari

bgamari Oct 17, 2018

Where did it go? Surely we still need to define it.

This comment has been minimized.

Copy link
@bgamari

bgamari Oct 17, 2018

Ahh, I see. This is just a placeholder.

{
// 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 */

/* -----------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions rts/package.conf.in
Expand Up @@ -174,9 +174,11 @@ ld-options:
#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
#else
"-Wl,-u,base_GHCziTopHandler_runIO_closure"
, "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
Expand Down Expand Up @@ -275,10 +277,12 @@ ld-options:
#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
#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.
Expand Down
16 changes: 11 additions & 5 deletions rts/rts.cabal.in
Expand Up @@ -260,9 +260,13 @@ library
"-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"

else
ld-options:
"-Wl,-u,base_GHCziTopHandler_runIO_closure"
Expand Down Expand Up @@ -333,9 +337,11 @@ library
"-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"
Expand Down

0 comments on commit f78e0ae

Please sign in to comment.