- Timestamp:
- Aug 5, 2003, 9:46:37 PM (22 years ago)
- Location:
- trunk/src/emx/src/emxomf
- Files:
-
- 3 edited
-
emxomfld.c (modified) (10 diffs, 1 prop)
-
weakld.c (modified) (15 diffs, 1 prop)
-
weakld.h (modified) (1 diff, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/emxomfld.c
-
Property cvs2svn:cvs-rev
changed from
1.20to1.21
r534 r535 113 113 static FILE *response_file = NULL; 114 114 115 116 117 115 118 /* Weak alias object file. */ 116 119 static char weakobj_fname[_MAX_PATH]; 120 121 122 117 123 118 124 /* Non-zero if debugging information is to be omitted. Set by the -s … … 327 333 328 334 max_len = (response_file == NULL ? 110 : 52); 329 if (line_len + len + 1 > max_len) 335 if ( line_len + len + 1 > max_len 336 || (force_response_file && !response_file)) 330 337 { 331 338 … … 385 392 command_line[line_len++] = '@'; 386 393 strcpy (command_line+line_len, response_fname); 394 395 396 387 397 } 388 398 else if (line_len != 0) … … 645 655 if ( !strnicmp(pOpt->name, "/I", 2) 646 656 || !strnicmp(pOpt->name, "-I", 2)) 647 fFlags |= WLDC_VERBOSE;657 fFlags 648 658 else 649 659 if ( !strnicmp(pOpt->name, "/NOIN", 5) … … 704 714 /* generate weak aliases. */ 705 715 if (!rc) 706 rc = wldGenerateWeak obj (pwld, weakobj_fname);716 rc = wldGenerateWeak_fname); 707 717 if (!rc && weakobj_fname[0]) 708 718 add_name_list (&add_obj_fnames, weakobj_fname); 719 720 709 721 710 722 /* cleanup the linker */ … … 740 752 line_len = 0; 741 753 response_flag = rsp; 754 742 755 } 743 756 … … 827 840 if (!(argi % 32)) 828 841 argv = xrealloc(argv, sizeof(argv[0]) * (argi + 32 + 1)); 829 argv[argi++] = xstrdup(psz);842 argv[argi++] = ; 830 843 831 844 /* next */ … … 839 852 fprintf(stderr, "*** Return from %s is %d\n", pszwhat, rc); 840 853 854 841 855 return rc; 842 856 } … … 862 876 remove (weakobj_fname); 863 877 weakobj_fname[0] = '\0'; 878 879 880 881 882 864 883 } 865 884 } … … 1259 1278 1260 1279 /* Put the object file names onto the command line. */ 1261 1280 1281 force_response_file = TRUE; /* link386 workaround. */ 1262 1282 put_args (obj_fnames, TRUE); 1263 1283 put_arg (",", FALSE, FALSE); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/emxomf/weakld.c
-
Property cvs2svn:cvs-rev
changed from
1.12to1.13
r534 r535 82 82 #include <string.h> 83 83 #include <sys/types.h> 84 85 86 84 87 #include <sys/omflib.h> 85 88 #include <sys/moddef.h> … … 564 567 { 565 568 pLib->phFile = fopen(pLib->pszLibName, "rb"); 566 if ( pLib->phFile)569 if (pLib->phFile) 567 570 libErr(pLib, "Failed to open library."); 568 571 } … … 576 579 static void libClose(PWLDLIB pLib) 577 580 { 578 if ( !pLib->phFile)581 if (pLib->phFile) 579 582 { 580 583 fclose(pLib->phFile); … … 2342 2345 { 2343 2346 void *pv = pObj; 2347 2344 2348 pObj = pObj->pNext; 2345 2349 free(pv); … … 2348 2352 { 2349 2353 void *pv = pObj; 2354 2350 2355 pObj = pObj->pNext; 2351 2356 free(pv); … … 2356 2361 { 2357 2362 void *pv = pLib; 2363 2358 2364 pLib = pLib->pNext; 2359 2365 free(pv); … … 2411 2417 pWld->ppObjsAdd = &pMod->pNext; 2412 2418 rc = pass1ReadOMFMod(pWld, pMod, 0); 2419 2413 2420 } 2414 2421 else if (OmfRec.chType == LIBHDR) … … 2435 2442 } 2436 2443 rc = pass1ReadOMFMod(pWld, pMod, 0); 2444 2437 2445 if (rc) 2438 2446 break; … … 2447 2455 fread(&OmfRec, sizeof(OmfRec), 1, phFile); 2448 2456 } 2457 2449 2458 } 2450 2459 else 2451 2460 { 2461 2452 2462 fprintf(stderr, "weakld: invalid object file '%s'.\n", pszName); 2453 2463 rc = -1; … … 2826 2836 2827 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2828 2942 /** 2829 2943 * Generates a object file containing alias for resolving the weak … … 2834 2948 * @returns 0 on success. 2835 2949 * @returns some unexplainable randomly picked number on failure. 2836 * @param pWld Linker instance to destroy. 2837 * @param pszName Where to put the name of the generated object file. 2838 * This is an empty string if no weak symbols were found! 2839 */ 2840 int wldGenerateWeakobj(PWLD pWld, char *pszName) 2950 * @param pWld Linker instance. 2951 * @param pszObjName Where to put the name of the generated object file. 2952 * This is an empty string if no weak symbols were found! 2953 * @param pszDefName Where to put the name of the modified definition file. 2954 * This is an empty string if changes was required! 2955 */ 2956 int wldGenerateWeakAliases(PWLD pWld, char *pszObjName, char *pszDefName) 2841 2957 { 2842 2958 char * psz; … … 2844 2960 int rc; 2845 2961 2846 /* generate the file */ 2847 *pszName = '\0'; 2848 psz = _tempnam(NULL, "weako"); 2849 if (psz) 2850 { 2851 strcpy(pszName, psz); 2852 free(psz); 2853 } 2854 else 2855 tmpnam(pszName); 2856 strcat(pszName, "wk.obj"); 2857 WLDINFO(pWld, ("Generating weakobj object file '%s'.", pszName)); 2858 2859 2860 /* open the file */ 2861 phFile = fopen(pszName, "wr"); 2962 /* zero returns */ 2963 *pszObjName = '\0'; 2964 if (pszDefName) 2965 *pszDefName = '\0'; 2966 2967 /* generate the object file */ 2968 rc = wldTempFile(pWld, pszObjName, "wk", ".obj"); 2969 if (rc) 2970 return wldErr(pWld, "Failed to generate temporary object file for weak aliases."); 2971 WLDINFO(pWld, ("Generating object file '%s' for weak aliases.", pszObjName)); 2972 2973 /* open it */ 2974 phFile = fopen(pszObjName, "wr"); 2862 2975 if (phFile) 2863 2976 { … … 2893 3006 WLDINFO(pWld, ("No weak alias needed, deleting file.")); 2894 3007 fclose(phFile); 2895 remove(psz Name);2896 *psz Name = '\0';3008 remove(pszName); 3009 *pszName = '\0'; 2897 3010 } 2898 3011 else … … 2906 3019 else 2907 3020 { 2908 wldErr(pWld, "Failed to write to '%s'.", psz Name);3021 wldErr(pWld, "Failed to write to '%s'.", pszName); 2909 3022 rc = -1; 2910 3023 fclose(phFile); 2911 remove(psz Name);2912 *psz Name = '\0';3024 remove(pszName); 3025 *pszName = '\0'; 2913 3026 } 2914 3027 } … … 2916 3029 else 2917 3030 { 2918 wldErr(pWld, "Failed to open '%s' for writing.", pszName); 2919 *pszName = '\0'; 3031 wldErr(pWld, "Failed to open '%s' for writing.", pszObjName); 3032 *pszObjName = '\0'; 3033 } 3034 3035 /* do the definition file */ 3036 if (!rc && pWld->pDef && pszDefName) 3037 { 3038 rc = wldTempFile(pWld, pszDefName, "wk", ".def"); 3039 if (!rc) 3040 { 3041 WLDINFO(pWld, ("Generating definition file '%s' for weak exports.", pszDefName)); 3042 3043 /* open it */ 3044 phFile = fopen(pszDefName, "w"); 3045 if (phFile) 3046 { 3047 FILE *phOrgDef = fopen(pWld->pDef->pszModName, "r"); 3048 if (phOrgDef) 3049 { 3050 char *pachOrgDef = fsize 3051 struct _md *pMD; 3052 3053 /* open original def file */ 3054 pMD = _md_open(pWld->pDef->pszModName); 3055 if (pMD) 3056 { 3057 /* parse it */ 3058 _md_next_token(pMD); 3059 rc = _md_parse(pMD, wldDefCallbackGenerateWeakAliases, phFile); 3060 _md_close(pMD); 3061 } 3062 else 3063 rc = wldErr(pWld, "_md_open on '%s'.\n", pszDefName); 3064 fclose(phOrgFile); 3065 } 3066 else 3067 rc = wldErr(pWld, "Failed to open '%s' for reading.\n", pszDefName); 3068 fclose(phFile); 3069 } 3070 else 3071 rc = wldErr(pWld, "Failed to open '%s' for writing.\n", pszDefName); 3072 } 3073 else 3074 rc = wldErr(pWld, "Failed to generate temporary definition file for weak aliases."); 3075 } 3076 3077 /* cleanup */ 3078 if (rc && pszDefName && *pszDefName) 3079 { 3080 remove(pszDefName); 3081 *pszDefName = '\0'; 3082 } 3083 if (rc && pszObjName && *pszObjName) 3084 { 3085 remove(pszObjName); 3086 *pszObjName = '\0'; 2920 3087 } 2921 3088 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/emxomf/weakld.h
-
Property cvs2svn:cvs-rev
changed from
1.4to1.5
r534 r535 56 56 int wldAddLibrary(PWLD pWld, FILE *phFile, const char *pszName); 57 57 int wldPass1(PWLD pWld); 58 int wldGenerateWeak obj(PWLD pwld, char *pszName);58 int wldGenerateWeakName); 59 59 int wldDestroy(PWLD pWld); 60 60 /** @} */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
