Changeset 2673
- Timestamp:
- Mar 19, 2006, 6:21:22 AM (19 years ago)
- Location:
- trunk/emx
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/emx/ChangeLog.emx
r2448 r2673 1 1 /* $Id$ */ 2 2 3 TODO: open replace on RAMFS fails with error 32! 3 2006-03-19: knut st. osmundsen <bird-gccos2-spam@anduin.net> 4 - *: 5 o Synced over changed from 0.6.1 bugfixing. 6 - emxbind: 7 o #38: Fixed truncation bug writing to the LX nametable. (Yuri) 8 o #38: Imports and exports are limited to 255 not 127 chars. (Yuri) 9 o #28: Use DLL name from the .def file when present. 10 - emxomf: 11 o #70: Demangle symbol names in debug info. (thanks to Yuri) 12 - emxomfld: 13 o #55: delete the response file when reinit the args. 14 o #46: specify .map file extension to the linker. 15 o #34: Removed all the silliness trying to deal with truncated symbols. 16 o Don't display usage() on failure, just the error message. 17 o #20: use mkstemp + close instead of mktemp for the response file. 18 - ld: 19 o #20: use make_temp_file instead of mktemp. This involved including 20 libiberty.h which required some adjustments of duplicate code to work. 21 o #27: Applied fix from Yuri. 22 - libmoddef: 23 o Allow '.' and '@' in LIBRARY/NAME names. 4 24 5 25 2004-11-14: knut st. osmundsen <bird-gccos2-spam@anduin.net> -
trunk/emx/src/emxbind/emxbind.c
r1282 r2673 160 160 case _MD_LIBRARY: 161 161 162 /* Create a DLL. Save the initialization and termination163 policies after choosing default values for unspecified164 values . */162 /* Create a DLL. Override the module name if specified. Save the 163 initialization and termination policies after choosing default 164 values for unspecified values. */ 165 165 166 166 dll_flag = TRUE; 167 168 if (stmt->library.name[0] != 0) 169 module_name = xstrdup (stmt->library.name); 170 167 171 switch (stmt->library.init) 168 172 { -
trunk/emx/src/emxbind/emxbind.h
r2300 r2673 519 519 520 520 void error (const char *fmt, ...) NORETURN2; 521 void warning (const char *fmt, ...); 521 522 void my_read (void *dst, size_t size, struct file *f); 522 523 void my_read_str (byte *dst, size_t size, struct file *f); -
trunk/emx/src/emxbind/export.c
r1333 r2673 76 76 77 77 name_len = strlen (name); 78 if (name_len >= 128) 79 name_len = 127; 78 if (name_len > 255) 79 { 80 warning("truncating export '%s' to 255 chars (ord %d)!", name, ord); 81 blen = 255; 82 } 80 83 else 81 84 blen = (byte)name_len; -
trunk/emx/src/emxbind/fixup.c
r828 r2673 285 285 286 286 name_len = strlen (name); 287 if (name_len >= 128)288 name_len = 127;289 287 i = 0; 290 288 while (i < procs.len) -
trunk/emx/src/emxbind/utils.c
r18 r2673 49 49 exit (2); 50 50 } 51 52 53 /* Print an warning message. This function is called like printf(). 54 The message will be prefixed with "emxbind: warning: " and a 55 newline will be added at the end. */ 56 57 void warning (const char *fmt, ...) 58 { 59 va_list arg_ptr; 60 61 va_start (arg_ptr, fmt); 62 fprintf (stderr, "emxbind: warning: "); 63 vfprintf (stderr, fmt, arg_ptr); 64 fputc ('\n', stderr); 65 } 66 51 67 52 68 /* Print an out of memory message and abort. */ -
trunk/emx/src/emxomf/emxomf.smak
r1183 r2673 9 9 .TCF := $(CFLAGS.DEF.VERSION) 10 10 .TDEP := @O@libomflib$A 11 .TLDF := -liberty 11 12 include mkexe.smak 12 13 -
trunk/emx/src/emxomf/emxomfld.c
r2300 r2673 349 349 if (response_file == NULL) 350 350 { 351 int fd; 351 352 352 353 /* Complain if we are not allowed to use a response … … 363 364 364 365 strcpy (response_fname, "ldXXXXXX"); 365 if (mktemp (response_fname) == NULL) 366 fd = mkstemp (response_fname); 367 if (fd < 0) 366 368 { 367 369 perror ("emxomfld"); 368 370 exit (2); 369 371 } 372 close(fd); 370 373 response_file = fopen (response_fname, "wt"); 371 374 if (response_file == NULL) … … 1161 1164 static void arg_init (int rsp) 1162 1165 { 1163 response_fname[0] = '\0'; 1166 if (response_fname[0] != '\0') 1167 { 1168 remove (response_fname); 1169 response_fname[0] = '\0'; 1170 } 1164 1171 command_line[0] = '\0'; 1165 1172 line_len = 0; … … 1496 1503 fprintf (stderr, 1497 1504 "emxomfld: multiple module definition files\n"); 1498 usage ();1505 return 1; 1499 1506 } 1500 1507 def_fname = _realrealpath(optarg, NULL, 0); … … 1512 1519 fprintf (stderr, 1513 1520 "emxomfld: multiple binary resource files\n"); 1514 usage ();1521 return 1; 1515 1522 } 1516 1523 res_fname = _realrealpath(optarg, NULL, 0); … … 1585 1592 { 1586 1593 fprintf (stderr, "emxomfld: multiple map files files\n"); 1587 usage ();1594 return 1; 1588 1595 } 1589 1596 map_fname = optarg; … … 1593 1600 case OPT_ZSTACK: 1594 1601 if (!optarg) 1595 usage ();1602 return 1; 1596 1603 errno = 0; 1597 1604 stack_size = strtol (optarg, &t, 0); 1598 1605 if (errno != 0 || *t != 0 || t == optarg) 1599 usage ();1606 return 1; 1600 1607 break; 1601 1608 … … 1622 1629 if (optind > 1) 1623 1630 fprintf (stderr, "emxomfld: invalid option (%s)\n", argv[optind - 1]); 1624 usage (); 1631 else 1632 usage (); 1633 return 1; 1625 1634 } 1626 1635 } … … 1639 1648 { 1640 1649 fprintf (stderr, "emxomfld: no input files\n"); 1641 usage ();1650 return 1; 1642 1651 } 1643 1652 … … 1656 1665 else if (map_fname == NULL) 1657 1666 { 1658 t = xstrdup (output_fname); 1667 int cch = strlen (output_fname) + 1; 1668 t = xmalloc (cch + 4); 1669 memcpy (t, output_fname, cch); 1659 1670 _remext (t); 1671 strcat (t, ".map"); 1660 1672 map_fname = t; 1661 1673 } -
trunk/emx/src/emxomf/stabshll.c
r1885 r2673 20 20 Boston, MA 02111-1307, USA. */ 21 21 //#define HLL_DEBUG 1 22 23 #define DEMANGLE_PROC_NAMES 1 22 24 23 25 /******************************************************************************* … … 31 33 #include <alloca.h> 32 34 #include <ctype.h> 35 #ifdef DEMANGLE_PROC_NAMES 36 # include <demangle.h> 37 #endif 33 38 #include "defs.h" 34 39 #include "emxomf.h" … … 2225 2230 if (!parse_mangled_args ()) 2226 2231 goto syntax; 2227 tf->mnglname = strpool_addn(str_pool, pszMangled, parse_ptr - pszMangled - 1); /* ASSUMES no textra spaces! */2232 tf->mnglname = strpool_addn(str_pool, pszMangled, parse_ptr - pszMangled - 1); /* ASSUMES no extra spaces! */ 2228 2233 tf->flags = parse_visibility () | MEMBER_FUNCTION; 2229 2234 switch (*parse_ptr) … … 3315 3320 struct relocation_info r; 3316 3321 const char *str, *p, *p2; 3317 const char *name; 3318 int n, /* size of name. */ 3319 ti, 3320 ticlass; 3322 const char *name, *mnglname; 3323 #ifdef DEMANGLE_PROC_NAMES 3324 char *pszFree; 3325 #endif 3326 size_t cchName, cchMnglName; 3327 int ti, ticlass; 3321 3328 3322 3329 str = str_ptr + symbol->n_un.n_strx; … … 3324 3331 if (p == NULL) 3325 3332 abort (); 3326 n = p - str; 3327 3328 /** @todo name demangling */ 3329 name = strpool_addn (str_pool, str, n); 3333 cchName = cchMnglName = p - str; 3334 name = mnglname = strpool_addn (str_pool, str, cchMnglName); 3330 3335 proc_start_addr = symbol->n_value; 3336 3337 #ifdef DEMANGLE_PROC_NAMES 3338 /* demangle the name */ 3339 pszFree = cplus_demangle (mnglname, DMGL_ANSI | DMGL_PARAMS); 3340 if (!pszFree && (*mnglname == '_' || *mnglname == '*')) 3341 pszFree = cplus_demangle (mnglname + 1, DMGL_ANSI | DMGL_PARAMS); 3342 if (pszFree) 3343 { 3344 cchName = strlen (pszFree); 3345 name = pszFree; 3346 } 3347 else if (*mnglname == '*') 3348 { 3349 cchName--; 3350 name++; 3351 } 3352 #endif 3331 3353 3332 3354 /* now let's see if there is a memfunc for this name. */ 3333 3355 for (t1 = type_head; t1; t1 = t1->next) 3334 3356 if ( t1->tag == ty_memfunc 3335 && t1->d.memfunc.mnglname == name)3357 && t1->d.memfunc.mnglname == mnglname) 3336 3358 break; 3337 3359 … … 3358 3380 */ 3359 3381 /** @todo: the string parsing still is a bit spooky. */ 3360 for (p2 = p; (p2 = strstr (p2, name)) != NULL; p2 += n)3361 if (p2[-1] == ':' && p2[ n] == ';')3382 for (p2 = p; (p2 = strstr (p2, mnglname)) != NULL; p2 += cchMnglName) 3383 if (p2[-1] == ':' && p2[cchMnglName] == ';') 3362 3384 { 3363 3385 int stab = atoi (&p[3]); … … 3373 3395 if (ticlass < 0) 3374 3396 { 3375 warning (" Can't figure out which class method '%s' is a member of!", name);3397 warning (" Can't figure out which class method '%s' is a member of!", mnglname); 3376 3398 ticlass = 0; 3377 3399 } … … 3411 3433 make_type (t2, &ti); 3412 3434 3413 sst_start (cplusplus_flag || n> 255 ? SST_CPPproc : SST_proc);3435 sst_start (cplusplus_flag || cchName > 255 ? SST_CPPproc : SST_proc); 3414 3436 r.r_address = sst.size; 3415 3437 buffer_dword (&sst, symbol->n_value); /* Segment offset */ … … 3421 3443 buffer_word (&sst, 0); /* Class type (for member functions) */ 3422 3444 buffer_byte (&sst, 8); /* 32-bit near */ 3423 if (cplusplus_flag || n> 255)3445 if (cplusplus_flag || cchName > 255) 3424 3446 buffer_enc (&sst, name); /* Proc name */ 3425 3447 else … … 3434 3456 buffer_mem (&sst_reloc, &r, sizeof (r)); 3435 3457 set_hll_type (symbol - sym_ptr, ti); 3458 3459 #ifdef DEMANGLE_PROC_NAMES 3460 /* free the demangled name. */ 3461 free (pszFree); 3462 #endif 3436 3463 } 3437 3464 -
trunk/emx/src/emxomf/weakld.c
r2235 r2673 73 73 74 74 /** Compares a existing symbol with a new symbol. */ 75 #define SYM_EQUAL(pWld, pSym, _pszName, _fFlags, _uHash, _cchName) \75 #define SYM_EQUAL(pWld, pSym, _pszName, _fFlags, _uHash, _cchName) \ 76 76 ( (pSym)->uHash == (_uHash) \ 77 && ( !((_fFlags) & WLDSF_TRUNCATED) && !((pSym)->fFlags & WLDSF_TRUNCATED) \ 78 ? (pSym)->pszName == (_pszName) \ 79 : symCompareTrucated(pWld, pSym, _pszName, _cchName) ) \ 80 ) 77 && (pSym)->pszName == (_pszName) \ 78 ) 81 79 82 80 /** Compares a existing symbol with a potential symbol. */ 83 #define SYM_EQUAL2(pWld, pSym, _pszName, _fFlags, _uHash, _cchName, _pfn) \81 #define SYM_EQUAL2(pWld, pSym, _pszName, _fFlags, _uHash, _cchName, _pfn) \ 84 82 ( (pSym)->uHash == (_uHash) \ 85 && ( !((_fFlags) & WLDSF_TRUNCATED) && !((pSym)->fFlags & WLDSF_TRUNCATED) \ 86 ? !_pfn((pSym)->pszName, (_pszName), (_cchName)) && !(pSym)->pszName[(_cchName)] \ 87 : symCompareTrucated(pWld, pSym, _pszName, _cchName) ) \ 88 ) 83 && !_pfn((pSym)->pszName, (_pszName), (_cchName)) \ 84 && !(pSym)->pszName[(_cchName)] \ 85 ) 89 86 90 87 … … 187 184 188 185 /** 189 * Truncated EXTDEF name.190 */191 typedef struct wldsymtrunc192 {193 /** Full name. */194 const char * pszName;195 /** Pointer to the next symbol. */196 struct wldsymtrunc *pNext;197 } WLDSYMTRUNC, *PWLDSYMTRUNC;198 199 /**200 186 * Symbol structure. 201 187 */ … … 208 194 /** The full hash value. */ 209 195 unsigned uHash; 210 /** LIFO of truncated name variations. */211 PWLDSYMTRUNC pTrunc;212 196 213 197 /** Symbol flags. */ … … 278 262 * in the definition file. 279 263 */ 280 WLDSF_WEAKALIASDONE = 0x8000, 281 282 /** Internal flag which indicates that the symbol have been 283 * truncated by emxomf. */ 284 WLDSF_TRUNCATED = 0x10000, 264 WLDSF_WEAKALIASDONE = 0x8000 285 265 } fFlags; 286 266 … … 486 466 static int symSearchLibEnum(PWLD pWld, PWLDSYM pSym, void *pvUser); 487 467 static inline unsigned symHash(const char* pszSym, unsigned cch, unsigned fWldCaseFlag); 488 static int symCompareTrucated(PWLD pWld, PWLDSYM pSym1, const char *pszName2, unsigned cchName2);489 468 static const char * symGetDescr(PWLDSYM pSym); 490 469 static void symDumpReferers(PWLDSYM pSym); … … 1265 1244 1266 1245 1267 /**1268 * Internal worker for SYM_EQUAL()1269 *1270 * Compares truncated symbols. The hash for these symbols matches and at least1271 * one of them is truncated.1272 *1273 * @returns 1 if matches1274 * @returns 0 if not matching.1275 * @param pWld Linker Instance.1276 * @param pSym1 Symbol 1.1277 * @param pszName2 Symbol 2 name.1278 * @param cchName2 Symbol 2 name length.1279 */1280 static int symCompareTrucated(PWLD pWld, PWLDSYM pSym1, const char *pszName2, unsigned cchName2)1281 {1282 /* Truncated string comparision means comparing MIN(cchName2, strlen(pSym1->pszName)) chars. */1283 const char *pszName1 = pSym1->pszName;1284 if (pWld->fFlags & WLDC_CASE_INSENSITIVE)1285 {1286 while (cchName2-- > 0 && *pszName1)1287 {1288 if (toupper(*pszName1) != toupper(*pszName2))1289 return 0;1290 pszName1++;1291 pszName2++;1292 }1293 }1294 else1295 {1296 while (cchName2-- > 0 && *pszName1)1297 {1298 if (*pszName1 != *pszName2)1299 return 0;1300 pszName1++;1301 pszName2++;1302 }1303 }1304 return 1;1305 }1306 1307 1308 1246 1309 1247 /** … … 1341 1279 break; 1342 1280 } 1343 else if ( psz[0] == '!'1344 && psz[1] == '_'1345 && psz - psz > 200)1346 {1347 uHash = strtol(&psz[2], NULL, 16);1348 fFlags |= WLDSF_TRUNCATED;1349 cchName = psz - pszName;1350 break;1351 }1352 1281 1353 1282 pszName = (pWld->fFlags & WLDC_CASE_INSENSITIVE ? strpool_addnu : strpool_addn)(pWld->pStrMisc, pszName, cchName); … … 1516 1445 if (cchName > 200) 1517 1446 break; 1518 }1519 else if ( psz[0] == '!'1520 && psz[1] == '_'1521 && psz - pszName > 200)1522 {1523 uHash = strtol(&psz[2], NULL, 16);1524 fFlags |= WLDSF_TRUNCATED;1525 cchName = psz - pszName;1526 break;1527 1447 } 1528 1448 … … 1681 1601 const char *pszName; /* The symbol name in the string pool */ 1682 1602 int cchNameWeak = 0; /* Indicator and length of the weak name. (0 if not weak) */ 1683 int cchNameTrunc = 0; /* Full length of truncated symbol name. */1684 1603 /* general stuff */ 1685 1604 const char * pach; … … 1708 1627 break; 1709 1628 } 1710 else if ( pach[0] == '!'1711 && pach[1] == '_'1712 && pach - pachName > 200)1713 {1714 uHash = strtol(&pach[2], NULL, 16);1715 fFlags |= WLDSF_TRUNCATED;1716 cchNameTrunc = cchNameWeak ? cchNameWeak : cchName;1717 cchName = pach - pachName;1718 break;1719 }1720 1629 } 1721 1630 pszName = (pWld->fFlags & WLDC_CASE_INSENSITIVE ? strpool_addnu : strpool_addn)(pWld->pStrMisc, pachName, cchName); 1722 if (!(fFlags & WLDSF_TRUNCATED)) 1723 uHash = symHash(pszName, cchName, pWld->fFlags & WLDC_CASE_INSENSITIVE); 1631 uHash = symHash(pszName, cchName, pWld->fFlags & WLDC_CASE_INSENSITIVE); 1724 1632 1725 1633 /* search for existing symbol */ … … 1895 1803 } 1896 1804 } 1897 1898 /*1899 * Maintain list of truncated aliases.1900 */1901 if ( !SYM_IS_DEFINED(fFlags)1902 && ((fFlags & WLDSF_TRUNCATED) || (pSym->fFlags & WLDSF_TRUNCATED)))1903 {1904 PWLDSYMTRUNC pTrunc = pSym->pTrunc;1905 const char *pszSubName = pSym->pszWeakName;1906 if (!pszSubName)1907 pszSubName = strpool_addn(pWld->pStrMisc, pachName, cchNameTrunc);1908 1909 while (pTrunc && pTrunc->pszName != pszSubName)1910 pTrunc = pTrunc->pNext;1911 if (!pTrunc)1912 {1913 pTrunc = xmalloc(sizeof(*pTrunc));1914 pTrunc->pszName = pszSubName;1915 pTrunc->pNext = pSym->pTrunc;1916 pSym->pTrunc = pTrunc;1917 }1918 }1919 1805 } 1920 1806 … … 3440 3326 static int wldGenerateObjEnum(PWLD pWld, PWLDSYM pSym, void *pvUser) 3441 3327 { 3442 const char *pszSubName = pSym->pszWeakName; 3328 #pragma pack(1) 3329 struct omfstuff 3330 { 3331 OMFREC hdr; 3332 union 3333 { 3334 char ach[640]; 3335 OMFLIBHDRX libhdr; 3336 }; 3337 } omf; 3338 #pragma pack() 3443 3339 PWLDGOEPARAM pParam = (PWLDGOEPARAM)pvUser; 3340 int cchAlias; 3444 3341 int cch; 3445 WLDSYMTRUNC Trunc;3446 PWLDSYMTRUNC pTrunc;3447 3342 3448 3343 /* 3449 * If weak, we'll make fake trunc record.3344 * Skip non-weak symbols (a bit of paranoia). 3450 3345 */ 3451 if (pSym->pszWeakName) 3452 { 3453 Trunc.pNext = pSym->pTrunc; 3454 Trunc.pszName = pSym->pszName; 3455 pTrunc = &Trunc; 3456 } 3457 else 3458 { 3459 pTrunc = pSym->pTrunc; 3460 pszSubName = pSym->pszName; 3461 } 3462 cch = strlen(pszSubName); 3346 if ( !pSym->pszWeakName 3347 || pSym->pszName == pSym->pszWeakName) 3348 { 3349 WLDDBG(("not weak: '%s'\n", pSym->pszName)); 3350 return 0; 3351 } 3463 3352 3464 3353 /* 3465 * Walk trunc record list.3354 * Create the alias record. 3466 3355 */ 3467 while (pTrunc) 3468 { 3469 if (pTrunc->pszName != pszSubName) 3470 { 3471 #pragma pack(1) 3472 struct omfstuff 3473 { 3474 OMFREC hdr; 3475 union 3476 { 3477 char ach[640]; 3478 OMFLIBHDRX libhdr; 3479 }; 3480 } omf; 3481 #pragma pack() 3482 int cchAlias = strlen(pTrunc->pszName); 3483 3484 WLDINFO(pWld, ("using weak/trunc %s for %s", pszSubName, pTrunc->pszName)); 3485 3486 /* paranoia */ 3487 if (cchAlias > 255) 3488 { 3489 wldErr(pWld, "Symbol '%s' are too long (%d).", pTrunc->pszName, cchAlias); 3490 return -1; 3491 } 3492 if (cch > 255) 3493 { 3494 wldErr(pWld, "Symbol '%s' are too long (%d).", pszSubName, cch); 3495 return -1; 3496 } 3497 3498 /* end the current object? */ 3499 if ((pWld->fFlags & WLDC_LINKER_LINK386) && pParam->cAliases >= 32) 3500 { 3501 int rc = wldObjEnd(pWld, pParam->phFile, 32); 3502 if (rc) 3503 return rc; 3504 pParam->cAliases = 0; 3505 } 3506 3507 /* make new object ? */ 3508 if (!pParam->cAliases) 3509 { 3510 sprintf(omf.ach, "wk%d.obj", pParam->iLibFile++); 3511 int rc = wldObjStart(pWld, pParam->phFile, omf.ach); 3512 if (rc) 3513 return rc; 3514 } 3515 3516 /* Alias record */ 3517 omf.hdr.chType = ALIAS; 3518 omf.hdr.cb = cchAlias + cch + 3; 3519 omf.ach[0] = cchAlias; 3520 memcpy(&omf.ach[1], pTrunc->pszName, cchAlias); /* alias */ 3521 omf.ach[cchAlias + 1] = cch; 3522 memcpy(&omf.ach[cchAlias + 2], pszSubName, cch); /* subtitute */ 3523 omf.ach[cchAlias + cch + 2] = 0; /* crc */ 3524 if (fwrite(&omf, omf.hdr.cb + sizeof(OMFREC), 1, pParam->phFile) != 1) 3525 { 3526 wldErr(pWld, "Error occured while writing weak/trunc aliases. (2)"); 3527 return -1; 3528 } 3529 pParam->cAliases++; 3530 } 3531 3532 /* next */ 3533 pTrunc = pTrunc->pNext; 3534 } 3356 cchAlias = strlen(pSym->pszName); 3357 cch = strlen(pSym->pszWeakName); 3358 WLDINFO(pWld, ("using weak %s for %s", pSym->pszWeakName, pSym->pszName)); 3359 3360 /* paranoia */ 3361 if (cchAlias > 255) 3362 { 3363 wldErr(pWld, "Symbol '%s' are too long (%d).", pSym->pszName, cchAlias); 3364 return -1; 3365 } 3366 if (cch > 255) 3367 { 3368 wldErr(pWld, "Symbol '%s' are too long (%d).", pSym->pszWeakName, cch); 3369 return -1; 3370 } 3371 3372 /* end the current object? */ 3373 if ((pWld->fFlags & WLDC_LINKER_LINK386) && pParam->cAliases >= 32) 3374 { 3375 int rc = wldObjEnd(pWld, pParam->phFile, 32); 3376 if (rc) 3377 return rc; 3378 pParam->cAliases = 0; 3379 } 3380 3381 /* make new object ? */ 3382 if (!pParam->cAliases) 3383 { 3384 sprintf(omf.ach, "wk%d.obj", pParam->iLibFile++); 3385 int rc = wldObjStart(pWld, pParam->phFile, omf.ach); 3386 if (rc) 3387 return rc; 3388 } 3389 3390 /* Alias record */ 3391 omf.hdr.chType = ALIAS; 3392 omf.hdr.cb = cchAlias + cch + 3; 3393 omf.ach[0] = cchAlias; 3394 memcpy(&omf.ach[1], pSym->pszName, cchAlias); /* alias */ 3395 omf.ach[cchAlias + 1] = cch; 3396 memcpy(&omf.ach[cchAlias + 2], pSym->pszWeakName, cch); /* subtitute */ 3397 omf.ach[cchAlias + cch + 2] = 0; /* crc */ 3398 if (fwrite(&omf, omf.hdr.cb + sizeof(OMFREC), 1, pParam->phFile) != 1) 3399 { 3400 wldErr(pWld, "Error occured while writing weak/trunc aliases. (2)"); 3401 return -1; 3402 } 3403 pParam->cAliases++; 3535 3404 3536 3405 return 0; -
trunk/emx/src/ld/ld.c
r2275 r2673 43 43 #include <string.h> 44 44 #endif 45 #include "libiberty.h" 45 46 46 47 #if !defined(A_OUT) … … 872 873 int cl_refs_allocated; 873 874 874 char *xmalloc (int);875 void *xrealloc (void *, int);875 void *xmalloc (size_t); 876 void *xrealloc (void *, size_t); 876 877 void usage (char *, char *); 877 878 void fatal (char *, ...); … … 899 900 void symtab_init (void); 900 901 void padfile (int, int); 901 char *concat (const char *, const char *, const char *);902 902 char *get_file_name (struct file_entry *); 903 903 symbol *getsym (char *), *getsym_soft (char *); … … 1213 1213 discard_locals = DISCARD_ALL; 1214 1214 break; 1215 1215 1216 1216 case 'y': 1217 1217 { … … 1242 1242 search_dirs[n_search_dirs - 1] = optarg; 1243 1243 break; 1244 1244 1245 1245 case 'M': 1246 1246 write_map = 1; … … 1309 1309 = (struct string_list_element *) 1310 1310 xmalloc (sizeof (struct string_list_element)); 1311 1311 1312 1312 new->str = optarg; 1313 1313 new->next = set_element_prefixes; … … 1392 1392 1393 1393 case 'l': 1394 p->filename = concat ("", optarg, "" );1395 p->local_sym_name = concat ("-l", optarg, "" );1394 p->filename = concat ("", optarg, "", NULL); 1395 p->local_sym_name = concat ("-l", optarg, "", NULL); 1396 1396 p->search_dirs_flag = 1; 1397 1397 p->dynamic = !opt_libs_static; … … 1612 1612 { 1613 1613 int lendir = strlen (search_dirs[i]); 1614 register char *string = xmalloc (lendir + lenname + 4 + 6 + 1);1614 register char *string = (char *) xmalloc (lendir + lenname + 4 + 6 + 1); 1615 1615 int j; 1616 1616 … … 2483 2483 entry->filename); 2484 2484 read_entry_symbols (desc, subentry); 2485 subentry->strings = xmalloc (subentry->strs_size);2485 subentry->strings = (char *) xmalloc (subentry->strs_size); 2486 2486 read_entry_strings (desc, subentry); 2487 2487 … … 3419 3419 if (!demangler || !(nm = (*demangler)(g->name))) 3420 3420 nm = g->name; 3421 errmsg = xmalloc (strlen (errfmt) + strlen (nm) + 1);3421 errmsg = (char *) xmalloc (strlen (errfmt) + strlen (nm) + 1); 3422 3422 sprintf (errmsg, errfmt, nm, data_segment ? "data" : "text"); 3423 3423 if (nm != g->name) … … 3854 3854 void check_exe (void) 3855 3855 { 3856 char *ext, *tmp_dir; 3857 size_t tmp_dir_len; 3856 char *ext; 3858 3857 3859 3858 if (exe_flag) … … 3867 3866 { 3868 3867 touch_filename = output_filename; 3869 exe_filename = concat (output_filename, ".exe", "");3868 exe_filename = concat (output_filename, ".exe", NULL); 3870 3869 } 3871 3870 } … … 3887 3886 /* Create a temporary a.out executable file. */ 3888 3887 3889 tmp_dir = getenv ("TMPDIR"); 3890 if (tmp_dir == NULL) tmp_dir = getenv ("TMP"); 3891 if (tmp_dir == NULL) tmp_dir = getenv ("TEMP"); 3892 if (tmp_dir == NULL) tmp_dir = "."; 3893 tmp_dir_len = strlen (tmp_dir); 3894 output_filename = xmalloc (tmp_dir_len + 10); 3895 memcpy (output_filename, tmp_dir, tmp_dir_len); 3896 if (tmp_dir_len != 0 && strchr ("\\/:", tmp_dir[tmp_dir_len-1]) == NULL) 3897 output_filename[tmp_dir_len++] = '\\'; 3898 strcpy (output_filename + tmp_dir_len, "ldXXXXXX"); 3899 if (mktemp (output_filename) == NULL) 3900 fatal ("mktemp(\"%s\") failed", output_filename); 3888 output_filename = make_temp_file ("ldXXXXXX"); 3901 3889 3902 3890 if (rsxnt_linked != EMX_DEFAULT && strip_symbols != STRIP_NONE) /* RSXNT */ … … 4010 3998 if (map_filename == NULL) 4011 3999 { 4012 freeav[j++] = map_filename = ALLOCA (strlen ( output_filename) + 5);4000 freeav[j++] = map_filename = ALLOCA (strlen (exe_filename) + 5); 4013 4001 strcpy (map_filename, exe_filename); 4014 4002 _remext (map_filename); … … 5051 5039 if (strncmp (tmp, "-l", 2) != 0 5052 5040 && (len < 2 || strcmp (tmp+len-2, ".o") != 0)) 5053 tmp = concat (tmp, ".o", ""); /* Needed by GDB */5041 tmp = concat (tmp, ".o", NULL); /* Needed by GDB */ 5054 5042 nl.n_un.n_strx = assign_string_table_index (tmp); 5055 5043 } … … 5397 5385 5398 5386 if (errno < sys_nerr) 5399 s = concat ("", sys_errlist[errno], " for %s" );5387 s = concat ("", sys_errlist[errno], " for %s", NULL); 5400 5388 else 5401 5389 s = "cannot open %s"; … … 5413 5401 5414 5402 if (errno < sys_nerr) 5415 s = concat ("", sys_errlist[errno], " for " );5403 s = concat ("", sys_errlist[errno], " for ", NULL); 5416 5404 else 5417 5405 s = "cannot open "; … … 5474 5462 } 5475 5463 5476 /* Return a newly-allocated string5477 whose contents concatenate the strings S1, S2, S3. */5478 5479 char *5480 concat (s1, s2, s3)5481 const char *s1, *s2, *s3;5482 {5483 register int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);5484 register char *result = (char *) xmalloc (len1 + len2 + len3 + 1);5485 5486 strcpy (result, s1);5487 strcpy (result + len1, s2);5488 strcpy (result + len1 + len2, s3);5489 result[len1 + len2 + len3] = 0;5490 5491 return result;5492 }5493 5494 5464 /* Parse the string ARG using scanf format FORMAT, and return the result. 5495 5465 If it does not parse, report fatal error … … 5508 5478 /* Like malloc but get fatal error if memory is exhausted. */ 5509 5479 5510 char*5480 void * 5511 5481 xmalloc (size) 5512 int size;5482 size_t size; 5513 5483 { 5514 5484 register char *result = malloc (size); … … 5523 5493 xrealloc (ptr, size) 5524 5494 void *ptr; 5525 int size;5495 size_t size; 5526 5496 { 5527 5497 register char *result = realloc (ptr, size); … … 5684 5654 */ 5685 5655 pName = (struct lx_tmp *)xmalloc(sizeof(*pName)); 5686 pName->name = psz = xmalloc(_MAX_PATH);5656 pName->name = psz = (char *)xmalloc(_MAX_PATH); 5687 5657 if (!make_tempfile(psz, "lddef", ".def")) 5688 5658 { -
trunk/emx/src/libmoddef/moddef1.c
r18 r2673 154 154 { 155 155 char *p; 156 156 157 157 if (fgets (md->buffer, sizeof (md->buffer), md->file) == NULL) 158 158 { … … 170 170 _md_token _md_next_token (struct _md *md) 171 171 { 172 _md_token prev_token = md->token; 172 173 const char *start, *end; 173 174 char *p, quote_char; … … 223 224 md->token = _MD_word; 224 225 start = md->ptr++; 225 md->ptr += strcspn (md->ptr, " \t=@."); 226 if (prev_token == _MD_LIBRARY || prev_token == _MD_NAME) 227 md->ptr += strcspn (md->ptr, " \t="); 228 else 229 md->ptr += strcspn (md->ptr, " \t=@."); 226 230 end = md->ptr; 227 231 } -
trunk/emx/src/misc/MakeOmfLibs.cmd
r2420 r2673 43 43 */ 44 44 Address CMD '@setlocal'; 45 sEMXOMF = sDir'\..\bin\emxomf.exe -t';45 sEMXOMF = sDir'\..\bin\emxomf.exe'; 46 46 sOldBeginLibPath = hlpEnvGet('BEGINLIBPATH'); 47 47 call hlpEnvSet 'BEGINLIBPATH', sDir'..\lib;'sOldBeginLibPath
Note:
See TracChangeset
for help on using the changeset viewer.