Changeset 485


Ignore:
Timestamp:
Jul 30, 2003, 8:10:01 PM (22 years ago)
Author:
bird
Message:

'

Location:
trunk/src/emx/src/emxomf
Files:
2 added
4 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.17 to 1.18
    r484 r485  
    11101110        add_extdef (&started, str_ptr + sym_ptr[i].n_un.n_strx);
    11111111      }
     1112
     1113
     1114
     1115
     1116
     1117
     1118
     1119
    11121120  if (started)
    11131121    write_rec ();
     
    11471155   mark it as N_WEAKU so that it is later writen within a WKEXT record.
    11481156   Also we convert a.out-style weak symbols here as normal public symbols,
    1149    as the sense of weak is reverse in OMF */
     1157   as the sense of weak is reverse in OMF
     1158   
     1159   Weak Hack Method 1.
     1160   */
    11501161
    11511162static void weak_process (void)
     
    11841195          }
    11851196      }
     1197
    11861198    else if ((sym_ptr[i].n_type & N_EXT) && is_weak (str_ptr + sym_ptr[i].n_un.n_strx))
    11871199      {
     
    11931205         /*SETTYPE (N_WEAKU);*/
    11941206      }
    1195 
     1207    #endif
    11961208#undef SETTYPE
    11971209}
     
    12111223 * @param   cchName     Size of the buffer pointed to by pachName.
    12121224 * @remark I'm sorry this function is written in my coding style - not!
     1225
    12131226 */
    12141227static const char *weak_process_name(const struct nlist *pSym, const char *pszOrgName, char *pachName, int cchName)
     
    12171230    {
    12181231        /*
    1219          * Hmmm... Check that we handle this correctly else where
     1232         *
    12201233         */
    12211234        case N_WEAKU:               /* 0x0d  Weak undefined symbol. */
  • trunk/src/emx/src/emxomf/emxomf.smak

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r484 r485  
    2020.TARGET := emxomfld.exe
    2121.TKIND  := $(TOOLFMT)
    22 .TSRC   := src/emxomf/emxomfld.c
     22.TSRC   :=
    2323.TCF    := $(CFLAGS.DEF.VERSION)
    2424.TDEP   := @O@moddef$A
  • trunk/src/emx/src/emxomf/emxomfld.c

    • Property cvs2svn:cvs-rev changed from 1.11 to 1.12
    r484 r485  
    3636#include <sys/omflib.h>
    3737#include "defs.h"
     38
    3839
    3940#define FALSE 0
     
    109110static FILE *response_file = NULL;
    110111
     112
     113
     114
    111115/* Non-zero if debugging information is to be omitted.  Set by the -s
    112116   and -S options. */
     
    132136
    133137static void usage (void) NORETURN2;
    134 static void *xmalloc (size_t n);
    135 static char *xstrdup (const char *s);
     138extern void *xmalloc (size_t n);
     139extern void *xrealloc (void *ptr, size_t n);
     140extern char *xstrdup (const char *s);
    136141static void add_name_list (name_list ***add, const char *src);
    137142static void conv_path (char *name);
     
    156161static void usage (void)
    157162{
    158   fprintf (stderr, "emxomfld " VERSION INNOTEK_VERSION " -- "
    159            "Copyright (c) 1992-1996 by Eberhard Mattes\n\n");
     163  fprintf (stderr, "emxomfld " VERSION INNOTEK_VERSION "\n"
     164           "Copyright (c) 1992-1996 by Eberhard Mattes\n"
     165           "Copyright (c) 2003 by InnoTek Systemberatung GmbH\n\n");
     166
    160167  fprintf (stderr,
    161168           "Usage: emxomfld -o <file> [-l <lib>] [-L <libdir>] [-T <base>] [-sS]\n"
     
    169176   used like malloc(), but we don't have to check the return value. */
    170177
    171 static void *xmalloc (size_t n)
     178void *xmalloc (size_t n)
    172179{
    173180  void *p;
     
    181188  return p;
    182189}
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
    183209
    184210
     
    187213   return value. */
    188214
    189 static char *xstrdup (const char *s)
     215char *xstrdup (const char *s)
    190216{
    191217  char *p;
     
    387413
    388414
    389 /* Put a list of library arguments on to the command line or into the
    390    response file. Filenames without path and extension will be 'resolved'
    391    using libdirs and the LIB environment variable and a '.lib' extension.
    392    If not found a search for a 'lib' prefixed filename is attempted, if
    393    still not found we'll let link386 do the complaining and pass filename
    394    unresolved to link386.
    395 
    396    The motivation for doing this is to have the same behaviour of ld and
    397    emxomfld which allows us to lax the libsomething.lib to something.lib
    398    renaming and addapt to the gcc/unix library naming standards.
    399    (see Innotek Defect #416)
    400 
    401    Note. make_env () *must* be called before this function is called. */
    402 
    403 static void put_lib_args(const name_list *list)
    404 {
    405   const char *pszLib = getenv ("LIB");
    406   for (;list != NULL; list = list->next)
    407     {
    408       char  szFilename[260];
    409       int   fFound = 0;
    410 
    411       if (!strpbrk (list->name, ":\\/."))
    412         { /* search for it */
    413           const char *psz, *pszEnd;
    414           for (psz = pszLib; !fFound && psz; psz = pszEnd + (pszEnd != NULL))
    415             {
    416               pszEnd = strchr(psz, ';');
    417               if (pszEnd > psz)
    418                 {
    419                   int  cchPath = pszEnd - psz;
    420                   struct stat s;
    421 
    422                   strncpy(szFilename, psz, pszEnd - psz);
    423                   if (   szFilename[cchPath-1] != '\\'
    424                       && szFilename[cchPath-1] != '/'
    425                       && szFilename[cchPath-1] != ':')
    426                     szFilename[cchPath++] = '\\';
    427 
    428                   /* Files we're looking for:
    429                    *    1. file with .lib extention.
    430                    *    2. file with .lib extention and lib prefix.
    431                    *    3. file with .a extention which is an OMF library.
    432                    *    4. file with .a extention and lib prefix which is an OMF library.
    433                    */
    434                   strcat(strcpy(szFilename + cchPath, list->name), ".lib");
    435                   fFound = !stat(szFilename, &s);
    436                   if (!fFound)
    437                     {
    438                       strcat(strcpy(strcpy(szFilename + cchPath, "lib") + 3, list->name), ".lib");
    439                       fFound = !stat(szFilename, &s);
    440                       if (!fFound)
    441                         {
    442                           strcat(strcpy(szFilename + cchPath, list->name), ".a");
    443                           fFound = !stat(szFilename, &s);
    444                           if (!fFound)
    445                             {
    446                               strcat(strcpy(strcpy(szFilename + cchPath, "lib") + 3, list->name), ".a");
    447                               fFound = !stat(szFilename, &s);
    448                             }
    449                           /*
    450                            * Is this an OMF library?
    451                            * We will open it hand do some verification of the LIBHDR.
    452                            */
    453                           if (fFound)
    454                             {
    455                               FILE *pFile = fopen(szFilename, "rb");
    456                               fFound = 0;
    457                               if (pFile)
    458                                 {
    459                                   #pragma pack(1)
    460                                   struct
    461                                   {
    462                                       byte rec_type;
    463                                       word rec_len;
    464                                       dword dict_offset;
    465                                       word dict_blocks;
    466                                       byte flags;
    467                                   } libhdr;
    468                                   #pragma pack()
    469                                   if (  fread(&libhdr, 1, sizeof(libhdr), pFile) == sizeof(libhdr)
    470                                       && libhdr.rec_type == LIBHDR
    471                                       && libhdr.flags <= 1 /* ASSUME only first bit is used... */
    472                                       )
    473                                     {
    474                                       int page_size = libhdr.rec_len + 3;
    475                                       if (   page_size >= 16
    476                                           && page_size <= 32768
    477                                           && !(page_size & (page_size - 1)) != 0)
    478                                           fFound = 1;
    479                                     }
    480                                   fclose(pFile);
    481                                 }
    482                             }
    483                         }
    484                     }
    485                 }
    486             } /* foreach path in $LIB */
    487         }
    488 
    489       put_arg (fFound ? szFilename : list->name, TRUE, TRUE);
    490 //fprintf(stderr, "%s -> %s\n", list->name, fFound ? szFilename : strpbrk(list->name,     ":\\/.") ? "not searched for" : "not found");
    491     } /* foreach list entry */
    492 }
    493 
    494 
    495415/* Build the environment for LINK386: define the LIB environment
    496416   variable. */
     
    536456
    537457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
    538642/* Start a new set of command line arguments.  If RSP is non-zero, we
    539643   are allowed to use a response file. */
     
    575679      response_file = NULL;
    576680    }
    577   if (response_fname[0] != 0)
     681  if (response_fname[0] != )
    578682    {
    579683      remove (response_fname);
    580       response_fname[0] = 0;
     684      response_fname[0] = '\0';
     685    }
     686  if (weakobj_fname[0] != '\0')
     687    {
     688      remove (weakobj_fname);
     689      weakobj_fname[0] = '\0';
    581690    }
    582691}
     
    790899    }
    791900
    792   t = getenv ("EMXOMFLD_LINKER");
    793   if (t != NULL)
    794     linker_name = t;
    795 
    796   /* Build the environment for LINK386.
    797      This must be done before calling put_lib_args (). */
     901  /* Build the environment for LINK386. */
    798902
    799903  make_env ();
     904
     905
     906
     907
     908
     909
     910
     911
     912
     913
     914
     915
     916
     917
     918
     919
     920
     921
     922
     923
     924
     925
     926
    800927
    801928  /* Start building the LINK386 command line.  We can use a response
     
    829956  */
    830957
     958
     959
     960
    831961  put_arg (linker_name, TRUE, FALSE);
    832962
     
    9141044  /* Put the library file names onto the command line. */
    9151045
    916   put_lib_args (lib_fnames);
     1046  put_);
    9171047  put_arg (",", FALSE, FALSE);
    9181048
  • trunk/src/emx/src/emxomf/grow.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r484 r485  
    332332  return strpool_addn (p, s, strlen (s));
    333333}
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
Note: See TracChangeset for help on using the changeset viewer.