Changeset 535 for trunk/src

Timestamp:
Aug 5, 2003, 9:46:37 PM (22 years ago)
Author:
bird
Message:

trying to update definition file...

Location:
trunk/src/emx/src/emxomf
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxomf/emxomfld.c

    • Property cvs2svn:cvs-rev changed from 1.20 to 1.21
    r534 r535  
    113113static FILE *response_file = NULL;
    114114
     115
     116
     117
    115118/* Weak alias object file. */
    116119static char weakobj_fname[_MAX_PATH];
     120
     121
     122
    117123
    118124/* Non-zero if debugging information is to be omitted.  Set by the -s
     
    327333
    328334      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))
    330337        {
    331338
     
    385392              command_line[line_len++] = '@';
    386393              strcpy (command_line+line_len, response_fname);
     394
     395
     396
    387397            }
    388398          else if (line_len != 0)
     
    645655    if (    !strnicmp(pOpt->name, "/I", 2)
    646656        ||  !strnicmp(pOpt->name, "-I", 2))
    647         fFlags |= WLDC_VERBOSE;
     657        fFlags
    648658    else
    649659    if (    !strnicmp(pOpt->name, "/NOIN", 5)
     
    704714      /* generate weak aliases. */
    705715      if (!rc)
    706         rc = wldGenerateWeakobj (pwld, weakobj_fname);
     716        rc = wldGenerateWeak_fname);
    707717      if (!rc && weakobj_fname[0])
    708718        add_name_list (&add_obj_fnames, weakobj_fname);
     719
     720
    709721
    710722      /* cleanup the linker */
     
    740752  line_len = 0;
    741753  response_flag = rsp;
     754
    742755}
    743756
     
    827840      if (!(argi % 32))
    828841        argv = xrealloc(argv, sizeof(argv[0]) * (argi + 32 + 1));
    829       argv[argi++] = xstrdup(psz);
     842      argv[argi++] = ;
    830843
    831844      /* next */
     
    839852    fprintf(stderr, "*** Return from %s is %d\n", pszwhat, rc);
    840853
     854
    841855  return rc;
    842856}
     
    862876      remove (weakobj_fname);
    863877      weakobj_fname[0] = '\0';
     878
     879
     880
     881
     882
    864883    }
    865884}
     
    12591278
    12601279  /* Put the object file names onto the command line. */
    1261 
     1280 
     1281  force_response_file = TRUE;           /* link386 workaround. */
    12621282  put_args (obj_fnames, TRUE);
    12631283  put_arg (",", FALSE, FALSE);
  • trunk/src/emx/src/emxomf/weakld.c

    • Property cvs2svn:cvs-rev changed from 1.12 to 1.13
    r534 r535  
    8282#include <string.h>
    8383#include <sys/types.h>
     84
     85
     86
    8487#include <sys/omflib.h>
    8588#include <sys/moddef.h>
     
    564567    {
    565568        pLib->phFile = fopen(pLib->pszLibName, "rb");
    566         if (pLib->phFile)
     569        if (pLib->phFile)
    567570            libErr(pLib, "Failed to open library.");
    568571    }
     
    576579static void         libClose(PWLDLIB pLib)
    577580{
    578     if (!pLib->phFile)
     581    if (pLib->phFile)
    579582    {
    580583        fclose(pLib->phFile);
     
    23422345    {
    23432346        void *pv = pObj;   
     2347
    23442348        pObj = pObj->pNext;
    23452349        free(pv);
     
    23482352    {
    23492353        void *pv = pObj;   
     2354
    23502355        pObj = pObj->pNext;
    23512356        free(pv);
     
    23562361    {
    23572362        void *pv = pLib;   
     2363
    23582364        pLib = pLib->pNext;
    23592365        free(pv);
     
    24112417        pWld->ppObjsAdd = &pMod->pNext;
    24122418        rc = pass1ReadOMFMod(pWld, pMod, 0);
     2419
    24132420    }
    24142421    else if (OmfRec.chType == LIBHDR)
     
    24352442                }
    24362443                rc = pass1ReadOMFMod(pWld, pMod, 0);
     2444
    24372445                if (rc)
    24382446                    break;
     
    24472455            fread(&OmfRec, sizeof(OmfRec), 1, phFile);
    24482456        }
     2457
    24492458    }
    24502459    else
    24512460    {
     2461
    24522462        fprintf(stderr, "weakld: invalid object file '%s'.\n", pszName);
    24532463        rc = -1;
     
    28262836
    28272837
     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
    28282942/**
    28292943 * Generates a object file containing alias for resolving the weak
     
    28342948 * @returns 0 on success.
    28352949 * @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 */
     2956int     wldGenerateWeakAliases(PWLD pWld, char *pszObjName, char *pszDefName)
    28412957{
    28422958    char *      psz;
     
    28442960    int         rc;
    28452961
    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");
    28622975    if (phFile)
    28632976    {
     
    28933006                WLDINFO(pWld, ("No weak alias needed, deleting file."));
    28943007            fclose(phFile);
    2895             remove(pszName);
    2896             *pszName = '\0';
     3008            remove(pszName);
     3009            *pszName = '\0';
    28973010        }
    28983011        else
     
    29063019           else
    29073020           {
    2908                wldErr(pWld, "Failed to write to '%s'.", pszName);
     3021               wldErr(pWld, "Failed to write to '%s'.", pszName);
    29093022               rc = -1;
    29103023               fclose(phFile);
    2911                remove(pszName);
    2912                *pszName = '\0';
     3024               remove(pszName);
     3025               *pszName = '\0';
    29133026           }
    29143027        }
     
    29163029    else
    29173030    {
    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';
    29203087    }
    29213088
  • trunk/src/emx/src/emxomf/weakld.h

    • Property cvs2svn:cvs-rev changed from 1.4 to 1.5
    r534 r535  
    5656int     wldAddLibrary(PWLD pWld, FILE *phFile, const char *pszName);
    5757int     wldPass1(PWLD pWld);
    58 int     wldGenerateWeakobj(PWLD pwld, char *pszName);
     58int     wldGenerateWeakName);
    5959int     wldDestroy(PWLD pWld);
    6060/** @} */
Note: See TracChangeset for help on using the changeset viewer.