- Timestamp:
- Jul 31, 2003, 4:45:07 PM (22 years ago)
- Location:
- trunk/src/emx/src/emxomf
- Files:
-
- 2 edited
-
emxomfld.c (modified) (5 diffs, 1 prop)
-
weakld.c (modified) (12 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/emxomfld.c
-
Property cvs2svn:cvs-rev
changed from
1.12to1.13
r487 r488 468 468 */ 469 469 470 static FILE * find_objlib(char *pszfullname, const char *pszname, 471 const char * const *papszexts, int flibhacks) 470 static FILE * find_objlib2(char *pszfullname, const char *pszname, const char * const *papszexts, int flibhacks) 472 471 { 473 472 const char * psz; … … 544 543 phFile = fopen (pszfullname, "rb"); 545 544 545 546 547 546 548 if (phFile) 547 549 { … … 556 558 } libhdr; 557 559 #pragma pack() 558 if (!flibhacks)559 return phFile;560 560 /* For .a libraries we will chech for a valid OMF library header. */ 561 561 if (memicmp(pszfullname + strlen(pszfullname) - 2, ".a", 3)) 562 562 return phFile; 563 if ( fread(&libhdr, 1, sizeof(libhdr), phFile) == sizeof(libhdr)563 if ( fread(&libhdr, 1, sizeof(libhdr), phFile) == sizeof(libhdr) 564 564 && libhdr.rec_type == LIBHDR 565 565 && libhdr.flags <= 1 /* ASSUME only first bit is used... */ 566 566 567 ) 567 568 { … … 581 582 582 583 584 585 586 587 588 589 590 591 592 593 594 595 583 596 /* Weak prelinking for Method 2 Weak support. */ 584 597 … … 588 601 PWLD pwld; 589 602 590 pwld = wld_create ( 0);603 pwld = wld_create (); 591 604 if (pwld) 592 605 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/emxomf/weakld.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r487 r488 46 46 *******************************************************************************/ 47 47 #define WLDSYM_HASH_SIZE 211 48 48 49 49 50 … … 55 56 #include <stdlib.h> 56 57 #include <sys/types.h> 58 57 59 #include "defs.h" 58 60 #include "grow.h" 59 61 #include "weakld.h" 62 60 63 61 64 /******************************************************************************* … … 71 74 /** Filehandle if open */ 72 75 FILE * phFile; 76 77 73 78 } WLDLIB, *PWLDLIB; 74 79 … … 83 88 /** Filehandle if open. */ 84 89 FILE * phFile; 85 86 /** Library relation. */ 90 /** Module offset into the file. */ 91 off_t off; 92 /** Library relation - not used for libraries added thru wld_add_object(). */ 87 93 PWLDLIB pLib; 88 /* * Library offset.*/89 off_t offLib;94 /* */ 95 ; 90 96 } WLDMOD, *PWLDMOD; 91 97 … … 108 114 /** Symbol flags. */ 109 115 enum { 110 /* Strong symbol. */ 111 WLDSF_STRONG = 0, 112 /** Weak symbol, can become strong. */ 113 WLDSF_WEAK = 1, 114 /** Undefined symbol, can become strong. */ 115 WLDSF_UNDEF = 2, 116 /** Communal data/code, become strong. */ 117 WLDSF_COMM = 4, 118 /** Import symbol. */ 119 WLDSF_IMPORT = 8, 120 /** Exported symbol. */ 121 WLDSF_EXPORT = 16, 122 116 /** @group Symbol state 117 * @{ */ 118 /* Mask of the symbol state. */ 119 WLDSF_STATEMASK = 0x000f, 120 /** Strong symbol. 121 * A strong definition exists for this symbol (PUBDEF). */ 122 WLDSF_STRONG = 0x0001, 123 /** Communal data/code. 124 * Communal definition exists for this symbol. 125 * If a PUBDEF is found for this symbol it will become strong. */ 126 WLDSF_COMM = 0x0002, 127 /** Undefined symbol. 128 * This symbol is not yet defined anywhere. */ 129 WLDSF_UNDEF = 0x0003, 130 /** Weak external. 131 * This symbol doesn't need to be resolved as it have a default 132 * resolution. pWeakDefault is pointing to the default resolution. 133 * If an non weak EXTDEF is found in another module, it will become 134 * WLDSF_UNDEF. 135 */ 136 WLDSF_WKEXT = 0x0004, 137 /** @} */ 138 139 /** Weak symbol. 140 * This symbol doesn't need to be resolved (if WLDSF_UNDEF), or 141 * it may be overridden by a EXTDEF with no WKEXT. 142 * If this is an weak undefined symbol (extern weak, local default) 143 * pWeakDefault Will point at it. 144 */ 145 WLDSF_WEAK = 0x0100, 146 147 /** Uncertain undefined symbol. 148 * We're still processing the module containing this and the uncertainty 149 * we're facing is that a WLDSF_UNDEF may changed to an WLDSF_WKEXT 150 * upon encountering a WKEXT COMENT record. */ 151 WLDSF_UNCERTAIN = 0x0200, 152 153 154 /** Import symbol. 155 * This symbol is imported. */ 156 WLDSF_IMPORT = 0x0400, 157 /** Exported symbol. 158 * This symbol is to be exported. */ 159 WLDSF_EXPORT = 0x0800, 160 /** Alias symbol. 161 * This symbol is an alias for another symbol. pAliasFor will be set. */ 162 WLDSF_ALIAS = 0x1000, 123 163 } eFlags; 124 164 … … 129 169 const char* pszImpMod; 130 170 171 172 173 174 175 176 177 178 179 180 181 182 183 131 184 /** Symbol this is an alias for. */ 132 185 struct wldsym * pAliasFor; 186 187 188 189 190 191 192 133 193 134 194 /** Next node in the hash bucket. */ … … 156 216 /** Global symbols. */ 157 217 WLDSYMTAB Global; 218 219 220 221 222 223 224 225 158 226 159 227 /** string pool for miscellaneous string. */ … … 163 231 164 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 165 260 166 261 extern void *xrealloc (void *ptr, size_t n); 167 262 extern void *xmalloc (size_t n); 168 263 264 265 266 169 267 170 268 … … 197 295 } 198 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 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 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 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 199 625 200 626 … … 225 651 pWld->fFlags = fFlags; 226 652 pWld->pStrMisc = strpool_init(); 653 654 227 655 228 656 /* done */ … … 271 699 int wld_add_object(PWLD pWld, FILE *phFile, const char *pszName) 272 700 { 701 702 273 703 if (!phFile) 274 704 phFile = fopen(pszName, "rb"); … … 279 709 } 280 710 if (pWld->fFlags & WLDC_VERBOSE) 281 fprintf(stderr, "weakld: info: adding object %s\n", pszName); 282 283 /* @todo process it! */ 284 285 return 0; 711 fprintf(stderr, "weakld: info: adding object %s.\n", pszName); 712 713 /* 714 * An object module is either a object or a library. 715 * In anycase all the modules it contains is to be added to the link. 716 */ 717 fread(&OmfRec, sizeof(OmfRec), 1, phFile); 718 if (OmfRec.chType == THEADR) 719 { 720 /* Single Object */ 721 PWLDMOD pMod = xmalloc(sizeof(*pMod)); 722 memset(pMod, 0, sizeof(*pMod)); 723 pMod->pszModName = strpool_add(pWld->pStrMisc, pszName); 724 pMod->phFile = phFile; 725 *pWld->ppObjsAdd = pMod; 726 pWld->ppObjsAdd = &pMod->pNext; 727 rc = pass1ReadOMFMod(pWld, pMod); 728 } 729 else if (OmfRec.chType == LIBHDR) 730 { 731 /* Library of object modules */ 732 while (OmfRec.chType != LIBEND && OmfRec.chType != (LIBEND | REC32)) 733 { 734 if (OmfRec.chType == THEADR || OmfRec.chType == (THEADR | REC32)) 735 { 736 PWLDMOD pMod = xmalloc(sizeof(*pMod)); 737 memset(pMod, 0, sizeof(*pMod)); 738 pMod->pszModName = strpool_add(pWld->pStrMisc, pszName); 739 pMod->phFile = phFile; 740 pMod->off = ftell(phFile) - sizeof(OmfRec); 741 *pWld->ppObjsAdd = pMod; 742 pWld->ppObjsAdd = &pMod->pNext; 743 if (pWld->fFlags & WLDC_VERBOSE) 744 { 745 char achModName[256]; 746 unsigned char cchModName; 747 cchModName = fgetc(phFile); 748 achModName[fread(achModName, 1, cchModName, phFile)] = '\0'; 749 fprintf(stderr, "weakld: info: adding library member '%s'.\n", achModName); 750 } 751 rc = pass1ReadOMFMod(pWld, pMod); 752 if (rc) 753 break; 754 } 755 else 756 { 757 /* skip to the net record */ 758 fseek(phFile, OmfRec.cb, SEEK_CUR); 759 } 760 761 /* read next record */ 762 fread(&OmfRec, sizeof(OmfRec), 1, phFile); 763 } 764 } 765 else 766 { 767 fprintf(stderr, "weakld: invalid object file '%s'.\n", pszName); 768 rc = -1; 769 } 770 771 return rc; 286 772 } 287 773 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
