Changeset 2815
- Timestamp:
- Sep 11, 2006, 3:19:43 AM (19 years ago)
- Location:
- branches/libc-0.6/src/emx
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/Makefile.gmk
r2457 r2815 125 125 LDFLAGS.dbg = -g 126 126 LDFLAGS.aout = -Zaout 127 ifeq ($(EMXOMFLD_TYPE),wlink) 128 LDFLAGS.omf = -Zomf 129 else 127 130 LDFLAGS.omf = -Zomf -Zlinker /PM:VIO -Zlinker /LINENUMBERS 131 endif 128 132 LDFLAGS.prof = -pg 129 133 # Linker flags for different kinds of target -
branches/libc-0.6/src/emx/src/emxomf/emxomfld.c
r2812 r2815 156 156 /* The type of linker to use. By default we assume it's VAC365 or later 157 157 version of ilink. This can be overridden with the EMXOMFLD_TYPE env. 158 var. using any of the value VAC365, VAC308 and LINK386. */158 var. using any of the values WLINK, VAC365, VAC308 and LINK386. */ 159 159 static const char *linker_type = "VAC365"; 160 160 … … 253 253 } 254 254 255 /* Opens a response file. */ 256 257 static void open_response_file(void) 258 { 259 int fd; 260 261 if (response_file) 262 return; 263 264 /* Complain if we are not allowed to use a response 265 file. */ 266 267 if (!response_flag) 268 { 269 fprintf (stderr, "emxomfld: command line too long\n"); 270 exit (2); 271 } 272 273 /* Choose a unique file name and create the response 274 file. */ 275 276 strcpy (response_fname, "ldXXXXXX"); 277 fd = mkstemp (response_fname); 278 if (fd < 0) 279 { 280 perror ("emxomfld"); 281 exit (2); 282 } 283 close(fd); 284 response_file = fopen (response_fname, "wt"); 285 if (response_file == NULL) 286 { 287 perror ("emxomfld"); 288 exit (2); 289 } 290 291 /* Add the name of the response file to the command 292 line. */ 293 294 command_line[line_len++] = ' '; 295 command_line[line_len++] = '@'; 296 strcpy (command_line+line_len, response_fname); 297 if (!stricmp (linker_type, "WLINK")) 298 strcat (command_line, "."); 299 300 if (force_response_file) 301 force_response_file = FALSE; 302 } 255 303 256 304 /* Replace forward slashes `/' in NAME with backslashes `\'. The linkers … … 348 396 349 397 if (response_file == NULL) 350 { 351 int fd; 352 353 /* Complain if we are not allowed to use a response 354 file. */ 355 356 if (!response_flag) 357 { 358 fprintf (stderr, "emxomfld: command line too long\n"); 359 exit (2); 360 } 361 362 /* Choose a unique file name and create the response 363 file. */ 364 365 strcpy (response_fname, "ldXXXXXX"); 366 fd = mkstemp (response_fname); 367 if (fd < 0) 368 { 369 perror ("emxomfld"); 370 exit (2); 371 } 372 close(fd); 373 response_file = fopen (response_fname, "wt"); 374 if (response_file == NULL) 375 { 376 perror ("emxomfld"); 377 exit (2); 378 } 379 380 /* Add the name of the response file to the command 381 line. */ 382 383 command_line[line_len++] = ' '; 384 command_line[line_len++] = '@'; 385 strcpy (command_line+line_len, response_fname); 386 387 if (force_response_file) 388 force_response_file = FALSE; 389 } 398 open_response_file(); 390 399 else if (line_len != 0) 391 400 { … … 1041 1050 if (!stricmp(linker_type, "LINK386")) 1042 1051 fFlags |= WLDC_LINKER_LINK386; 1052 else if (!stricmp(linker_type, "WLINK")) 1053 fFlags |= WLDC_LINKER_WLINK; 1043 1054 1044 1055 for (pOpt = options; pOpt; pOpt = pOpt->next) … … 1245 1256 } 1246 1257 1258 /* converts a def file statement to watcom responsfile lingo. */ 1259 1260 static int def_2_watcom(struct _md *md, const _md_stmt *stmt, _md_token token, void *arg) 1261 { 1262 switch (token) 1263 { 1264 case _MD_BASE: 1265 fprintf (response_file, "OPTION OFFSET=%#lx\n", stmt->base.addr); 1266 break; 1267 1268 case _MD_CODE: 1269 break; 1270 1271 case _MD_DATA: 1272 break; 1273 1274 case _MD_DESCRIPTION: 1275 fprintf (response_file, "OPTION DESCRIPTION '%s'\n", stmt->descr.string); 1276 break; 1277 1278 case _MD_EXETYPE: 1279 break; 1280 1281 case _MD_EXPORTS: 1282 fprintf (response_file, "EXPORT '%s'", stmt->export.entryname); 1283 if (stmt->export.flags & _MDEP_ORDINAL) 1284 fprintf (response_file, ".%d", stmt->export.ordinal); 1285 if (stmt->export.internalname[0]) 1286 fprintf (response_file, "='%s'", stmt->export.internalname); 1287 if (stmt->export.flags & _MDEP_RESIDENTNAME) 1288 fprintf (response_file, " RESIDENT"); 1289 /** @todo _MDEP_NONAME */ 1290 fprintf (response_file, "\n"); 1291 1292 /* reference the internal name. */ 1293 if (stmt->export.internalname[0]) 1294 fprintf (response_file, "REFERENCE '%s'\n", stmt->export.internalname); 1295 break; 1296 1297 case _MD_HEAPSIZE: 1298 fprintf (response_file, "OPTION HEAPSIZE=%#lx\n", stmt->heapsize.size); 1299 break; 1300 1301 case _MD_IMPORTS: 1302 fprintf (response_file, "IMPORT '%s' '%s'", stmt->import.entryname, 1303 stmt->import.modulename); 1304 if (stmt->import.flags & _MDEP_ORDINAL) 1305 fprintf (response_file, ".%d", stmt->import.ordinal); 1306 else if (stmt->import.internalname[0]) 1307 fprintf (response_file, ".'%s'", stmt->import.internalname); 1308 fprintf (response_file, "\n"); 1309 break; 1310 1311 case _MD_LIBRARY: 1312 if (stmt->library.name[0]) 1313 fprintf (response_file, "OPTION MODNAME='%s'\n", stmt->library.name); 1314 break; 1315 1316 case _MD_NAME: 1317 if (stmt->name.name[0]) 1318 fprintf (response_file, "OPTION MODNAME='%s'\n", stmt->name.name); 1319 break; 1320 1321 case _MD_OLD: 1322 fprintf (response_file, "OPTION OLDLIBRARY='%s'\n", stmt->old.name); 1323 break; 1324 1325 case _MD_PROTMODE: 1326 fprintf (response_file, "OPTION PROTMODE\n"); 1327 break; 1328 1329 case _MD_REALMODE: 1330 fprintf (response_file, "OPTION PROTMODE\n"); 1331 break; 1332 1333 case _MD_SEGMENTS: 1334 fprintf (stderr, "emxomfld: ignoring SEGMENTS directive in .def-file\n"); 1335 break; 1336 1337 case _MD_STACKSIZE: 1338 fprintf (response_file, "OPTION STACK=%#lx\n", stmt->stacksize.size); 1339 break; 1340 1341 case _MD_STUB: 1342 if (!stmt->stub.none) 1343 fprintf (response_file, "OPTION STUB='%s'\n", stmt->stub.name); 1344 else 1345 fprintf (stderr, "emxomfld: warning: \"STUB NONE\" is not supported by wlink. ignoring\n"); 1346 break; 1347 1348 case _MD_VIRTUAL: 1349 case _MD_PHYSICAL: 1350 break; 1351 1352 case _MD_parseerror: 1353 fprintf (stderr, "emxomfld: %s (line %ld of %s)", 1354 _md_errmsg (stmt->error.code), _md_get_linenumber (md), def_fname); 1355 exit (2); 1356 break; 1357 1358 default: 1359 abort (); 1360 } 1361 return 0; 1362 } 1363 1247 1364 /* -t output. We dump the commandline and responsefile. */ 1248 1365 static void show_spawn(const char *pszwhat) … … 1338 1455 response_file = NULL; 1339 1456 } 1340 if (response_fname[0] != '\0') 1341 { 1342 remove (response_fname); 1343 response_fname[0] = '\0'; 1344 } 1345 if (weakobj_fname[0] != '\0') 1346 { 1347 remove (weakobj_fname); 1348 weakobj_fname[0] = '\0'; 1349 } 1350 if (weakdef_fname[0] != '\0') 1351 { 1352 remove (weakdef_fname); 1353 weakdef_fname[0] = '\0'; 1354 } 1355 for (; conv_list; conv_list = conv_list->next) 1356 remove (conv_list->name); 1457 if (opt_t <= 1) 1458 { 1459 if (response_fname[0] != '\0') 1460 { 1461 remove (response_fname); 1462 response_fname[0] = '\0'; 1463 } 1464 if (weakobj_fname[0] != '\0') 1465 { 1466 remove (weakobj_fname); 1467 weakobj_fname[0] = '\0'; 1468 } 1469 if (weakdef_fname[0] != '\0') 1470 { 1471 remove (weakdef_fname); 1472 weakdef_fname[0] = '\0'; 1473 } 1474 for (; conv_list; conv_list = conv_list->next) 1475 remove (conv_list->name); 1476 } 1357 1477 } 1358 1478 … … 1364 1484 "Copyright (c) 1992-1996 by Eberhard Mattes\n" 1365 1485 "Copyright (c) 2003 by InnoTek Systemberatung GmbH\n" 1366 "Copyright (c) 2003-200 4by Knut St. Osmundsen\n"1486 "Copyright (c) 2003-2006 by Knut St. Osmundsen\n" 1367 1487 "\n", stderr); 1368 1488 fputs ("Usage: emxomfld -o <file> [-l <lib>] [-L <libdir>] [-T <base>] [-igtsS]\n" … … 1389 1509 fputs ("Environment variables:\n" 1390 1510 " EMXOMFLD_TYPE:\n" 1391 " The type of linker we're using. Values: VAC365, VAC308, LINK386.\n" 1511 " The type of linker we're using. Values: WLINK, VAC365, VAC308, LINK386.\n" 1512 " WLINK wlink.exe from Open Watcom v1.5 or later.\n" 1392 1513 " VAC365 ilink.exe from IBM C and C++ Compilers for OS/2 v3.6 or later.\n" 1393 1514 " VAC308 ilink.exe from Visual Age for C++ v3.08.\n" … … 1448 1569 int main (int argc, char *argv[]) 1449 1570 { 1571 struct stat s; 1450 1572 int c, rc, files; 1451 1573 const char *ext; … … 1545 1667 case 't': 1546 1668 case 'i': /* Trace the linking process, sending /INFO to the IBM/M$ linker. */ 1547 opt_t = TRUE;1669 opt_t++; 1548 1670 break; 1549 1671 … … 1687 1809 t = getenv ("EMXOMFLD_TYPE"); 1688 1810 if ( t 1811 && stricmp(t, "WLINK") 1689 1812 && stricmp(t, "VAC365") 1690 1813 && stricmp(t, "VAC308") … … 1739 1862 arg_init (TRUE); 1740 1863 1741 /*1742 For VAC365 and VAC308 the default options is:1743 1744 /NOFR[EEFORMAT] Use /NOFREEFORMAT to allow a LINK386-compatible1745 command line syntax, in which different types of file1746 are grouped and separated by commas.1747 1748 /DBGPACK If !strip_symbols then we'll add this option, which1749 will cause type tables to be merged into one global1750 table and so eliminating a lot of duplicate info.1751 1752 For VAC365 additional default option is:1753 1754 /STUB:<emxomfld-path>\os2stub.bin1755 Causes this MZ stub to be used when linking the1756 executables instead of the default on for the linker.1757 1758 For LINK386 the default options is:1759 1760 /BATCH Run in batch mode (disable prompting, don't1761 echo response file)1762 1763 The default options for all linkers are:1764 1765 /NOLOGO Don't display sign-on banner1766 1767 /NOEXTDICTIONARY Don't use extended dictionary (redefining1768 library symbols is quite common)1769 1770 /NOIGNORECASE Make symbols case-sensitive1771 1772 /PACKCODE Group neighboring code segments (this is the1773 default unless the SEGMENTS module definition1774 statement is used for a segment of class1775 'CODE'). Not grouping neighboring code1776 segments would break sets1777 1778 For non DLLs targets:1779 1780 /BASE:0x10000 Base the executable an so removing extra fixups.1781 1782 */1783 1784 1864 /* issue commandline */ 1785 1865 put_arg (linker_name, TRUE, FALSE); 1786 1866 1787 /* the next part depends on the linker type. */ 1788 if (!stricmp (linker_type, "LINK386")) 1789 put_arg ("/bat", FALSE, FALSE); 1790 else /* vac3xx: */ 1791 { 1792 put_arg ("/nofree", FALSE, FALSE); 1867 if (stricmp (linker_type, "WLINK")) 1868 { 1869 /* 1870 For VAC365 and VAC308 the default options are: 1871 1872 /NOFR[EEFORMAT] Use /NOFREEFORMAT to allow a LINK386-compatible 1873 command line syntax, in which different types of file 1874 are grouped and separated by commas. 1875 1876 /DBGPACK If !strip_symbols then we'll add this option, which 1877 will cause type tables to be merged into one global 1878 table and so eliminating a lot of duplicate info. 1879 1880 For VAC365 additional default option is: 1881 1882 /STUB:<emxomfld-path>\os2stub.bin 1883 Causes this MZ stub to be used when linking the 1884 executables instead of the default on for the linker. 1885 1886 For LINK386 the default options are: 1887 1888 /BATCH Run in batch mode (disable prompting, don't 1889 echo response file) 1890 1891 The default options for all linkers are: 1892 1893 /NOLOGO Don't display sign-on banner 1894 1895 /NOEXTDICTIONARY Don't use extended dictionary (redefining 1896 library symbols is quite common) 1897 1898 /NOIGNORECASE Make symbols case-sensitive 1899 1900 /PACKCODE Group neighboring code segments (this is the 1901 default unless the SEGMENTS module definition 1902 statement is used for a segment of class 1903 'CODE'). Not grouping neighboring code 1904 segments would break sets 1905 1906 For non DLLs targets: 1907 1908 /BASE:0x10000 Base the executable an so removing extra fixups. 1909 1910 */ 1911 1912 /* the next part depends on the linker type. */ 1913 if (!stricmp (linker_type, "LINK386")) 1914 put_arg ("/bat", FALSE, FALSE); 1915 else /* vac3xx: */ 1916 { 1917 put_arg ("/nofree", FALSE, FALSE); 1918 if (!strip_symbols) 1919 put_arg ("/db", FALSE, FALSE); 1920 if (map_flag) 1921 put_arg ("/map", FALSE, FALSE); 1922 } 1923 put_arg ("/nol", FALSE, FALSE); 1924 put_arg ("/noe", FALSE, FALSE); 1925 put_arg ("/noi", FALSE, FALSE); 1926 put_arg ("/packc", FALSE, FALSE); 1927 1928 1929 /* VAC365: check if we have os2stub.bin. 1930 We must to this after the above stuff else /nol might end up in the 1931 response file and we'll get the component output. */ 1932 1933 if (!stricmp (linker_type, "VAC365")) 1934 { 1935 /* gklayout show that the linker isn't capable of determining a 1936 decent value for this parameter. 32MB makes gklayout link. */ 1937 put_arg ("/ocache:0x02000000", FALSE, FALSE); 1938 1939 _execname (&execname[0], sizeof(execname)); 1940 strcpy (_getname (&execname[0]), "os2stub.bin"); 1941 if (!stat (execname, &s)) 1942 { 1943 sprintf (tmp, "/STUB:%s", &execname[0]); 1944 put_arg (tmp, FALSE, FALSE); 1945 } 1946 } 1947 1948 /* Add the /INFORMATION option if the -i or -t option was given. This is 1949 for debugging. */ 1950 1951 if (opt_t) 1952 put_arg ("/i", FALSE, FALSE); 1953 1954 /* Add the /DEBUG option if the -s option was not given. Without 1955 this, the linker throws away debugging information. */ 1956 1793 1957 if (!strip_symbols) 1794 put_arg ("/db", FALSE, FALSE); 1795 if (map_flag) 1796 put_arg ("/map", FALSE, FALSE); 1797 } 1798 put_arg ("/nol", FALSE, FALSE); 1799 put_arg ("/noe", FALSE, FALSE); 1800 put_arg ("/noi", FALSE, FALSE); 1801 put_arg ("/packc", FALSE, FALSE); 1802 1803 1804 /* VAC365: check if we have os2stub.bin. 1805 We must to this after the above stuff else /nol might end up in the 1806 response file and we'll get the component output. */ 1807 1808 if (!stricmp (linker_type, "VAC365")) 1809 { 1810 struct stat s; 1811 /* gklayout show that the linker isn't capable of determining a 1812 decent value for this parameter. 32MB make gklayout link. */ 1813 put_arg ("/ocache:0x02000000", FALSE, FALSE); 1814 1815 _execname(&execname[0], sizeof(execname)); 1816 strcpy(_getname(&execname[0]), "os2stub.bin"); 1817 if (!stat (execname, &s)) 1818 { 1819 sprintf (tmp, "/STUB:%s", &execname[0]); 1958 put_arg ("/de", FALSE, FALSE); 1959 1960 /* Add the /BASE:n option to set the base address. This specifies 1961 the preferred load address of object 1. The base address being 1962 used is 0x10000 unless a DLL is generated or the -T option was 1963 given. -Tno can be used to suppress the /BASE:n option. */ 1964 1965 if (base == NULL && !dll_flag) 1966 { 1967 struct _md *md; 1968 1969 if (def_fname != NULL) 1970 { 1971 int token; 1972 md = _md_open (def_fname); 1973 if (md == NULL) 1974 { 1975 fprintf (stderr, "emxomfld: cannot open `%s'\n", def_fname); 1976 exit (2); 1977 } 1978 token = _md_next_token (md); 1979 if (token == _MD_LIBRARY || token == _MD_PHYSICAL || token == _MD_VIRTUAL) 1980 dll_flag = TRUE; 1981 _md_close (md); 1982 } 1983 } 1984 if (base == NULL && !dll_flag) 1985 base = "0x10000"; 1986 if (base != NULL && stricmp (base, "no") != 0) 1987 { 1988 sprintf (tmp, "/bas:%s", base); 1820 1989 put_arg (tmp, FALSE, FALSE); 1821 1990 } 1822 } 1823 1824 /* Add the /INFORMATION option if the -i or -t option was given. This is 1825 for debugging. */ 1826 1827 if (opt_t) 1828 put_arg ("/i", FALSE, FALSE); 1829 1830 /* Add the /DEBUG option if the -s option was not given. Without 1831 this, the linker throws away debugging information. */ 1832 1833 if (!strip_symbols) 1834 put_arg ("/de", FALSE, FALSE); 1835 1836 /* Add the /BASE:n option to set the base address. This specifies 1837 the preferred load address of object 1. The base address being 1838 used is 0x10000 unless a DLL is generated or the -T option was 1839 given. -Tno can be used to suppress the /BASE:n option. */ 1840 1841 if (base == NULL && !dll_flag) 1842 { 1843 struct _md *md; 1844 1845 if (def_fname != NULL) 1991 1992 /* Add the /STACK:n option if the -Zstack option was given. */ 1993 1994 if (!dll_flag) 1995 { 1996 sprintf (tmp, "/st:0x%lx", stack_size * 1024); 1997 put_arg (tmp, FALSE, FALSE); 1998 } 1999 2000 /* Add the linker options specified with -O. */ 2001 2002 put_args (options, FALSE); 2003 2004 /* Put the object file names onto the command line. */ 2005 2006 force_response_file = TRUE; /* link386 workaround. */ 2007 put_args (obj_fnames, TRUE); 2008 put_arg (",", FALSE, FALSE); 2009 2010 /* Put the output file name onto the command line. */ 2011 2012 put_arg (output_fname, TRUE, TRUE); 2013 put_arg (",", FALSE, FALSE); 2014 2015 /* Put the map file name onto the command line. */ 2016 2017 put_arg (map_fname, TRUE, TRUE); 2018 put_arg (",", FALSE, FALSE); 2019 2020 /* Put the library file names onto the command line. */ 2021 2022 put_args (lib_fnames, TRUE); 2023 put_arg (",", FALSE, FALSE); 2024 2025 /* Put the name of the module definition file onto the command line. */ 2026 2027 put_arg (def_fname, TRUE, TRUE); 2028 put_arg (";", FALSE, FALSE); 2029 2030 /* Call Linker and abort on failure. */ 2031 } 2032 else /* wlink */ 2033 { 2034 open_response_file (); 2035 2036 /* figure out what format options we're gonna use */ 2037 2038 if (!def_fname && !dll_flag) 2039 fprintf (response_file, "FORMAT OS2 LX PMCompatible\n"); 2040 else if (!def_fname && dll_flag) 2041 fprintf (response_file, "FORMAT OS2 LX DLL INITINSTANCE TERMINSTANCE\n"); 2042 else 1846 2043 { 1847 2044 int token; 1848 md = _md_open (def_fname);1849 if ( md == NULL)2045 struct _md *pMd = _md_open (def_fname); 2046 if (!pMd) 1850 2047 { 1851 2048 fprintf (stderr, "emxomfld: cannot open `%s'\n", def_fname); 1852 2049 exit (2); 1853 2050 } 1854 token = _md_next_token ( md);2051 token = _md_next_token (pMd); 1855 2052 if (token == _MD_LIBRARY || token == _MD_PHYSICAL || token == _MD_VIRTUAL) 1856 2053 dll_flag = TRUE; 1857 _md_close (md); 1858 } 1859 } 1860 if (base == NULL && !dll_flag) 1861 base = "0x10000"; 1862 if (base != NULL && stricmp (base, "no") != 0) 1863 { 1864 sprintf (tmp, "/bas:%s", base); 1865 put_arg (tmp, FALSE, FALSE); 1866 } 1867 1868 /* Add the /STACK:n option if the -Zstack option was given. */ 1869 1870 if (!dll_flag) 1871 { 1872 sprintf (tmp, "/st:0x%lx", stack_size * 1024); 1873 put_arg (tmp, FALSE, FALSE); 1874 } 1875 1876 /* Add the linker options specified with -O. */ 1877 1878 put_args (options, FALSE); 1879 1880 /* Put the object file names onto the command line. */ 1881 1882 force_response_file = TRUE; /* link386 workaround. */ 1883 put_args (obj_fnames, TRUE); 1884 put_arg (",", FALSE, FALSE); 1885 1886 /* Put the output file name onto the command line. */ 1887 1888 put_arg (output_fname, TRUE, TRUE); 1889 put_arg (",", FALSE, FALSE); 1890 1891 /* Put the map file name onto the command line. */ 1892 1893 put_arg (map_fname, TRUE, TRUE); 1894 put_arg (",", FALSE, FALSE); 1895 1896 /* Put the library file names onto the command line. */ 1897 1898 put_args (lib_fnames, TRUE); 1899 put_arg (",", FALSE, FALSE); 1900 1901 /* Put the name of the module definition file onto the command line. */ 1902 1903 put_arg (def_fname, TRUE, TRUE); 1904 put_arg (";", FALSE, FALSE); 2054 if (dll_flag) 2055 { 2056 int fInitInstance = 1; 2057 int fTermInstance = 1; 2058 for (;;) 2059 { 2060 switch (_md_next_token (pMd)) 2061 { 2062 case _MD_INITINSTANCE: fInitInstance = 1; continue; 2063 case _MD_INITGLOBAL: fInitInstance = 0; continue; 2064 case _MD_TERMINSTANCE: fTermInstance = 1; continue; 2065 case _MD_TERMGLOBAL: fTermInstance = 0; continue; 2066 default: break; 2067 } 2068 break; 2069 } 2070 fprintf (response_file, "FORMAT OS2 LX DLL %s %s\n", 2071 fInitInstance ? "INITINSTANCE" : "INITGLOBAL", 2072 fTermInstance ? "TERMINSTANCE" : "TERMGLOBAL"); 2073 } 2074 else 2075 switch (_md_next_token (pMd)) 2076 { 2077 case _MD_WINDOWAPI: 2078 fprintf (response_file, "FORMAT OS2 LX PM\n"); 2079 break; 2080 default: 2081 case _MD_WINDOWCOMPAT: 2082 fprintf (response_file, "FORMAT OS2 LX PMCompatible\n"); 2083 break; 2084 case _MD_NOTWINDOWCOMPAT: 2085 fprintf (response_file, "FORMAT OS2 LX FullScreen\n"); 2086 break; 2087 } 2088 _md_close (pMd); 2089 } 2090 2091 /* output files */ 2092 2093 fprintf (response_file, "NAME '%s'\n", output_fname); 2094 2095 if (map_flag && map_fname) 2096 fprintf (response_file, "OPTION MAP='%s'\n", map_fname); 2097 else if (map_flag) 2098 fprintf (response_file, "OPTION MAP\n"); 2099 2100 /* standard stuff */ 2101 2102 if (!strip_symbols) 2103 fprintf (response_file, "DEBUG HLL\n"); 2104 fprintf (response_file, "OPTION QUIET\n"); 2105 fprintf (response_file, "OPTION OSNAME='OS/2 EMX'\n"); 2106 fprintf (response_file, "OPTION CASEEXACT\n"); 2107 if (!dll_flag) 2108 fprintf (response_file, "OPTION STACK=%#lx\n", stack_size * 1024); 2109 if (!dll_flag && !base) 2110 base = "0x10000"; 2111 if (base) 2112 fprintf (response_file, "OPTION OFFSET=%s\n", base); 2113 2114 /* the stub */ 2115 2116 _execname(&execname[0], sizeof(execname)); 2117 strcpy (_getname (&execname[0]), "os2stub.bin"); 2118 if (!stat (execname, &s)) 2119 fprintf (response_file, "OPTION STUB='%s'\n", execname); 2120 2121 /* Add the /INFORMATION option if the -i or -t option was given. This is 2122 for debugging. */ 2123 2124 // if (opt_t) 2125 // put_arg ("/i", FALSE, FALSE); 2126 2127 /* Add the linker options specified with -O. */ 2128 2129 for (pcur = options; pcur; pcur = pcur->next) 2130 fprintf (response_file, "%s\n", pcur->name); 2131 2132 /* Put the object file names onto the command line. */ 2133 2134 for (pcur = obj_fnames; pcur; pcur = pcur->next) 2135 fprintf (response_file, "FILE '%s'\n", pcur->name); 2136 2137 /* Put the library file names onto the command line. */ 2138 2139 for (pcur = lib_fnames; pcur; pcur = pcur->next) 2140 fprintf (response_file, "LIBRARY '%s'\n", pcur->name); 2141 2142 /* Translate the essentials of the module definition file into wlink lingo. */ 2143 if (def_fname) 2144 { 2145 struct _md *pMd = _md_open (def_fname); 2146 if (!pMd) 2147 { 2148 fprintf (stderr, "emxomfld: cannot open `%s'\n", def_fname); 2149 exit (2); 2150 } 2151 _md_next_token (pMd); 2152 _md_parse (pMd, def_2_watcom, NULL); 2153 _md_close (pMd); 2154 } 2155 } 2156 2157 /* End the arguments and run the linker. */ 2158 1905 2159 arg_end (); 1906 1907 /* Call Linker and abort on failure. */1908 2160 1909 2161 rc = emxomfld_spawn (command_line, "Linker"); -
branches/libc-0.6/src/emx/src/emxomf/weakld.c
r2517 r2815 1998 1998 { 1999 1999 pSym->fFlags |= WLDSF_ALIAS; 2000 pSym->fFlags &= ~WLDSF_UNDEF; 2000 2001 pSym->pAliasFor = pSymAlias; 2001 2002 } … … 3498 3499 { 3499 3500 cch = sprintf(szTmp, " \"%s\" = \"%s\"", pStmt->export.entryname, pSymExp->pszWeakName); 3500 pSymExp->fFlags |= WLDSF_WEAKALIASDONE; 3501 if (!(pParam->pWld->fFlags & WLDC_LINKER_WLINK)) 3502 pSymExp->fFlags |= WLDSF_WEAKALIASDONE; 3501 3503 } 3502 3504 if (pStmt->export.flags & _MDEP_ORDINAL) … … 3688 3690 /* now see if there are any aliases in __declspec(dllexport) statements. */ 3689 3691 if (!rc) 3690 rc = symEnum(pWld, &pWld->Global, 3691 WLDSF_EXPORT | WLDSF_WEAK, WLDSF_EXPORT | WLDSF_WEAK | WLDSF_EXPORT_DEF | WLDSF_WEAKALIASDONE, 3692 wldGenerateDefExportEnum, ¶m); 3692 { 3693 if (0)//pWld->fFlags & WLDC_LINKER_WLINK) 3694 rc = symEnum(pWld, &pWld->Global, 3695 WLDSF_EXPORT | WLDSF_EXPORT_DEF | WLDSF_WEAK, WLDSF_EXPORT | WLDSF_EXPORT_DEF | WLDSF_WEAK | WLDSF_WEAKALIASDONE, 3696 wldGenerateDefExportEnum, ¶m); 3697 else 3698 rc = symEnum(pWld, &pWld->Global, 3699 WLDSF_EXPORT | WLDSF_WEAK, WLDSF_EXPORT | WLDSF_WEAK | WLDSF_EXPORT_DEF | WLDSF_WEAKALIASDONE, 3700 wldGenerateDefExportEnum, ¶m); 3701 } 3693 3702 3694 3703 /* copy the rest of the file if any changes was made. */ -
branches/libc-0.6/src/emx/src/emxomf/weakld.h
r941 r2815 44 44 WLDC_CASE_INSENSITIVE = 4, 45 45 /** The linker is link386. */ 46 WLDC_LINKER_LINK386 = 0x1000 46 WLDC_LINKER_LINK386 = 0x1000, 47 /** The linker is wlink. */ 48 WLDC_LINKER_WLINK = 0x2000 47 49 }; 48 50 -
branches/libc-0.6/src/emx/src/ld/ld.smak
r2275 r2815 27 27 # link386 -> ilink 28 28 #.TLDF := -nostdlib -los2 -s -Zlinker /align:1 -Zlinker /nosectoraligncode 29 .TLDF := -nostdlib -los2 -s -Zlinker /align:1 -lend 29 ifeq ($(EMXOMFLD_TYPE),wlink) 30 .TLDF := -nostdlib -los2 -lend -s -Zlinker "OPTION ALIGN=4096" 31 else # ilink: 32 .TLDF := -nostdlib -los2 -lend -s -Zlinker /align:1 33 endif 30 34 .TKEEP := 1 31 35 include mkexe.smak -
branches/libc-0.6/src/emx/src/lib/fwdstub.asm
r1871 r2815 3 3 WEAK$ZERO = 0 4 4 5 ;; wlink hack. 6 CODE32 segment use32 PUBLIC 'CODE' 7 CODE32 ends 8 5 9 end -
branches/libc-0.6/src/emx/src/lib/libc.smak
r2814 r2815 82 82 .TKIND := omf 83 83 LIBC.STUB := $(wildcard $.omf/os2stub.bin) 84 ifeq ($(EMXOMFLD_TYPE),wlink) 85 LIBC.STUBARG := $(if $(LIBC.STUB),-Zlinker "OPTION STUB=$(LIBC.STUB)") 86 else 84 87 LIBC.STUBARG := $(if $(LIBC.STUB),-Zlinker -STUB:$(LIBC.STUB)) 88 endif 85 89 LIBC.DLL := $.omf/libc$(VH)$(VM)$(VL).dll 86 90 LIBC.IMPLIB := $.omf/libc_dll.lib $.aout/libc_dll.a
Note:
See TracChangeset
for help on using the changeset viewer.