Changeset 485
- Timestamp:
- Jul 30, 2003, 8:10:01 PM (22 years ago)
- Location:
- trunk/src/emx/src/emxomf
- Files:
-
- 2 added
- 4 edited
-
emxomf.c (modified) (6 diffs, 1 prop)
-
emxomf.smak (modified) (1 diff, 1 prop)
-
emxomfld.c (modified) (13 diffs, 1 prop)
-
grow.c (modified) (1 diff, 1 prop)
-
weakld.c (added)
-
weakld.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/emxomf.c
-
Property cvs2svn:cvs-rev
changed from
1.17to1.18
r484 r485 1110 1110 add_extdef (&started, str_ptr + sym_ptr[i].n_un.n_strx); 1111 1111 } 1112 1113 1114 1115 1116 1117 1118 1119 1112 1120 if (started) 1113 1121 write_rec (); … … 1147 1155 mark it as N_WEAKU so that it is later writen within a WKEXT record. 1148 1156 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 */ 1150 1161 1151 1162 static void weak_process (void) … … 1184 1195 } 1185 1196 } 1197 1186 1198 else if ((sym_ptr[i].n_type & N_EXT) && is_weak (str_ptr + sym_ptr[i].n_un.n_strx)) 1187 1199 { … … 1193 1205 /*SETTYPE (N_WEAKU);*/ 1194 1206 } 1195 1207 #endif 1196 1208 #undef SETTYPE 1197 1209 } … … 1211 1223 * @param cchName Size of the buffer pointed to by pachName. 1212 1224 * @remark I'm sorry this function is written in my coding style - not! 1225 1213 1226 */ 1214 1227 static const char *weak_process_name(const struct nlist *pSym, const char *pszOrgName, char *pachName, int cchName) … … 1217 1230 { 1218 1231 /* 1219 * Hmmm... Check that we handle this correctly else where1232 * 1220 1233 */ 1221 1234 case N_WEAKU: /* 0x0d Weak undefined symbol. */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/emxomf/emxomf.smak
-
Property cvs2svn:cvs-rev
changed from
1.7to1.8
r484 r485 20 20 .TARGET := emxomfld.exe 21 21 .TKIND := $(TOOLFMT) 22 .TSRC := src/emxomf/emxomfld.c22 .TSRC := 23 23 .TCF := $(CFLAGS.DEF.VERSION) 24 24 .TDEP := @O@moddef$A -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/emxomf/emxomfld.c
-
Property cvs2svn:cvs-rev
changed from
1.11to1.12
r484 r485 36 36 #include <sys/omflib.h> 37 37 #include "defs.h" 38 38 39 39 40 #define FALSE 0 … … 109 110 static FILE *response_file = NULL; 110 111 112 113 114 111 115 /* Non-zero if debugging information is to be omitted. Set by the -s 112 116 and -S options. */ … … 132 136 133 137 static void usage (void) NORETURN2; 134 static void *xmalloc (size_t n); 135 static char *xstrdup (const char *s); 138 extern void *xmalloc (size_t n); 139 extern void *xrealloc (void *ptr, size_t n); 140 extern char *xstrdup (const char *s); 136 141 static void add_name_list (name_list ***add, const char *src); 137 142 static void conv_path (char *name); … … 156 161 static void usage (void) 157 162 { 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 160 167 fprintf (stderr, 161 168 "Usage: emxomfld -o <file> [-l <lib>] [-L <libdir>] [-T <base>] [-sS]\n" … … 169 176 used like malloc(), but we don't have to check the return value. */ 170 177 171 staticvoid *xmalloc (size_t n)178 void *xmalloc (size_t n) 172 179 { 173 180 void *p; … … 181 188 return p; 182 189 } 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 183 209 184 210 … … 187 213 return value. */ 188 214 189 staticchar *xstrdup (const char *s)215 char *xstrdup (const char *s) 190 216 { 191 217 char *p; … … 387 413 388 414 389 /* Put a list of library arguments on to the command line or into the390 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, if393 still not found we'll let link386 do the complaining and pass filename394 unresolved to link386.395 396 The motivation for doing this is to have the same behaviour of ld and397 emxomfld which allows us to lax the libsomething.lib to something.lib398 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 struct461 {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 == LIBHDR471 && libhdr.flags <= 1 /* ASSUME only first bit is used... */472 )473 {474 int page_size = libhdr.rec_len + 3;475 if ( page_size >= 16476 && page_size <= 32768477 && !(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 495 415 /* Build the environment for LINK386: define the LIB environment 496 416 variable. */ … … 536 456 537 457 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 538 642 /* Start a new set of command line arguments. If RSP is non-zero, we 539 643 are allowed to use a response file. */ … … 575 679 response_file = NULL; 576 680 } 577 if (response_fname[0] != 0)681 if (response_fname[0] != ) 578 682 { 579 683 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'; 581 690 } 582 691 } … … 790 899 } 791 900 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. */ 798 902 799 903 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 800 927 801 928 /* Start building the LINK386 command line. We can use a response … … 829 956 */ 830 957 958 959 960 831 961 put_arg (linker_name, TRUE, FALSE); 832 962 … … 914 1044 /* Put the library file names onto the command line. */ 915 1045 916 put_ lib_args (lib_fnames);1046 put_); 917 1047 put_arg (",", FALSE, FALSE); 918 1048 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/emxomf/grow.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r484 r485 332 332 return strpool_addn (p, s, strlen (s)); 333 333 } 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 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
