Unified · Split
| @@ -4,6 +4,7 @@ version 0.9.23: · 3 unmodified lines | |||
| 4 | - '#pragma pack' support (grischka) | 4 | - '#pragma pack' support (grischka) |
| 5 | - '#include_next' support (Bernhard Fischer) | 5 | - '#include_next' support (Bernhard Fischer) |
| 6 | - ignore '-pipe' option | 6 | - ignore '-pipe' option |
| 7 | - added -f[no-]leading-underscore | ||
| 7 | 8 | ||
| 8 | version 0.9.22: | 9 | version 0.9.22: |
| 9 | 10 | ||
| @@ -298,7 +298,7 @@ static void asm_free_labels(TCCState *st) · 297 unmodified lines | |||
| 298 | sec = SECTION_ABS; | 298 | sec = SECTION_ABS; |
| 299 | else | 299 | else |
| 300 | sec = st->sections[s->r]; | 300 | sec = st->sections[s->r]; |
| 301 | put_extern_sym(s, sec, (long)s->next, 0); | 301 | put_extern_sym2(s, sec, (long)s->next, 0, 0); |
| 302 | } | 302 | } |
| 303 | /* remove label */ | 303 | /* remove label */ |
| 304 | table_ident[s->v - TOK_IDENT]->sym_label = NULL; | 304 | table_ident[s->v - TOK_IDENT]->sym_label = NULL; |
| @@ -507,8 +507,7 @@ int tcc_output_coff(TCCState *s1, FILE *f) · 506 unmodified lines | |||
| 507 | AUXEF auxef; | 507 | AUXEF auxef; |
| 508 | int i; | 508 | int i; |
| 509 | Elf32_Sym *p; | 509 | Elf32_Sym *p; |
| 510 | char *name; | 510 | const char *name; |
| 511 | char _name[MAX_FUNCS]; | ||
| 512 | int nstr; | 511 | int nstr; |
| 513 | int n = 0; | 512 | int n = 0; |
| 514 | 513 | ||
| @@ -521,26 +520,15 @@ int tcc_output_coff(TCCState *s1, FILE *f) · 6 unmodified lines | |||
| 521 | 520 | ||
| 522 | for (i = 0; i < nb_syms; i++) { | 521 | for (i = 0; i < nb_syms; i++) { |
| 523 | 522 | ||
| 524 | /* don't add underscores for Code Composer Version 2.xx */ | 523 | name = symtab_section->link->data + p->st_name; |
| 525 | |||
| 526 | #define ADD_UNDERSCORE 0 | ||
| 527 | |||
| 528 | name = (char *) symtab_section->link->data + p->st_name; | ||
| 529 | |||
| 530 | #if ADD_UNDERSCORE | ||
| 531 | _name[0] = '_'; | ||
| 532 | strcpy(_name + 1, name); | ||
| 533 | #else | ||
| 534 | strcpy(_name, name); | ||
| 535 | #endif | ||
| 536 | 524 | ||
| 537 | for (k = 0; k < 8; k++) | 525 | for (k = 0; k < 8; k++) |
| 538 | csym._n._n_name[k] = 0; | 526 | csym._n._n_name[k] = 0; |
| 539 | 527 | ||
| 540 | if (strlen(_name) <= 8) { | 528 | if (strlen(name) <= 8) { |
| 541 | strcpy(csym._n._n_name, _name); | 529 | strcpy(csym._n._n_name, name); |
| 542 | } else { | 530 | } else { |
| 543 | if (pCoff_str_table - Coff_str_table + strlen(_name) > | 531 | if (pCoff_str_table - Coff_str_table + strlen(name) > |
| 544 | MAX_STR_TABLE - 1) | 532 | MAX_STR_TABLE - 1) |
| 545 | error("String table too large"); | 533 | error("String table too large"); |
| 546 | 534 | ||
| @@ -548,8 +536,8 @@ int tcc_output_coff(TCCState *s1, FILE *f) · 1 unmodified line | |||
| 548 | csym._n._n_n._n_offset = | 536 | csym._n._n_n._n_offset = |
| 549 | pCoff_str_table - Coff_str_table + 4; | 537 | pCoff_str_table - Coff_str_table + 4; |
| 550 | 538 | ||
| 551 | strcpy(pCoff_str_table, _name); | 539 | strcpy(pCoff_str_table, name); |
| 552 | pCoff_str_table += strlen(_name) + 1; // skip over null | 540 | pCoff_str_table += strlen(name) + 1; // skip over null |
| 553 | nstr++; | 541 | nstr++; |
| 554 | } | 542 | } |
| 555 | 543 | ||
| @@ -383,13 +383,10 @@ ST char pe_type; · 382 unmodified lines | |||
| 383 | ST int pe_find_import(TCCState * s1, const char *symbol, char *ret) | 383 | ST int pe_find_import(TCCState * s1, const char *symbol, char *ret) |
| 384 | { | 384 | { |
| 385 | int sym_index = find_elf_sym(s1->dynsymtab_section, symbol); | 385 | int sym_index = find_elf_sym(s1->dynsymtab_section, symbol); |
| 386 | if (0 == sym_index) { | 386 | if (0 == sym_index && |
| 387 | /* Hm, maybe it's '_symbol' instead of 'symbol' or '__imp__symbol' */ | 387 | !memcmp(symbol, "__imp__", 7)) { |
| 388 | char buffer[100]; | 388 | /* Hm, maybe it's '_symbol' instead of '__imp__symbol' */ |
| 389 | if (0 == memcmp(symbol, "__imp__", 7)) | 389 | symbol += 6; |
| 390 | symbol += 6; | ||
| 391 | else | ||
| 392 | buffer[0] = '_', strcpy(buffer + 1, symbol), symbol = buffer; | ||
| 393 | sym_index = find_elf_sym(s1->dynsymtab_section, symbol); | 390 | sym_index = find_elf_sym(s1->dynsymtab_section, symbol); |
| 394 | } | 391 | } |
| 395 | if (ret) | 392 | if (ret) |