Changeset 2997
- Timestamp:
- Apr 6, 2007, 9:20:43 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/emx/src/emxomf/emxomfld.c
r2988 r2997 64 64 static const char *map_fname = NULL; 65 65 static int map_flag = FALSE; 66 67 /* The sym file output flag, set by the -Zsym option. */ 68 static int sym_flag = FALSE; 66 69 67 70 /* The module definition file name (input), set if a file matching … … 1395 1398 1396 1399 if (opt_t) 1397 1400 show_spawn(pszwhat); 1398 1401 1399 1402 /* construct spawnvp() argument array */ … … 1487 1490 "\n", stderr); 1488 1491 fputs ("Usage: emxomfld -o <file> [-l <lib>] [-L <libdir>] [-T <base>] [-igtsS]\n" 1489 " [-Zexe] [-Zdll] [-Zstack <size>] [-Zmap[=<map_file>]]\n"1490 " 1491 " 1492 " 1492 " [-Zexe] [-Zdll] [-Zsym] [-Zstack <size>] [-Zmap[=<map_file>]]\n" 1493 " [-Z[no-]autoconv] [-Zdll-search] [-O <option>] [-static]\n" 1494 " [-non_shared] [-Bstatic] [-dn] [call_shared] [-Bshared]\n" 1495 " [-dy] <file>...\n" 1493 1496 "\n", stderr); 1494 1497 fputs ("Options:\n" … … 1505 1508 " lib<name>.lib, <name>.lib, <name>.dll, lib<name>_s.lib, <name>_s.lib.\n" 1506 1509 " -Zdll-search:\n" 1507 " Enables dlls as valid libraries from shared linking. (default disabled)\n" 1510 " Enables dlls as valid libraries from shared linking. (default disabled)\n", 1511 stderr); 1512 fputs (" -Zsym:" 1513 " Invoke mapsym.cmd on the mapfile to produce a .sym file. Requires -Zmap.\n" 1508 1514 "\n", stderr); 1509 1515 fputs ("Environment variables:\n" … … 1549 1555 #define OPT_ZDLL_SEARCH 0x1008 1550 1556 {"Zdll-search",0, 0, OPT_ZDLL_SEARCH}, 1557 #define OPT_ZSYM 0x1009 1558 {"Zsym",0, 0, OPT_ZSYM}, 1551 1559 /* {"e", 1, 0, 'e'}, entry point */ 1552 1560 {"i", 0, 0, 'i'}, … … 1743 1751 break; 1744 1752 1753 case OPT_ZSYM: 1754 sym_flag = TRUE; 1755 break; 1756 1745 1757 case OPT_LIBS_STATIC: 1746 1758 opt_libs_static = 1; … … 1773 1785 { 1774 1786 fprintf (stderr, "emxomfld: no input files\n"); 1787 return 1; 1788 } 1789 1790 /* Check that -Zmap was specified with -Zsym. */ 1791 1792 if (sym_flag && !map_flag) 1793 { 1794 fprintf (stderr, "emxomfld: -Zsym without -Zmap.\n"); 1775 1795 return 1; 1776 1796 } … … 2196 2216 t = xstrdup (output_fname); 2197 2217 _remext (t); 2198 _execname (&execname[0], sizeof(execname));2199 strcpy (_getname(&execname[0]), "ldstub.bin");2218 _execname (&execname[0], sizeof(execname)); 2219 strcpy (_getname(&execname[0]), "ldstub.bin"); 2200 2220 2201 2221 /* Copy stub into file */ 2202 2222 if (opt_t) 2203 fprintf(stderr, "*** copy %s to %s (-Zexe)", execname, t);2204 DosCopy (&execname[0], t, 4);2223 fprintf (stderr, "*** copy %s to %s (-Zexe)", execname, t); 2224 DosCopy (&execname[0], t, 4); 2205 2225 2206 2226 /* Now touch it */ 2207 if (utime (t, NULL))2227 if (utime (t, NULL)) 2208 2228 { 2209 2229 perror ("emxomfld"); … … 2213 2233 } 2214 2234 2235 /* Run mapsym if requested and linking succeeded. */ 2236 if (rc == 0 && sym_flag) 2237 { 2238 char* cwd = getcwd (NULL, 0); 2239 char map_fname_fullpath[_MAX_PATH]; 2240 char drive[_MAX_PATH]; 2241 char dir[_MAX_DIR]; 2242 2243 /* get absolute path of map file and change CWD to map file directory. */ 2244 _fullpath (map_fname_fullpath, map_fname, sizeof (map_fname_fullpath)); 2245 _splitpath (map_fname_fullpath, drive, dir, NULL, NULL); 2246 strcat (drive, dir); 2247 if (chdir (drive)) 2248 { 2249 perror ("chdir failed"); 2250 exit (2); 2251 } 2252 2253 /* Invoke mapsym.cmd writing the .sym file to current directory. */ 2254 arg_init (TRUE); 2255 if (getenv ("COMSPEC")) 2256 put_arg (getenv ("COMSPEC"), TRUE, FALSE); 2257 else 2258 put_arg ("cmd.exe", TRUE, FALSE); 2259 put_arg ("/c", FALSE, FALSE); 2260 put_arg ("mapsym.cmd", TRUE, FALSE); 2261 if (!stricmp (linker_type, "WLINK")) 2262 put_arg ("watcom", TRUE, FALSE); 2263 else if (!stricmp (linker_type, "LINK386")) 2264 put_arg ("link386", TRUE, FALSE); 2265 else 2266 put_arg ("vac3xx", TRUE, FALSE); 2267 put_arg (map_fname_fullpath, TRUE, FALSE); 2268 arg_end (); 2269 rc = emxomfld_spawn (command_line, "Mapsym"); 2270 if (rc < 0) 2271 { 2272 perror ("emxomfld: mapsym"); 2273 exit (2); 2274 } 2275 2276 /* Restore the working directory */ 2277 if (chdir (cwd)) 2278 { 2279 perror ("chdir failed"); 2280 exit (2); 2281 } 2282 } 2283 2215 2284 /* Return the return code of Linker or RC. */ 2216 2285 2217 2286 return rc; 2218 2287 } 2288
Note:
See TracChangeset
for help on using the changeset viewer.