Changeset 1563
- Timestamp:
- Oct 10, 2004, 4:51:49 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/emxomf.c
-
Property cvs2svn:cvs-rev
changed from
1.39
to1.40
r1562 r1563 917 917 918 918 919 /* Put the null-terminated string pszName into the current OMF record. 919 /* Put the null-terminated string pszName into the current OMF record. 920 920 In the OMF record, the string is preceded by a length byte. The 921 921 string length must not exceed 255; if it is too long, display a … … 929 929 if (cch > 255) 930 930 { 931 /* Hash the symbol to help making it unique. 931 /* Hash the symbol to help making it unique. 932 932 * NOTE that the hash algorithm is not fixed, so is the !_%X marker too. 933 933 * the weakld is parsing it! … … 1303 1303 int cch = strlen(pszOrgName); 1304 1304 int cch2; 1305 1305 1306 1306 /* Init the markers if not done already. */ 1307 1307 if (!weak_marker_simple[0]) … … 1330 1330 gettimeofday(&tv, NULL); 1331 1331 memcpy(&weak_marker_ts[0], "$w$", 4); 1332 ltoa(tv.tv_sec, &weak_marker_ts[3], 36); 1332 ltoa(tv.tv_sec, &weak_marker_ts[3], 36); 1333 1333 cch2 = 3 + strlen(&weak_marker_ts[3]); 1334 1334 ltoa(tv.tv_usec, &weak_marker_ts[cch2], 36); … … 1337 1337 if (tv_prev.tv_usec == tv.tv_usec && tv_prev.tv_sec == tv.tv_sec) 1338 1338 { 1339 if (!iOpaque) 1339 if (!iOpaque) 1340 1340 { 1341 1341 unsigned short seed[3]; … … 1363 1363 else if (cch + 24 < 255) 1364 1364 snprintf(pachName, cchName, "%s%.16s", pszOrgName, weak_marker_ts); 1365 else 1365 else 1366 1366 { /* too long. */ 1367 1367 int cch3 = weak_marker_ts_size > 24 ? 24 : weak_marker_ts_size; 1368 1368 char szHash[16]; 1369 1369 const char *psz; 1370 unsigned uHash; 1370 unsigned uHash; 1371 1371 for (psz = pszOrgName, uHash = 5381; *psz; psz++) /* hash alg: original djb2. */ 1372 1372 uHash += (uHash << 5) + *psz; … … 2717 2717 } 2718 2718 2719 /* Convert import entries. */ 2720 static void write_import_i2 (void) 2721 { 2722 int i; 2723 const char *name1, *name2; 2724 2725 /* Search the symbol table for N_IMP1 and N_IMP2 symbols. These are 2726 unique to import modules. */ 2727 2728 name1 = NULL; name2 = NULL; 2729 for (i = 0; i < sym_count; ++i) 2730 { 2731 switch (sym_ptr[i].n_type) 2732 { 2733 case N_IMP1|N_EXT: 2734 name1 = str_ptr + sym_ptr[i].n_un.n_strx; 2735 break; 2736 case N_IMP2|N_EXT: 2737 name2 = str_ptr + sym_ptr[i].n_un.n_strx; 2738 break; 2739 } 2740 if (name1 && name2) 2741 { 2742 int len1, mod_len; 2743 long ord; 2744 const char *proc_name, *p; 2745 char mod[256], *q; 2746 2747 /* Parse the special symbols into module name and ordinal number. 2748 name2 should look like 2749 2750 SYMBOL=MODULE.ORDINAL 2751 2752 where SYMBOL is name1, MODULE is the module name and ORDINAL is 2753 the ordinal number. */ 2754 2755 len1 = strlen (name1); 2756 if (memcmp (name1, name2, len1) != 0) 2757 error ("Invalid import record: names don't match"); 2758 name2 += len1; 2759 if (*name2 != '=') 2760 error ("Invalid import record: missing `='"); 2761 ++name2; 2762 p = strchr (name2, '.'); 2763 if (p == NULL) 2764 error ("Invalid import record: missing `.'"); 2765 mod_len = p - name2; 2766 memcpy (mod, name2, mod_len); 2767 mod[mod_len] = '\0'; 2768 proc_name = NULL; 2769 errno = 0; 2770 ord = strtol (p + 1, &q, 10); 2771 if (q != p + 1 && *q == 0 && errno == 0) 2772 { 2773 if (ord < 1 || ord > 65535) 2774 error ("Invalid import record: invalid ordinal"); 2775 } 2776 else 2777 { 2778 ord = -1; 2779 proc_name = p + 1; 2780 if (*proc_name == 0) 2781 error ("Invalid import record: invalid name"); 2782 } 2783 2784 /* Write the import definition record. */ 2785 2786 init_rec (COMENT); 2787 put_8 (0x00); 2788 put_8 (IMPDEF_CLASS); 2789 put_8 (IMPDEF_SUBTYPE); 2790 put_8 (proc_name == NULL ? 0x01 : 0x00); /* Import by ordinal or by name */ 2791 put_str (name1); /* Underscore already removed above */ 2792 put_str (mod); 2793 if (proc_name == NULL) 2794 put_16 (ord); 2795 else if (strcmp (proc_name, name1) == 0) 2796 put_8 (0); 2797 else 2798 put_str (proc_name); 2799 write_rec (); 2800 2801 name1 = NULL; 2802 name2 = NULL; 2803 } 2804 } 2805 } 2806 2719 2807 2720 2808 /* If the input file is an import module (method (I1) as created by … … 3629 3717 write_set_pub (); 3630 3718 write_alias (); 3719 write_import_i2 (); 3631 3720 3632 3721 /* Write link pass separator. */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.