rts: Don't keep findPtr symbol alive if not -DDEBUG
ClosedPublic

Authored by bgamari on Jun 14 2018, 9:40 AM.

Details

Summary

This fixes Hadrian build failures due to D4683.

Test Plan

Test with Hadrian

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari created this revision.Jun 14 2018, 9:40 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 14 2018, 12:11 PM
This revision was automatically updated to reflect the committed changes.

Wait, how does this even work? Is this file processed by CPP? If so, is it processed multiple times for different ways?

Well, this doesn't work: https://circleci.com/gh/snowleopard/hadrian/365.

And now I'm also not sure how it's supposed to work... Indeed, we process this file only once.

Perhaps, we should just move such conditionals to Hadrian.

Sigh, indeed it doesn't work; this file is processed by autoconf, not CPP. Reverting.

However, I somehow wasn't able to reproduce the reported failure.

@bgamari The failure due to missing findPtr happens only on OS X (I think it has a stricter linker).

What about simply removing these lines from rts.cabal.in for now? This could probably be handled as a custom RTS-specific setting instead.

We could make findPtr exist for all ways, I think that would be the simplest fix.

We could make findPtr exist for all ways, I think that would be the simplest fix.

Yes, that sounds like a simler fix. Do you mean something like this?

diff --git a/rts/Printer.c b/rts/Printer.c
index 4019ef1710..488d4be33e 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -774,8 +774,6 @@ extern void DEBUG_LoadSymbols( const char *name STG_UNUSED )

 #endif /* USING_LIBBFD */

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

 static int
@@ -866,6 +864,8 @@ void printObj( StgClosure *obj )

 #endif /* DEBUG */

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

@snowleopard You would also need to give it an empty definition in non-DEBUG configurations.

@simonmar Oops, yes, of course. I'll give it a try.