Changeset 1098
- Timestamp:
- Jan 28, 2004, 5:28:02 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/weakld.c
-
Property cvs2svn:cvs-rev
changed from
1.23
to1.24
r1097 r1098 246 246 PWLDMOD pMod; 247 247 248 /** Array of modules refering this symbol. */ 249 PWLDMOD * paReferers; 250 251 /** Number of modules in the array. */ 252 unsigned cReferers; 253 248 254 /** Per type data union */ 249 255 union type_data … … 436 442 static int symSearchLibEnum(PWLD pWld, PWLDSYM pSym, void *pvUser); 437 443 static inline unsigned symHash(const char* pszSym, unsigned cch); 438 #ifdef WLD_ENABLED_DBG 444 static const char * symGetDescr(PWLDSYM pSym); 439 445 static void symDbg(PWLDSYM pSym, const char *pszMsg); 440 #endif441 446 static PWLDSYM symAdd(PWLD pWld, PWLDMOD pMod, unsigned fFlags, const char *pachName, int cchName, PWLDSYMACTION peAction); 442 447 static PWLDSYM symAddImport(PWLD pWld, PWLDMOD pMod, int fLibSearch, … … 1348 1353 1349 1354 if (pMod) 1350 modErr(pMod, "Unresolved symbol '%s'.", pSym->pszName);1355 modErr(pMod, "Unresolved symbol (%s) '%s'.", symGetDescr(pSym), pSym->pszName); 1351 1356 else 1352 wldErr(pWld, "Unresolved symbol '%s'.", pSym->pszName); 1357 wldErr(pWld, "Unresolved symbol (%s) '%s'.", symGetDescr(pSym), pSym->pszName); 1358 if (pSym->cReferers) 1359 { 1360 int i; 1361 wldInfo("The symbol is referenced by:\n"); 1362 for (i = 0; i < pSym->cReferers; i++) 1363 { 1364 pMod = pSym->paReferers[i]; 1365 if (pMod->pLib) 1366 fprintf(stderr, " %s(%s)\n", pMod->pLib->pszLibName, pMod->pszModName); 1367 else 1368 fprintf(stderr, " %s\n", pMod->pszModName); 1369 } 1370 } 1353 1371 return 0; 1354 1372 } … … 1411 1429 1412 1430 1413 1414 1415 1416 1417 1418 #ifdef WLD_ENABLED_DBG 1431 /** 1432 * Makes a description of the symbol. 1433 * 1434 * @returns Pointer to static string buffer. 1435 * @param pSym Symbol to describe. 1436 */ 1437 static const char *symGetDescr(PWLDSYM pSym) 1438 { 1439 static char szDesc[256]; 1440 char *psz = &szDesc[0]; 1441 1442 switch (pSym->fFlags & WLDSF_TYPEMASK) 1443 { 1444 case WLDSF_PUBLIC: psz += sprintf(psz, "PUBLIC"); break; 1445 case WLDSF_COMM: psz += sprintf(psz, "COMM"); break; 1446 case WLDSF_IMPORT: psz += sprintf(psz, "IMPORT"); break; 1447 case WLDSF_UNDEF: psz += sprintf(psz, "UNDEF"); break; 1448 case WLDSF_WKEXT: psz += sprintf(psz, "WKEXT"); break; 1449 default: psz += sprintf(psz, "!!!internal error!!! "); asm("int $3"); break; 1450 } 1451 if (pSym->fFlags & WLDSF_WEAK) 1452 psz += sprintf(psz, " WEAK"); 1453 if (pSym->fFlags & WLDSF_ALIAS) 1454 psz += sprintf(psz, " ALIAS"); 1455 if (pSym->fFlags & WLDSF_EXPORT) 1456 psz += sprintf(psz, " EXPORT"); 1457 if (pSym->fFlags & WLDSF_UNCERTAIN) 1458 psz += sprintf(psz, " UNCERTAIN"); 1459 1460 return &szDesc[0]; 1461 } 1462 1463 1464 1465 1419 1466 /** 1420 1467 * Symbol debug output. … … 1429 1476 fprintf(stderr, "weakld: dbg:"); 1430 1477 if (pSym) 1431 { 1432 fprintf(stderr, " '%s'", pSym->pszName); 1433 switch (pSym->fFlags & WLDSF_TYPEMASK) 1434 { 1435 case WLDSF_PUBLIC: fprintf(stderr, " PUBLIC"); break; 1436 case WLDSF_COMM: fprintf(stderr, " COMM"); break; 1437 case WLDSF_IMPORT: fprintf(stderr, " IMPORT"); break; 1438 case WLDSF_UNDEF: fprintf(stderr, " UNDEF"); break; 1439 case WLDSF_WKEXT: fprintf(stderr, " WKEXT"); break; 1440 default: fprintf(stderr, " !!!internal error!!!"); asm("int $3"); break; 1441 } 1442 if (pSym->fFlags & WLDSF_WEAK) 1443 fprintf(stderr, " WEAK"); 1444 if (pSym->fFlags & WLDSF_ALIAS) 1445 fprintf(stderr, " ALIAS"); 1446 if (pSym->fFlags & WLDSF_EXPORT) 1447 fprintf(stderr, " ALIAS"); 1448 if (pSym->fFlags & WLDSF_UNCERTAIN) 1449 fprintf(stderr, " UNCERTAIN"); 1450 } 1478 fprintf(stderr, " '%s' %s", pSym->pszName, symGetDescr(pSym)); 1451 1479 else 1452 1480 fprintf(stderr, " <Symbol is NULL>"); 1453 1481 fprintf(stderr, "\n"); 1454 1482 } 1455 #endif1456 1457 1483 1458 1484 /** … … 1553 1579 pSym->fFlags = fFlags; 1554 1580 pSym->pszName = pszName; 1555 if (SYM_IS_DEFINED(pSym->fFlags))1556 pSym->pMod = pMod;1557 1581 if (cchNameWeak) 1558 1582 { … … 1688 1712 wldInfo("fFlags new 0x%04x fFlags old 0x%04x.", fFlags, pSym->fFlags); 1689 1713 pSym = NULL; 1714 } 1715 1716 /* 1717 * Maintain the module pointer and referers. 1718 */ 1719 if (pSym) 1720 { 1721 if (SYM_IS_DEFINED(pSym->fFlags)) 1722 pSym->pMod = pMod; 1723 else 1724 { 1725 int i; 1726 for (i = 0; i < pSym->cReferers; i++) 1727 if (pSym->paReferers[i] == pMod) 1728 break; 1729 if (i >= pSym->cReferers) 1730 { 1731 if (!(pSym->cReferers % 64)) 1732 pSym->paReferers = xrealloc(pSym->paReferers, sizeof(pSym->paReferers[0]) * (pSym->cReferers + 64)); 1733 pSym->paReferers[pSym->cReferers++] = pMod; 1734 } 1735 } 1690 1736 } 1691 1737 } … … 1861 1907 PWLDSYM pSymAlias; 1862 1908 1909 pSym->fFlags |= WLDSF_EXPORT; 1910 1863 1911 /* 1864 1912 * Add internal name. … … 1875 1923 else 1876 1924 { 1877 if (pSym ->pAliasFor!= pSymAlias)1925 if (pSym != pSymAlias) 1878 1926 { 1879 1927 pSym->fFlags |= WLDSF_ALIAS; … … 1982 2030 { 1983 2031 modErr(pMod, "Aliased symbol apparently existed already (upgraded - internal error?)."); 2032 symDbg(pSym, "Processing"); 2033 symDbg(pSym->pAliasFor, "Alias"); 1984 2034 pSym = NULL; 1985 2035 } … … 2500 2550 PWLDMOD pObj; 2501 2551 PWLDLIB pLib; 2552 unsigned uHash; 2502 2553 2503 2554 if (!pWld) … … 2529 2580 pLib = pLib->pNext; 2530 2581 free(pv); 2582 } 2583 2584 /* free symbols */ 2585 for (uHash = 0; uHash < sizeof(pWld->Global.ap) / sizeof(pWld->Global.ap[0]); uHash++) 2586 { 2587 PWLDSYM pSym = pWld->Global.ap[uHash]; 2588 while (pSym) 2589 { 2590 PWLDSYM pNext = pSym->pHashNext; 2591 if (pSym->paReferers) 2592 free(pSym->paReferers); 2593 free(pSym); 2594 pSym = pNext; 2595 } 2531 2596 } 2532 2597 … … 3307 3372 return 0; /* .ignore it. good idea? */ 3308 3373 } 3374 3375 WLDDBG2(("wldGenerateDefCallback: '%s', '%s'", pSymExp->pszName, pSymInt ? pSymInt->pszName : "<the-same-name>")); 3309 3376 3310 3377 /* Skip it all if neither of the symbols are weak. */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.