summaryrefslogtreecommitdiff
path: root/ghc/interpreter/object.c
diff options
context:
space:
mode:
authorsewardj <unknown>2000-03-23 12:19:22 +0000
committersewardj <unknown>2000-03-23 12:19:22 +0000
commit7e3624baf92d261768db5575bfdbb89e9d2d92dd (patch)
treed25997975c63e3dea6c665d22f7088d217463155 /ghc/interpreter/object.c
parent37d4af060178066271a344d522d3c2301ad57583 (diff)
downloadhaskell-7e3624baf92d261768db5575bfdbb89e9d2d92dd.tar.gz
[project @ 2000-03-23 12:19:22 by sewardj]
Allow clients of the linker library (object.[ch]) to specify, portably, symbols they wish to ignore in calls to ocGetNames(). Use this modification to support ignoring the multiple occurrences of ghc_cc_ID.
Diffstat (limited to 'ghc/interpreter/object.c')
-rw-r--r--ghc/interpreter/object.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/ghc/interpreter/object.c b/ghc/interpreter/object.c
index fd05a5e37e..4da4e062a6 100644
--- a/ghc/interpreter/object.c
+++ b/ghc/interpreter/object.c
@@ -39,12 +39,13 @@ static int sortSymbols ( ObjectCode* oc );
* Arch-independent interface to the runtime linker
* ------------------------------------------------------------------------*/
-ObjectCode* ocNew ( void (*errMsg)(char*),
- void* (*clientLookup)(char*),
+ObjectCode* ocNew ( void (*errMsg)(char*),
+ void* (*clientLookup)(char*),
+ int (*clientWantsSymbol)(char*),
char* objFileName,
int objFileSize )
{
- ObjectCode* oc = malloc(sizeof(ObjectCode));
+ ObjectCode* oc = malloc(sizeof(ObjectCode));
if (!oc) {
errMsg("ocNew: can't allocate memory for object code record");
return NULL;
@@ -60,25 +61,26 @@ ObjectCode* ocNew ( void (*errMsg)(char*),
return NULL;
# endif
- oc->status = OBJECT_NOTINUSE;
- oc->objFileName = objFileName;
- oc->objFileSize = objFileSize;
- oc->errMsg = errMsg;
- oc->clientLookup = clientLookup;
+ oc->status = OBJECT_NOTINUSE;
+ oc->objFileName = objFileName;
+ oc->objFileSize = objFileSize;
+ oc->errMsg = errMsg;
+ oc->clientLookup = clientLookup;
+ oc->clientWantsSymbol = clientWantsSymbol;
- oc->oImage = malloc ( objFileSize );
+ oc->oImage = malloc ( objFileSize );
if (!oc->oImage) {
free(oc);
errMsg("ocNew: can't allocate memory for object code");
return NULL;
}
- oc->oTab = NULL;
- oc->sizeoTab = 0;
- oc->usedoTab = 0;
- oc->sectionTab = NULL;
- oc->sizesectionTab = 0;
- oc->usedsectionTab = 0;
- oc->next = NULL;
+ oc->oTab = NULL;
+ oc->sizeoTab = 0;
+ oc->usedoTab = 0;
+ oc->sectionTab = NULL;
+ oc->sizesectionTab = 0;
+ oc->usedsectionTab = 0;
+ oc->next = NULL;
return oc;
}
@@ -212,7 +214,12 @@ static void* genericExpand ( void* tab,
/* returns 1 if success, 0 if error */
static int addSymbol ( ObjectCode* oc, char* nm, void* ad )
{
- OSym* newTab
+ OSym* newTab;
+
+ if (oc->clientWantsSymbol && !oc->clientWantsSymbol(nm))
+ return 1;
+
+ newTab
= genericExpand ( oc->oTab,
&(oc->sizeoTab),
oc->usedoTab,
@@ -273,7 +280,8 @@ static int sortSymbols ( ObjectCode* oc )
return 0;
}
if (j == 0) {
- oc->errMsg("sortSymbols: duplicate symbols in object file");
+ oc->errMsg("sortSymbols: duplicate symbols in object file:");
+ oc->errMsg(oc->oTab[i].nm);
return 0;
}
}