Commit 7d7c187b authored by Simon Marlow's avatar Simon Marlow

Declare RTS-private prototypes with __attribute__((visibility("hidden")))

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.
parent acdd7c95
......@@ -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[]);
/*
......
......@@ -11,19 +11,19 @@
// 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 */
......@@ -11,15 +11,15 @@
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 */
......@@ -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 */
......@@ -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 */
......@@ -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
......
......@@ -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 */
......@@ -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 */
......@@ -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
......@@ -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 */
......@@ -9,6 +9,6 @@
#ifndef INTERPRETER_H
#define INTERPRETER_H
extern Capability *interpretBCO (Capability* cap);
RTS_PRIVATE Capability *interpretBCO (Capability* cap);
#endif /* INTERPRETER_H */
......@@ -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'.
......
......@@ -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 */
......@@ -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 */
......@@ -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 */
......@@ -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 */
......@@ -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 */
......@@ -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 */
......@@ -14,10 +14,12 @@
#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 */
......@@ -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 */
......@@ -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 */
......@@ -25,12 +25,14 @@
#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 */
......
......@@ -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 */
......@@ -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 */
......@@ -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
......@@ -19,23 +21,22 @@
# 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 */
......
......@@ -14,6 +14,8 @@
#include "Capability.h"
#include "eventlog/EventLog.h"
#pragma GCC visibility push(hidden)