Declare RTS-private prototypes with __attribute__((visibility("hidden")))
authorSimon Marlow <marlowsd@gmail.com>
Wed, 5 Aug 2009 10:21:59 +0000 (10:21 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Wed, 5 Aug 2009 10:21:59 +0000 (10:21 +0000)
This has no effect with static libraries, but when the RTS is in a
shared library it does two things:

 - it prevents the function from being exposed by the shared library

 - internal calls to the function can use the faster non-PLT calls,
   because the function cannot be overriden at link time.

57 files changed:
includes/rts/Flags.h
rts/Apply.h
rts/Arena.h
rts/AwaitEvent.h
rts/Capability.h
rts/Disassembler.h
rts/FrontPanel.h
rts/GetTime.h
rts/Globals.h
rts/Hash.h
rts/Interpreter.h
rts/LdvProfile.h
rts/Papi.h
rts/Printer.h
rts/ProfHeap.h
rts/Profiling.h
rts/Proftimer.h
rts/RaiseAsync.h
rts/RetainerProfile.h
rts/RetainerSet.h
rts/RtsMain.h
rts/RtsSignals.h
rts/RtsUtils.h
rts/STM.h
rts/Sanity.h
rts/Schedule.h
rts/Sparks.h
rts/Stable.h
rts/Stats.h
rts/StgPrimFloat.h
rts/StgRun.h
rts/Task.h
rts/ThreadLabels.h
rts/ThreadPaused.h
rts/Threads.h
rts/Ticker.h
rts/Ticky.h
rts/Timer.h
rts/Trace.h
rts/Updates.h
rts/Weak.h
rts/eventlog/EventLog.h
rts/posix/FileLock.h
rts/posix/Itimer.h
rts/posix/Signals.h
rts/posix/TTY.h
rts/sm/BlockAlloc.h
rts/sm/Compact.h
rts/sm/Evac.h
rts/sm/GC.h
rts/sm/GCThread.h
rts/sm/GCUtils.h
rts/sm/MarkWeak.h
rts/sm/OSMem.h
rts/sm/Scav.h
rts/sm/Storage.h
rts/sm/Sweep.h

index dca727a..d9e3be9 100644 (file)
@@ -208,9 +208,9 @@ extern RTS_FLAGS RtsFlags;
 
 /* Routines that operate-on/to-do-with RTS flags: */
 
-extern void initRtsFlagsDefaults(void);
-extern void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
-extern void setProgName(char *argv[]);
+void initRtsFlagsDefaults(void);
+void setupRtsFlags(int *argc, char *argv[], int *rts_argc, char *rts_argv[]);
+void setProgName(char *argv[]);
 
 
 /*
index 76e36cb..70faed4 100644 (file)
 
 // canned slow entry points, indexed by arg type (ARG_P, ARG_PP, etc.)
 #ifdef IN_STG_CODE
-extern StgWord stg_ap_stack_entries[];
+extern RTS_PRIVATE StgWord stg_ap_stack_entries[];
 #else
-extern StgFun *stg_ap_stack_entries[];
+extern RTS_PRIVATE StgFun *stg_ap_stack_entries[];
 #endif
 
 // canned register save code for heap check failure in a function
 #ifdef IN_STG_CODE
-extern StgWord stg_stack_save_entries[];
+extern RTS_PRIVATE StgWord stg_stack_save_entries[];
 #else
-extern StgFun *stg_stack_save_entries[];
+extern RTS_PRIVATE StgFun *stg_stack_save_entries[];
 #endif
 
 // canned bitmap for each arg type
-extern StgWord stg_arg_bitmaps[];
+extern RTS_PRIVATE StgWord stg_arg_bitmaps[];
 
 #endif /* APPLY_H */
index 7a2989e..086a020 100644 (file)
 typedef struct _Arena Arena;
 
 // Start a new arena
-extern Arena * newArena   ( void );
+RTS_PRIVATE Arena * newArena   ( void );
 
 // Allocate memory in an arena
-extern void  * arenaAlloc ( Arena *, size_t );
+RTS_PRIVATE void  * arenaAlloc ( Arena *, size_t );
 
 // Free an entire arena
-extern void    arenaFree  ( Arena * );
+RTS_PRIVATE void arenaFree  ( Arena * );
 
 // For internal use only:
-extern unsigned long arenaBlocks( void );
+RTS_PRIVATE unsigned long arenaBlocks( void );
 
 #endif /* ARENA_H */
index 758e81a..ecc13b8 100644 (file)
@@ -17,8 +17,8 @@
  * Called from STG :  NO
  * Locks assumed   :  sched_mutex
  */
-void awaitEvent(rtsBool wait);  /* In posix/Select.c or
-                                * win32/AwaitEvent.c */
+RTS_PRIVATE void awaitEvent(rtsBool wait);  /* In posix/Select.c or
+                                             * win32/AwaitEvent.c */
 #endif
 
 #endif /* AWAITEVENT_H */
index fb199e2..6fdc002 100644 (file)
@@ -22,6 +22,8 @@
 #include "Task.h"
 #include "Sparks.h"
 
+#pragma GCC visibility push(hidden)
+
 struct Capability_ {
     // State required by the STG virtual machine when running Haskell
     // code.  During STG execution, the BaseReg register always points
@@ -330,4 +332,6 @@ contextSwitchCapability (Capability *cap)
     cap->context_switch = 1;
 }
 
+#pragma GCC visibility pop
+
 #endif /* CAPABILITY_H */
index 2851097..c6f7156 100644 (file)
@@ -11,8 +11,8 @@
 
 #ifdef DEBUG
 
-extern int  disInstr   ( StgBCO *bco, int pc );
-extern void disassemble( StgBCO *bco );
+RTS_PRIVATE int  disInstr   ( StgBCO *bco, int pc );
+RTS_PRIVATE void disassemble( StgBCO *bco );
 
 #endif
 
index de3b741..07508aa 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef FRONTPANEL_H
 #define FRONTPANEL_H
 
+#pragma GCC visibility push(hidden)
+
 #ifdef RTS_GTK_FRONTPANEL
 
 #include "Rts.h"  /* needed because this file gets included by
@@ -31,5 +33,7 @@ extern gboolean continue_now, stop_now, quit;
 
 #endif /* RTS_GTK_FRONTPANEL */
 
+#pragma GCC visibility pop
+
 #endif /* FRONTPANEL_H */
 
index 5f02df0..11da641 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef GETTIME_H
 #define GETTIME_H
 
+#pragma GCC visibility push(hidden)
+
 // We'll use a fixed resolution of usec for now.  The machine
 // dependent implementation may have a different resolution, but we'll
 // normalise to this for the machine independent interface.
@@ -23,4 +25,6 @@ void  getProcessTimes       (Ticks *user, Ticks *elapsed);
 // Not strictly timing, but related
 nat   getPageFaults         (void);
 
+#pragma GCC visibility pop
+
 #endif /* GETTIME_H */
index bc68904..445072c 100644 (file)
@@ -12,8 +12,8 @@
 #ifndef GLOBALS_H
 #define GLOBALS_H
 
-void initGlobalStore(void);
-void exitGlobalStore(void);
+RTS_PRIVATE void initGlobalStore(void);
+RTS_PRIVATE void exitGlobalStore(void);
 
 #endif
 
index d16f9ae..c5eec37 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef HASH_H
 #define HASH_H
 
+#pragma GCC visibility push(hidden)
+
 typedef struct hashtable HashTable; /* abstract */
 
 /* Hash table access where the keys are StgWords */
@@ -45,5 +47,7 @@ void freeHashTable ( HashTable *table, void (*freeDataFun)(void *) );
 
 void exitHashTable ( void );
 
+#pragma GCC visibility pop
+
 #endif /* HASH_H */
 
index d66e636..fd4f7b9 100644 (file)
@@ -9,6 +9,6 @@
 #ifndef INTERPRETER_H
 #define INTERPRETER_H
 
-extern Capability *interpretBCO (Capability* cap);
+RTS_PRIVATE Capability *interpretBCO (Capability* cap);
 
 #endif /* INTERPRETER_H */
index 2721547..b441804 100644 (file)
@@ -14,8 +14,8 @@
 
 #include "ProfHeap.h"
 
-extern void LdvCensusForDead ( nat );
-extern void LdvCensusKillAll ( void );
+RTS_PRIVATE void LdvCensusForDead ( nat );
+RTS_PRIVATE void LdvCensusKillAll ( void );
 
 // Creates a 0-filled slop of size 'howManyBackwards' backwards from the
 // address 'from'. 
index 8f58f6d..8658d8c 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef PAPI_H
 #define PAPI_H
 
+#pragma GCC visibility push(hidden)
+
 /* Check the error value of a PAPI call, reporting an error, if needed */
 extern int papi_error;
 
@@ -29,4 +31,6 @@ void papi_stop_gc1_count(void);
 void papi_thread_start_gc1_count(int event_set);
 void papi_thread_stop_gc1_count(int event_set);
 
+#pragma GCC visibility pop
+
 #endif /* PAPI_H */
index f627049..33fe6a8 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef PRINTER_H
 #define PRINTER_H
 
+#pragma GCC visibility push(hidden)
+
 extern void       printPtr        ( StgPtr p );
 extern void       printObj        ( StgClosure *obj );
 
@@ -30,5 +32,7 @@ extern void DEBUG_LoadSymbols( char *name );
 extern const char *lookupGHCName( void *addr );
 #endif
 
+#pragma GCC visibility pop
+
 #endif /* PRINTER_H */
 
index a3da424..b781235 100644 (file)
@@ -9,10 +9,14 @@
 #ifndef PROFHEAP_H
 #define PROFHEAP_H
 
-extern void    heapCensus( void );
-extern nat     initHeapProfiling( void );
-extern void    endHeapProfiling( void );
-extern void    LDV_recordDead( StgClosure *c, nat size );
-extern rtsBool strMatchesSelector( char* str, char* sel );
+#pragma GCC visibility push(hidden)
+
+void    heapCensus         (void);
+nat     initHeapProfiling  (void);
+void    endHeapProfiling   (void);
+void    LDV_recordDead     (StgClosure *c, nat size);
+rtsBool strMatchesSelector (char* str, char* sel);
+
+#pragma GCC visibility pop
 
 #endif /* PROFHEAP_H */
index 8961da9..87d81e2 100644 (file)
@@ -11,6 +11,8 @@
 
 #include <stdio.h>
 
+#pragma GCC visibility push(hidden)
+
 void initProfiling1 (void);
 void freeProfiling1 (void);
 void initProfiling2 (void);
@@ -21,18 +23,20 @@ extern FILE *hp_file;
 
 #ifdef PROFILING
 
-void gen_XML_logfile     ( void );
+void gen_XML_logfile    ( void );
 void reportCCSProfiling ( void );
 
 void PrintNewStackDecls ( void );
 
-extern void fprintCCS( FILE *f, CostCentreStack *ccs );
-extern void fprintCCS_stderr( CostCentreStack *ccs );
+void fprintCCS( FILE *f, CostCentreStack *ccs );
+void fprintCCS_stderr( CostCentreStack *ccs );
 
 #ifdef DEBUG
-extern void debugCCS( CostCentreStack *ccs );
+void debugCCS( CostCentreStack *ccs );
 #endif
 
 #endif
 
+#pragma GCC visibility pop
+
 #endif /* PROFILING_H */
index 1379792..7d42956 100644 (file)
@@ -9,17 +9,21 @@
 #ifndef PROFTIMER_H
 #define PROFTIMER_H
 
-extern void initProfTimer      ( void );
-extern void handleProfTick     ( void );
+#pragma GCC visibility push(hidden)
+
+void initProfTimer      ( void );
+void handleProfTick     ( void );
 
 #ifdef PROFILING
-extern void stopProfTimer      ( void );
-extern void startProfTimer     ( void );
+void stopProfTimer      ( void );
+void startProfTimer     ( void );
 #endif
 
-extern void stopHeapProfTimer  ( void );
-extern void startHeapProfTimer ( void );
+void stopHeapProfTimer  ( void );
+void startHeapProfTimer ( void );
 
 extern rtsBool performHeapProfile;
 
+#pragma GCC visibility pop
+
 #endif /* PROFTIMER_H */
index 6f7c305..52a0aa4 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef RAISEASYNC_H
 #define RAISEASYNC_H
 
+#pragma GCC visibility push(hidden)
+
 #define THROWTO_SUCCESS   0
 #define THROWTO_BLOCKED   1
 
@@ -66,5 +68,7 @@ interruptible(StgTSO *t)
 
 #endif /* CMINUSMINUS */
 
+#pragma GCC visibility pop
+
 #endif /* RAISEASYNC_H */
 
index da9a847..7278dc7 100644 (file)
 
 #include "RetainerSet.h"
 
-extern void  initRetainerProfiling ( void );
-extern void  endRetainerProfiling  ( void );
-extern void  retainerProfile       ( void );
-extern void resetStaticObjectForRetainerProfiling( StgClosure *static_objects );
+#pragma GCC visibility push(hidden)
+
+void initRetainerProfiling ( void );
+void endRetainerProfiling  ( void );
+void retainerProfile       ( void );
+void resetStaticObjectForRetainerProfiling( StgClosure *static_objects );
 
 extern StgWord flip;
 
@@ -41,6 +43,8 @@ retainerSetOf( StgClosure *c )
 extern lnat retainerStackBlocks ( void );
 #endif
 
+#pragma GCC visibility pop
+
 #endif /* PROFILING */
 
 #endif /* RETAINERPROFILE_H */
index 6a00e13..cbf8c1d 100644 (file)
@@ -14,6 +14,8 @@
 
 #ifdef PROFILING
 
+#pragma GCC visibility push(hidden)
+
 /*
   Type 'retainer' defines the retainer identity.
 
@@ -197,5 +199,7 @@ void outputAllRetainerSet(FILE *);
 //       the best place to define it.
 void printRetainer(FILE *, retainer);
 
+#pragma GCC visibility pop
+
 #endif /* PROFILING */
 #endif /* RETAINERSET_H */
index 7810f6f..4aabc56 100644 (file)
@@ -13,6 +13,6 @@
  * The entry point for Haskell programs that use a Haskell main function
  * -------------------------------------------------------------------------- */
 
-extern int hs_main(int argc, char *argv[], void (*main_init)(void), StgClosure *main_closure);
+int hs_main(int argc, char *argv[], void (*main_init)(void), StgClosure *main_closure);
 
 #endif /* RTSMAIN_H */
index 601a46b..3b569df 100644 (file)
 
 #if RTS_USER_SIGNALS
 
+#pragma GCC visibility push(hidden)
+
 /*
  * Function: initUserSignals()
  *
  * Initialize the console handling substrate.
  */
-extern void initUserSignals(void);
+void initUserSignals(void);
 
 /*
  * Function: initDefaultHandlers()
@@ -38,10 +40,10 @@ extern void initUserSignals(void);
  * Install any default signal/console handlers. Currently we install a
  * Ctrl+C handler that shuts down the RTS in an orderly manner.
  */
-extern void initDefaultHandlers(void);
-extern void resetDefaultHandlers(void);
+void initDefaultHandlers(void);
+void resetDefaultHandlers(void);
 
-extern void freeSignalHandlers(void);
+void freeSignalHandlers(void);
 
 /*
  * Function: blockUserSignals()
@@ -51,21 +53,21 @@ extern void freeSignalHandlers(void);
  * when emptying the queue by running the handlers.
  * 
  */
-extern void blockUserSignals(void);
+void blockUserSignals(void);
 
 /*
  * Function: unblockUserSignals()
  *
  * The inverse of blockUserSignals(); re-enable the deliver of console events.
  */
-extern void unblockUserSignals(void);
+void unblockUserSignals(void);
 
 /*
  * Function: awaitUserSignals()
  *
  * Wait for the next console event. Currently a NOP (returns immediately.)
  */
-extern void awaitUserSignals(void);
+void awaitUserSignals(void);
 
 /*
  * Function: markSignalHandlers()
@@ -73,7 +75,9 @@ extern void awaitUserSignals(void);
  * Evacuate the handler queue. _Assumes_ that console event delivery
  * has already been blocked.
  */
-extern void markSignalHandlers (evac_fn evac, void *user);
+void markSignalHandlers (evac_fn evac, void *user);
+
+#pragma GCC visibility pop
 
 #endif /* RTS_USER_SIGNALS */
 
index 241cbf3..a47f953 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef RTSUTILS_H
 #define RTSUTILS_H
 
+#pragma GCC visibility push(hidden)
+
 /* -----------------------------------------------------------------------------
  * (Checked) dynamic allocation
  * -------------------------------------------------------------------------- */
@@ -49,4 +51,6 @@ int genericRaise(int sig);
 
 int rts_isProfiled(void);
 
+#pragma GCC visibility pop
+
 #endif /* RTSUTILS_H */
index 3bf9765..1f28b9c 100644 (file)
--- a/rts/STM.h
+++ b/rts/STM.h
@@ -40,9 +40,7 @@
 #define STM_UNIPROC
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#pragma GCC visibility push(hidden)
 
 /*----------------------------------------------------------------------
 
@@ -50,7 +48,7 @@ extern "C" {
    --------------
 */
 
-extern void stmPreGCHook(void);
+void stmPreGCHook(void);
 
 /*----------------------------------------------------------------------
 
@@ -61,8 +59,8 @@ extern void stmPreGCHook(void);
 
 /* Create and enter a new transaction context */
 
-extern StgTRecHeader *stmStartTransaction(Capability *cap, StgTRecHeader *outer);
-extern StgTRecHeader *stmStartNestedTransaction(Capability *cap, StgTRecHeader *outer
+StgTRecHeader *stmStartTransaction(Capability *cap, StgTRecHeader *outer);
+StgTRecHeader *stmStartNestedTransaction(Capability *cap, StgTRecHeader *outer
 );
 
 /*
@@ -71,8 +69,8 @@ extern StgTRecHeader *stmStartNestedTransaction(Capability *cap, StgTRecHeader *
  * to that read set could change whether or not the tx should abort.
  */
 
-extern void stmAbortTransaction(Capability *cap, StgTRecHeader *trec);
-extern void stmFreeAbortedTRec(Capability *cap, StgTRecHeader *trec);
+void stmAbortTransaction(Capability *cap, StgTRecHeader *trec);
+void stmFreeAbortedTRec(Capability *cap, StgTRecHeader *trec);
 
 /*
  * Ensure that a subsequent commit / validation will fail.  We use this 
@@ -83,14 +81,14 @@ extern void stmFreeAbortedTRec(Capability *cap, StgTRecHeader *trec);
  * in case other threads' updates make it valid in the mean time.
  */
 
-extern void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec);
+void stmCondemnTransaction(Capability *cap, StgTRecHeader *trec);
 
 /*
  * Return the trec within which the specified trec was created (not
  * valid if trec==NO_TREC).
  */
 
-extern StgTRecHeader *stmGetEnclosingTRec(StgTRecHeader *trec);
+StgTRecHeader *stmGetEnclosingTRec(StgTRecHeader *trec);
 
 /*----------------------------------------------------------------------
 
@@ -106,7 +104,7 @@ extern StgTRecHeader *stmGetEnclosingTRec(StgTRecHeader *trec);
   threads at GC (in case they are stuck looping)
 */
 
-extern StgBool stmValidateNestOfTransactions(StgTRecHeader *trec);
+StgBool stmValidateNestOfTransactions(StgTRecHeader *trec);
 
 /*----------------------------------------------------------------------
 
@@ -152,12 +150,12 @@ extern StgBool stmValidateNestOfTransactions(StgTRecHeader *trec);
  * transaction.  
  */
 
-extern StgInvariantCheckQueue *stmGetInvariantsToCheck(Capability *cap, 
-                                                      StgTRecHeader *trec);
+StgInvariantCheckQueue *stmGetInvariantsToCheck(Capability *cap, 
+                                                StgTRecHeader *trec);
 
-extern void stmAddInvariantToCheck(Capability *cap, 
-                                  StgTRecHeader *trec,
-                                  StgClosure *code);
+void stmAddInvariantToCheck(Capability *cap, 
+                            StgTRecHeader *trec,
+                            StgClosure *code);
 
 /*
  * Test whether the current transaction context is valid and, if so,
@@ -166,8 +164,8 @@ extern void stmAddInvariantToCheck(Capability *cap,
  * been committed to.
  */
 
-extern StgBool stmCommitTransaction(Capability *cap, StgTRecHeader *trec);
-extern StgBool stmCommitNestedTransaction(Capability *cap, StgTRecHeader *trec);
+StgBool stmCommitTransaction(Capability *cap, StgTRecHeader *trec);
+StgBool stmCommitNestedTransaction(Capability *cap, StgTRecHeader *trec);
 
 /*
  * Test whether the current transaction context is valid and, if so,
@@ -176,11 +174,9 @@ extern StgBool stmCommitNestedTransaction(Capability *cap, StgTRecHeader *trec);
  * if the thread is already waiting.  
  */
 
-extern StgBool stmWait(Capability *cap,
-                       StgTSO *tso, 
-                       StgTRecHeader *trec);
+StgBool stmWait(Capability *cap, StgTSO *tso, StgTRecHeader *trec);
 
-extern void stmWaitUnlock(Capability *cap, StgTRecHeader *trec);
+void stmWaitUnlock(Capability *cap, StgTRecHeader *trec);
 
 /*
  * Test whether the current transaction context is valid and, if so,
@@ -190,7 +186,7 @@ extern void stmWaitUnlock(Capability *cap, StgTRecHeader *trec);
  * thread is not waiting.
  */
 
-extern StgBool stmReWait(Capability *cap, StgTSO *tso);
+StgBool stmReWait(Capability *cap, StgTSO *tso);
 
 /*----------------------------------------------------------------------
 
@@ -198,8 +194,7 @@ extern StgBool stmReWait(Capability *cap, StgTSO *tso);
    --------------------------
 */
 
-extern StgTVar *stmNewTVar(Capability *cap,
-                           StgClosure *new_value);
+StgTVar *stmNewTVar(Capability *cap, StgClosure *new_value);
 
 /*----------------------------------------------------------------------
 
@@ -212,18 +207,18 @@ extern StgTVar *stmNewTVar(Capability *cap,
  * thread's current transaction.
  */
 
-extern StgClosure *stmReadTVar(Capability *cap,
-                               StgTRecHeader *trec, 
-                              StgTVar *tvar);
+StgClosure *stmReadTVar(Capability *cap,
+                        StgTRecHeader *trec, 
+                        StgTVar *tvar);
 
 /* Update the logical contents of 'tvar' within the context of the
  * thread's current transaction.
  */
 
-extern void stmWriteTVar(Capability *cap,
-                         StgTRecHeader *trec,
-                        StgTVar *tvar, 
-                        StgClosure *new_value);
+void stmWriteTVar(Capability *cap,
+                  StgTRecHeader *trec,
+                  StgTVar *tvar, 
+                  StgClosure *new_value);
 
 /*----------------------------------------------------------------------*/
 
@@ -237,9 +232,7 @@ extern void stmWriteTVar(Capability *cap,
 
 /*----------------------------------------------------------------------*/
 
-#ifdef __cplusplus
-}
-#endif
+#pragma GCC visibility pop
 
 #endif /* STM_H */
 
index 3020246..f27c395 100644 (file)
@@ -11,6 +11,8 @@
 
 #ifdef DEBUG
 
+#pragma GCC visibility push(hidden)
+
 # if defined(PAR)
 # define PVM_PE_MASK    0xfffc0000
 # define MAX_PVM_PES    MAX_PES
 # endif
 
 /* debugging routines */
-extern void checkHeap      ( bdescr *bd );
-extern void checkHeapChunk ( StgPtr start, StgPtr end );
-extern void checkLargeObjects ( bdescr *bd );
-extern void checkTSO       ( StgTSO* tso );
-extern void checkGlobalTSOList ( rtsBool checkTSOs );
-extern void checkStaticObjects ( StgClosure* static_objects );
-extern void checkStackChunk    ( StgPtr sp, StgPtr stack_end );
-extern StgOffset checkStackFrame ( StgPtr sp );
-extern StgOffset checkClosure  ( StgClosure* p );
-
-extern void checkMutableList   ( bdescr *bd, nat gen );
-extern void checkMutableLists ( rtsBool checkTSOs );
-
-extern void checkBQ (StgTSO *bqe, StgClosure *closure);
-
-/* test whether an object is already on update list */
-extern rtsBool isBlackhole( StgTSO* tso, StgClosure* p );
+void checkHeap      ( bdescr *bd );
+void checkHeapChunk ( StgPtr start, StgPtr end );
+void checkLargeObjects ( bdescr *bd );
+void checkTSO       ( StgTSO* tso );
+void checkGlobalTSOList ( rtsBool checkTSOs );
+void checkStaticObjects ( StgClosure* static_objects );
+void checkStackChunk    ( StgPtr sp, StgPtr stack_end );
+StgOffset checkStackFrame ( StgPtr sp );
+StgOffset checkClosure  ( StgClosure* p );
+
+void checkMutableList   ( bdescr *bd, nat gen );
+void checkMutableLists ( rtsBool checkTSOs );
+
+void checkBQ (StgTSO *bqe, StgClosure *closure);
+
+#pragma GCC visibility pop
 
 #endif /* DEBUG */
  
index 378bd68..c83b6fd 100644 (file)
@@ -14,6 +14,8 @@
 #include "Capability.h"
 #include "eventlog/EventLog.h"
 
+#pragma GCC visibility push(hidden)
+
 /* initScheduler(), exitScheduler()
  * Called from STG :  no
  * Locks assumed   :  none
@@ -239,5 +241,7 @@ emptyThreadQueues(Capability *cap)
 
 #endif /* !IN_STG_CODE */
 
+#pragma GCC visibility pop
+
 #endif /* SCHEDULE_H */
 
index df037b5..25affbb 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "WSDeque.h"
 
+#pragma GCC visibility push(hidden)
+
 /* typedef for SparkPool in RtsTypes.h */
 
 #if defined(THREADED_RTS)
@@ -63,4 +65,6 @@ INLINE_HEADER void discardSparks (SparkPool *pool)
 
 #endif // THREADED_RTS
 
+#pragma GCC visibility pop
+
 #endif /* SPARKS_H */
index 258a6be..b1b25ff 100644 (file)
@@ -17,7 +17,9 @@
 
 #include "sm/GC.h" // for evac_fn below
 
-void         freeStablePtr (StgStablePtr sp);
+#pragma GCC visibility push(hidden)
+
+void    freeStablePtr         ( StgStablePtr sp );
 
 void    initStablePtrTable    ( void );
 void    exitStablePtrTable    ( void );
@@ -31,4 +33,6 @@ void    updateStablePtrTable  ( rtsBool full );
 void    stablePtrPreGC        ( void );
 void    stablePtrPostGC       ( void );
 
+#pragma GCC visibility pop
+
 #endif /* STABLE_H */
index 4b98739..234d64c 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "GetTime.h"
 
+#pragma GCC visibility push(hidden)
+
 void      stat_startInit(void);
 void      stat_endInit(void);
 
@@ -59,5 +61,6 @@ Ticks stat_getElapsedTime(void);
 void statsPrintf( char *s, ... ) 
     GNUC3_ATTRIBUTE(format (printf, 1, 2));
 
+#pragma GCC visibility pop
 
 #endif /* STATS_H */
index 5de8360..13d3a59 100644 (file)
@@ -9,13 +9,17 @@
 #ifndef STGPRIMFLOAT_H
 #define STGPRIMFLOAT_H
 
+#pragma GCC visibility push(hidden)
+
 /* grimy low-level support functions defined in StgPrimFloat.c */
-extern void      __decodeDouble_2Int (I_ *man_sign, W_ *man_high, W_ *man_low, I_ *exp, StgDouble dbl);
-extern void      __decodeFloat_Int (I_ *man, I_ *exp, StgFloat flt);
-extern StgDouble __2Int_encodeDouble (I_ j_high, I_ j_low, I_ e);
-extern StgDouble __int_encodeDouble (I_ j, I_ e);
-extern StgDouble __word_encodeDouble (W_ j, I_ e);
-extern StgFloat  __int_encodeFloat (I_ j, I_ e);
-extern StgFloat  __word_encodeFloat (W_ j, I_ e);
+void      __decodeDouble_2Int (I_ *man_sign, W_ *man_high, W_ *man_low, I_ *exp, StgDouble dbl);
+void      __decodeFloat_Int (I_ *man, I_ *exp, StgFloat flt);
+StgDouble __2Int_encodeDouble (I_ j_high, I_ j_low, I_ e);
+StgDouble __int_encodeDouble (I_ j, I_ e);
+StgDouble __word_encodeDouble (W_ j, I_ e);
+StgFloat  __int_encodeFloat (I_ j, I_ e);
+StgFloat  __word_encodeFloat (W_ j, I_ e);
+
+#pragma GCC visibility pop
 
 #endif /* STGPRIMFLOAT_H */
index 12d1475..f277097 100644 (file)
@@ -9,6 +9,6 @@
 #ifndef STGRUN_H
 #define STGRUN_H
 
-extern StgRegTable * StgRun(StgFunPtr f, StgRegTable *basereg);
+RTS_PRIVATE StgRegTable * StgRun (StgFunPtr f, StgRegTable *basereg);
 
 #endif /* STGRUN_H */
index c11afb5..b18bcfb 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "GetTime.h"
 
+#pragma GCC visibility push(hidden)
+
 /* 
    Definition of a Task
    --------------------
@@ -259,4 +261,6 @@ taskEnter (Task *task)
     setMyTask(task);
 }
 
+#pragma GCC visibility pop
+
 #endif /* TASK_H */
index 60289ef..550e286 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef THREADLABELS_H
 #define THREADLABELS_H
 
+#pragma GCC visibility push(hidden)
+
 #if defined(DEBUG)
 void    initThreadLabelTable (void);
 void    freeThreadLabelTable (void);
@@ -19,4 +21,6 @@ void    removeThreadLabel    (StgWord key);
 void    labelThread          (StgPtr tso, char *label);
 #endif
 
+#pragma GCC visibility pop
+
 #endif /* THREADLABELS_H */
index 60cded2..197b8d3 100644 (file)
@@ -9,6 +9,6 @@
 #ifndef THREADPAUSED_H
 #define THREADPAUSED_H
 
-void threadPaused ( Capability *cap, StgTSO * );
+RTS_PRIVATE void threadPaused ( Capability *cap, StgTSO * );
 
 #endif /* THREADPAUSED_H */
index d17235a..e58b0db 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef THREADS_H
 #define THREADS_H
 
+#pragma GCC visibility push(hidden)
+
 StgTSO * unblockOne (Capability *cap, StgTSO *tso);
 StgTSO * unblockOne_ (Capability *cap, StgTSO *tso, rtsBool allow_migrate);
 
@@ -27,4 +29,6 @@ void printAllThreads (void);
 void printThreadQueue (StgTSO *t);
 #endif
 
+#pragma GCC visibility pop
+
 #endif /* THREADS_H */
index a39e7d6..159820d 100644 (file)
@@ -9,11 +9,15 @@
 #ifndef TICKER_H
 #define TICKER_H
 
+#pragma GCC visibility push(hidden)
+
 typedef void (*TickProc)(int);
 
-extern void initTicker  (nat ms, TickProc handle_tick);
-extern void startTicker (void);
-extern void stopTicker  (void);
-extern void exitTicker  (void);
+void initTicker  (nat ms, TickProc handle_tick);
+void startTicker (void);
+void stopTicker  (void);
+void exitTicker  (void);
+
+#pragma GCC visibility pop
 
 #endif /* TICKER_H */
index c8da50a..a32a7a6 100644 (file)
@@ -9,6 +9,6 @@
 #ifndef TICKY_H
 #define TICKY_H
 
-void PrintTickyInfo(void);
+RTS_PRIVATE void PrintTickyInfo(void);
 
 #endif /* TICKY_H */
index c679a58..f0b5459 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef TIMER_H
 #define TIMER_H
 
-void initTimer (void);
-void exitTimer (void);
+RTS_PRIVATE void initTimer (void);
+RTS_PRIVATE void exitTimer (void);
 
 #endif /* TIMER_H */
index fc19e89..8820075 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef TRACE_H
 #define TRACE_H
 
+#pragma GCC visibility push(hidden)
+
 // -----------------------------------------------------------------------------
 // Tracing functions
 // -----------------------------------------------------------------------------
@@ -88,4 +90,6 @@ traceClass (StgWord32 class) { return (classes_enabled & class); }
 
 // -----------------------------------------------------------------------------
 
+#pragma GCC visibility pop
+
 #endif /* TRACE_H */
index 843be84..3b37409 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef UPDATES_H
 #define UPDATES_H
 
+#pragma GCC visibility push(hidden)
+
 /* -----------------------------------------------------------------------------
    Updates
 
@@ -225,4 +227,7 @@ no_slop:
     }                                                          \
   }
 #endif /* CMINUSMINUS */
+
+#pragma GCC visibility pop
+
 #endif /* UPDATES_H */
index 4f60bf9..2c831d8 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "Capability.h"
 
+#pragma GCC visibility push(hidden)
+
 extern rtsBool running_finalizers;
 extern StgWeak * weak_ptr_list;
 
@@ -19,5 +21,7 @@ void runAllCFinalizers(StgWeak *w);
 void scheduleFinalizers(Capability *cap, StgWeak *w);
 void markWeakList(void);
 
+#pragma GCC visibility pop
+
 #endif /* WEAK_H */
 
index 1090370..0358256 100644 (file)
@@ -12,6 +12,8 @@
 #include "rts/EventLogFormat.h"
 #include "Capability.h"
 
+#pragma GCC visibility push(hidden)
+
 #ifdef EVENTLOG
 
 /*
@@ -49,4 +51,6 @@ INLINE_HEADER void postEvent(Capability *cap  STG_UNUSED,
 
 #endif
 
+#pragma GCC visibility pop
+
 #endif /* EVENTLOG_H */
index 2edee5b..508cee8 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef POSIX_FILELOCK_H
 #define POSIX_FILELOCK_H
 
-void initFileLocking(void);
-void freeFileLocking(void);
+RTS_PRIVATE void initFileLocking(void);
+RTS_PRIVATE void freeFileLocking(void);
 
 #endif /* POSIX_FILELOCK_H */
index 4cae935..b67c8c4 100644 (file)
@@ -9,6 +9,6 @@
 #ifndef ITIMER_H
 #define ITIMER_H
 
-extern lnat getourtimeofday   ( void );
+RTS_PRIVATE lnat getourtimeofday ( void );
 
 #endif /* ITIMER_H */
index e1d550f..30bc63e 100644 (file)
@@ -13,7 +13,9 @@
 # include <signal.h>
 #endif
 
-extern rtsBool anyUserHandlers(void);
+#pragma GCC visibility push(hidden)
+
+rtsBool anyUserHandlers(void);
 
 #if !defined(THREADED_RTS)
 extern siginfo_t pending_handler_buf[];
@@ -24,5 +26,7 @@ void startSignalHandlers(Capability *cap);
 
 extern StgInt *signal_handlers;
 
+#pragma GCC visibility pop
+
 #endif /* POSIX_SIGNALS_H */
 
index f291d30..7b8e16b 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef POSIX_TTY_H
 #define POSIX_TTY_H
 
-void resetTerminalSettings (void);
+RTS_PRIVATE void resetTerminalSettings (void);
 
 #endif /* POSIX_TTY_H */
-
index 776df9b..86836e4 100644 (file)
@@ -9,16 +9,20 @@
 #ifndef BLOCK_ALLOC_H
 #define BLOCK_ALLOC_H
 
+#pragma GCC visibility push(hidden)
+
 /* Debugging  -------------------------------------------------------------- */
 
 #ifdef DEBUG
-extern void checkFreeListSanity(void);
-nat         countFreeList(void);
-void        markBlocks (bdescr *bd);
-void        reportUnmarkedBlocks (void);
+void checkFreeListSanity(void);
+nat  countFreeList(void);
+void markBlocks (bdescr *bd);
+void reportUnmarkedBlocks (void);
 #endif
 
 extern lnat n_alloc_blocks;   // currently allocated blocks
 extern lnat hw_alloc_blocks;  // high-water allocated blocks
 
+#pragma GCC visibility pop
+
 #endif /* BLOCK_ALLOC_H */
index 7a237ac..1e89ad3 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef SM_COMPACT_H
 #define SM_COMPACT_H
 
+#pragma GCC visibility push(hidden)
+
 INLINE_HEADER rtsBool
 mark_stack_empty(void)
 {
@@ -74,6 +76,8 @@ is_marked(StgPtr p, bdescr *bd)
     return (*bitmap_word & bit_mask);
 }
 
-extern void compact (StgClosure *static_objects);
+void compact (StgClosure *static_objects);
+
+#pragma GCC visibility pop
 
 #endif /* SM_COMPACT_H */
index 78d024f..ca5032f 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef SM_EVAC_H
 #define SM_EVAC_H
 
+#pragma GCC visibility push(hidden)
+
 // Use a register argument for evacuate, if available.
 // Earlier, the regparm attribute was used whenever __GNUC__ >= 2, but this
 // generated warnings on PPC. So the use is restricted further.
@@ -35,5 +37,7 @@ REGPARM1 void evacuate1 (StgClosure **p);
 
 extern lnat thunk_selector_depth;
 
+#pragma GCC visibility pop
+
 #endif /* SM_EVAC_H */
 
index e746f09..2435c6c 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef SM_GC_H
 #define SM_GC_H
 
+#pragma GCC visibility push(hidden)
+
 void GarbageCollect(rtsBool force_major_gc, nat gc_type, Capability *cap);
 
 typedef void (*evac_fn)(void *user, StgClosure **root);
@@ -56,4 +58,6 @@ void releaseGCThreads (Capability *cap);
 
 #define WORK_UNIT_WORDS 128
 
+#pragma GCC visibility pop
+
 #endif /* SM_GC_H */
index 9188a20..44ea537 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "WSDeque.h"
 
+#pragma GCC visibility push(hidden)
+
 /* -----------------------------------------------------------------------------
    General scheme
    
@@ -270,5 +272,7 @@ extern StgWord8 the_gc_thread[];
 
 #endif
 
+#pragma GCC visibility pop
+
 #endif // SM_GCTHREAD_H
 
index d68ce78..c8f8d55 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef SM_GCUTILS_H
 #define SM_GCUTILS_H
 
+#pragma GCC visibility push(hidden)
+
 bdescr *allocBlock_sync(void);
 void    freeChain_sync(bdescr *bd);
 
@@ -59,4 +61,6 @@ recordMutableGen_GC (StgClosure *p, nat gen_no)
     *bd->free++ = (StgWord)p;
 }
 
+#pragma GCC visibility pop
+
 #endif /* SM_GCUTILS_H */
index 2647a22..7fd81e5 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef SM_MARKWEAK_H
 #define SM_MARKWEAK_H
 
+#pragma GCC visibility push(hidden)
+
 extern StgWeak *old_weak_ptr_list;
 extern StgTSO *resurrected_threads;
 extern StgTSO *exception_threads;
@@ -23,4 +25,6 @@ rtsBool traverseWeakPtrList    ( void );
 void    markWeakPtrList        ( void );
 rtsBool traverseBlackholeQueue ( void );
 
+#pragma GCC visibility pop
+
 #endif /* SM_MARKWEAK_H */
index 3dbca23..92fe350 100644 (file)
@@ -9,10 +9,14 @@
 #ifndef SM_OSMEM_H
 #define SM_OSMEM_H
 
+#pragma GCC visibility push(hidden)
+
 void osMemInit(void);
 void *osGetMBlocks(nat n);
 void osFreeAllMBlocks(void);
 lnat getPageSize (void);
 void setExecutable (void *p, lnat len, rtsBool exec);
 
+#pragma GCC visibility pop
+
 #endif /* SM_OSMEM_H */
index 10b9ffd..259fe12 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef SM_SCAV_H
 #define SM_SCAV_H
 
+#pragma GCC visibility push(hidden)
+
 void    scavenge_loop (void);
 void    scavenge_mutable_list (bdescr *bd, generation *gen);
 void    scavenge_capability_mut_lists (Capability *cap);
@@ -24,5 +26,7 @@ void    scavenge_mutable_list1 (bdescr *bd, generation *gen);
 void    scavenge_capability_mut_Lists1 (Capability *cap);
 #endif
 
+#pragma GCC visibility pop
+
 #endif /* SM_SCAV_H */
 
index c6aa45e..ea744a7 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef SM_STORAGE_H
 #define SM_STORAGE_H
 
+#pragma GCC visibility push(hidden)
+
 /* -----------------------------------------------------------------------------
    Initialisation / De-initialisation
    -------------------------------------------------------------------------- */
@@ -166,4 +168,6 @@ void move_TSO  (StgTSO *src, StgTSO *dest);
 extern StgClosure * caf_list;
 extern StgClosure * revertible_caf_list;
 
+#pragma GCC visibility pop
+
 #endif /* SM_STORAGE_H */
index 562a934..f540cb3 100644 (file)
@@ -14,6 +14,6 @@
 #ifndef SM_SWEEP_H
 #define SM_SWEEP_H
 
-void sweep(step *gen);
+RTS_PRIVATE void sweep(step *gen);
 
 #endif /* SM_SWEEP_H */