Changeset 475
- Timestamp:
- Jul 29, 2003, 9:42:44 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/emxomf.c
-
Property cvs2svn:cvs-rev
changed from
1.15
to1.16
r474 r475 290 290 static int weak_list_altered; 291 291 292 /* The file name of the weak symbol list file */ 292 /* The file name of the weak symbol list file. 293 If NULL the new method is used, if not NULL the old method is used. */ 293 294 static char *weak_list_filename; 294 295 … … 621 622 return; 622 623 623 /* Find and open the weak symbol list file */ 624 /* Find and open the weak symbol list file 625 #483: If not present we'll use the new method. */ 624 626 weak_list_filename = getenv ("GCC_WEAKSYMS"); 625 627 if (!weak_list_filename) 626 weak_list_filename = "weaksyms.omf";628 return ; 627 629 wf = fopen (weak_list_filename, "r"); 628 630 if (!wf) … … 751 753 { 752 754 struct lname *p; 755 756 /** @todo: change this to use a stringpool for speed reasons! */ 753 757 754 758 /* Walk through the list of known OMF-style names. If there is a … … 1185 1189 1186 1190 1191 /** 1192 * Generates new names for weak symbols. 1193 * 1194 * These names will be catch bye emxomfld and an alias from the generated to 1195 * the real name will be generated and put in a library before linking. 1196 * 1197 * @returns Pointer to pszOrgName or pszName. 1198 * @param pSym Pointer to the symbol in question. 1199 * @param pszOrgName Pointer to the symbols actual name. 1200 * @param pachName Pointer to a character buffer of size cchName where the 1201 * new name will be written. 1202 * @param cchName Size of the buffer pointed to by pachName. 1203 * @remark I'm sorry this function is written in my coding style - not! 1204 */ 1205 static char *weak_process_name(struct nlist *pSym, char *pszOrgName, char *pachName, int cchName)); 1206 { 1207 for (i = 0; i < sym_count; ++i) 1208 { 1209 1210 switch (sym_ptr->n_type) 1211 { 1212 /* 1213 * Hmmm... Check that we handle this correctly else where 1214 */ 1215 case N_WEAKU: /* 0x0d Weak undefined symbol. */ 1216 break; 1217 1218 /* 1219 * I'm uncertain what this means, needs to google 1220 * for and explanation of how this is used. 1221 */ 1222 case N_WEAKA: /* 0x0e Weak absolute symbol. */ 1223 break; 1224 1225 /* 1226 * These symbols are defined in this module, so we need to 1227 * make a unique and recognizable name for them. 1228 */ 1229 case N_WEAKT: /* 0x0f Weak text symbol. */ 1230 case N_WEAKD: /* 0x10 Weak data symbol. */ 1231 case N_WEAKB: /* 0x11 Weak bss symbol. */ 1232 { 1233 int cch = strlen(pszOrgName); 1234 memcpy(pachName, pszOrgName, cch); 1235 1236 break; 1237 } 1238 } 1239 } 1240 } 1241 1242 1243 1187 1244 /* Write ALIAS records into the output file for all indirect 1188 1245 references. */ … … 1239 1296 const char *name, *pub_name; 1240 1297 dword address; 1298 char szName[260]; 1241 1299 1242 1300 started = FALSE; … … 1248 1306 { 1249 1307 name = str_ptr + sym_ptr[i].n_un.n_strx; 1250 if ((sym_ptr[i].n_type & N_EXT) 1251 || (type == N_TEXT && strncmp (name, "___POST$", 8) == 0)) 1308 if ( (sym_ptr[i].n_type & N_EXT) 1309 || (type == N_TEXT && strncmp (name, "___POST$", 8) == 0) 1310 || (sym_ptr[i].n_type >= N_WEAKU && sym_ptr[i].n_type <= N_WEAKB) 1311 ) 1252 1312 { 1253 1313 if ((sym_ptr[i].n_type & N_EXT) && out_lib != NULL) … … 1260 1320 error (lib_errmsg); 1261 1321 } 1322 1323 /* for weaksymbols we may have to decorate the name */ 1324 if ( !weak_list_filename 1325 && sym_ptr[i].n_type >= N_WEAKU 1326 && sym_ptr[i].n_type <= N_WEAKB 1327 ) 1328 name = weak_process_name(sym_ptr[i], name, szName, sizeof(szName)); 1329 1262 1330 if (started && !fits (strlen (name) + 6)) 1263 1331 { … … 1333 1401 write_pubdef1 (N_TEXT, text_index, FALSE, 0); 1334 1402 write_pubdef1 (N_TEXT, text_index, TRUE, 0); 1403 if (!write_pubdef_main) 1404 { 1405 write_pubdef1 (N_WEAKT, text_index, FALSE, 0); 1406 write_pubdef1 (N_WEAKT, text_index, TRUE, 0); 1407 } 1335 1408 /* kso #456 2003-06-10: The debugger looks for 'main' not '_main'. */ 1336 1409 write_pubdef_main (); 1337 1410 write_pubdef1 (N_DATA, udat_index, FALSE, text_size); 1338 1411 write_pubdef1 (N_DATA, udat_index, TRUE, text_size); 1412 if (!write_pubdef_main) 1413 { 1414 write_pubdef1 (N_WEAKD, text_index, FALSE, 0); 1415 write_pubdef1 (N_WEAKD, text_index, TRUE, 0); 1416 } 1339 1417 write_pubdef1 (N_BSS, bss_index, FALSE, text_size + data_size); 1340 1418 write_pubdef1 (N_BSS, bss_index, TRUE, text_size + data_size); 1419 if (!write_pubdef_main) 1420 { 1421 write_pubdef1 (N_WEAKB, bss_index, FALSE, text_size + data_size); 1422 write_pubdef1 (N_WEAKB, bss_index, TRUE, text_size + data_size); 1423 } 1341 1424 } 1342 1425 … … 3218 3301 write_libs (); 3219 3302 write_debug_style (); 3303 3304 /* Method 2 Weak symbol processing (generate names). */ 3305 3306 weak_process_names(); 3220 3307 3221 3308 /* Define all the OMF names (LNAMES record). Of course, we must not -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.