Changeset 2235
- Timestamp:
- Jul 8, 2005, 9:28:00 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/weakld.c
-
Property cvs2svn:cvs-rev
changed from
1.32
to1.33
r2234 r2235 269 269 WLDSF_EXPORT = 0x1000, 270 270 271 /** Internal flags which indicates that the symbol was exported in 272 * the definition file. This to select symbols which only appears in 273 * __declspec(dllexport) and put them into the definition file for 274 * proper weak handling. */ 275 WLDSF_EXPORT_DEF = 0x2000, 276 271 277 /** Internal flag to say that we've already aliased this weak 272 278 * in the definition file. … … 277 283 * truncated by emxomf. */ 278 284 WLDSF_TRUNCATED = 0x10000, 279 280 285 } fFlags; 281 286 … … 3544 3549 /** Our current linenumber index. */ 3545 3550 unsigned iLine; 3551 /** Set if we have processed any weak __declspec(dllexport) symbols. */ 3552 unsigned fWeakDllExport; 3546 3553 } WLDGDCPARAM, *PWLDGDCPARAM; 3547 3554 … … 3594 3601 3595 3602 WLDDBG2(("wldGenerateDefCallback: '%s', '%s'", pSymExp->pszName, pSymInt ? pSymInt->pszName : "<the-same-name>")); 3603 3604 /* mark the exported symbol exported. */ 3605 pSymExp->fFlags |= WLDSF_EXPORT_DEF; 3596 3606 3597 3607 /* Skip it all if neither of the symbols are weak. */ … … 3661 3671 3662 3672 /** 3673 * Checks the __declspec(dllexport) symbols for weak symbols. 3674 * When a weak export is found, it will be added to the .def file. 3675 * 3676 * @returns 0 on success 3677 * @returns !0 on failure after writing sufficient error message. 3678 * @param pWld Linker instance. 3679 * @param pSym Symbol. 3680 * @param pvUser Pointer to a WLDGDCPARAM struct. 3681 */ 3682 static int wldGenerateDefExportEnum(PWLD pWld, PWLDSYM pSym, void *pvUser) 3683 { 3684 PWLDGDCPARAM pParam = (PWLDGDCPARAM)pvUser; 3685 3686 if (!pParam->fWeakDllExport) 3687 { 3688 /* copy the rest of the file if any changes was made. */ 3689 char szTmp[512]; 3690 while (!feof(pParam->phOrgFile) && fgets(szTmp, sizeof(szTmp), pParam->phOrgFile)) 3691 if (fputs(szTmp, pParam->phNewFile) < 0) 3692 return wldErr(pWld, "Write error."); 3693 3694 if (fputs("\n" 3695 "; weakld added weak __declspec(dllexport) exports\n" 3696 "EXPORTS\n", 3697 pParam->phNewFile) < 0) 3698 return wldErr(pWld, "Write error."); 3699 pParam->fWeakDllExport = 1; 3700 } 3701 3702 /* 3703 * Now generate the export entry. 3704 */ 3705 if (!pSym->pAliasFor) 3706 { 3707 WLDINFO(pWld, ("Adding __declspec(dllexport) weak symbol '%s' to the definition aliasing '%s'", 3708 pSym->pszName, pSym->pszWeakName)); 3709 fprintf(pParam->phNewFile, " \"%s\" = \"%s\"\n", 3710 pSym->pszName, pSym->pszWeakName); 3711 } 3712 else 3713 { 3714 WLDINFO(pWld, ("Adding __declspec(dllexport) weak symbol '%s' to the definition aliasing '%s' (alias)", 3715 pSym->pszName, 3716 pSym->pAliasFor->pszWeakName ? pSym->pAliasFor->pszWeakName : pSym->pAliasFor->pszName)); 3717 fprintf(pParam->phNewFile, " \"%s\" = \"%s\"\n", 3718 pSym->pszName, 3719 pSym->pAliasFor->pszWeakName ? pSym->pAliasFor->pszWeakName : pSym->pAliasFor->pszName); 3720 } 3721 if (ferror(pParam->phNewFile)) 3722 return wldErr(pWld, "Write error."); 3723 return 0; 3724 } 3725 3726 3727 /** 3663 3728 * Generates an unique temporary file. 3664 3729 * … … 3745 3810 param.phNewFile = phFile; 3746 3811 param.iLine = 0; 3812 param.fWeakDllExport = 0; 3747 3813 3748 3814 /* parse it */ … … 3750 3816 rc = _md_parse(pMD, wldGenerateDefCallback, ¶m); 3751 3817 _md_close(pMD); 3818 3819 /* now see if there are any aliases in __declspec(dllexport) statements. */ 3820 if (!rc) 3821 rc = symEnum(pWld, &pWld->Global, 3822 WLDSF_EXPORT | WLDSF_WEAK, WLDSF_EXPORT | WLDSF_WEAK | WLDSF_EXPORT_DEF | WLDSF_WEAKALIASDONE, 3823 wldGenerateDefExportEnum, ¶m); 3752 3824 3753 3825 /* copy the rest of the file if any changes was made. */ … … 3759 3831 rc = wldErr(pWld, "Write error."); 3760 3832 } 3761 else if (!rc )3833 else if (!rc && !param.fWeakDllExport) 3762 3834 { 3763 /* no changes w asmade. */3835 /* no changes were made. */ 3764 3836 WLDINFO(pWld, ("No weak exports, removing file.")); 3765 3837 fclose(phFile); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.