History

added -f[no-]leading-underscore

bellard committed 21 years ago

Commit 0c7f0ed1 parent fe9b1f64 files · +13 −27Browse files

Unified · Split

4 files
  1. Changelog +1 −0
  2. tccasm.c +1 −1
  3. tcccoff.c +7 −19
  4. tccpe.c +4 −7
Changelog+1−0
@@ -4,6 +4,7 @@ version 0.9.23: · 3 unmodified lines
44 - '#pragma pack' support (grischka)
55 - '#include_next' support (Bernhard Fischer)
66 - ignore '-pipe' option
7+- added -f[no-]leading-underscore
78
89 version 0.9.22:
910
tccasm.c+1−1
@@ -298,7 +298,7 @@ static void asm_free_labels(TCCState *st) · 297 unmodified lines
298298 sec = SECTION_ABS;
299299 else
300300 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);
302302 }
303303 /* remove label */
304304 table_ident[s->v - TOK_IDENT]->sym_label = NULL;
tcccoff.c+7−19
@@ -507,8 +507,7 @@ int tcc_output_coff(TCCState *s1, FILE *f) · 506 unmodified lines
507507 AUXEF auxef;
508508 int i;
509509 Elf32_Sym *p;
510− char *name;
511− char _name[MAX_FUNCS];
510+ const char *name;
512511 int nstr;
513512 int n = 0;
514513
@@ -521,26 +520,15 @@ int tcc_output_coff(TCCState *s1, FILE *f) · 6 unmodified lines
521520
522521 for (i = 0; i < nb_syms; i++) {
523522
524− /* don't add underscores for Code Composer Version 2.xx */
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
523+ name = symtab_section->link->data + p->st_name;
536524
537525 for (k = 0; k < 8; k++)
538526 csym._n._n_name[k] = 0;
539527
540− if (strlen(_name) <= 8) {
541− strcpy(csym._n._n_name, _name);
528+ if (strlen(name) <= 8) {
529+ strcpy(csym._n._n_name, name);
542530 } else {
543− if (pCoff_str_table - Coff_str_table + strlen(_name) >
531+ if (pCoff_str_table - Coff_str_table + strlen(name) >
544532 MAX_STR_TABLE - 1)
545533 error("String table too large");
546534
@@ -548,8 +536,8 @@ int tcc_output_coff(TCCState *s1, FILE *f) · 1 unmodified line
548536 csym._n._n_n._n_offset =
549537 pCoff_str_table - Coff_str_table + 4;
550538
551− strcpy(pCoff_str_table, _name);
552− pCoff_str_table += strlen(_name) + 1; // skip over null
539+ strcpy(pCoff_str_table, name);
540+ pCoff_str_table += strlen(name) + 1; // skip over null
553541 nstr++;
554542 }
555543
tccpe.c+4−7
@@ -383,13 +383,10 @@ ST char pe_type; · 382 unmodified lines
383383 ST int pe_find_import(TCCState * s1, const char *symbol, char *ret)
384384 {
385385 int sym_index = find_elf_sym(s1->dynsymtab_section, symbol);
386− if (0 == sym_index) {
387− /* Hm, maybe it's '_symbol' instead of 'symbol' or '__imp__symbol' */
388− char buffer[100];
389− if (0 == memcmp(symbol, "__imp__", 7))
390− symbol += 6;
391− else
392− buffer[0] = '_', strcpy(buffer + 1, symbol), symbol = buffer;
386+ if (0 == sym_index &&
387+ !memcmp(symbol, "__imp__", 7)) {
388+ /* Hm, maybe it's '_symbol' instead of '__imp__symbol' */
389+ symbol += 6;
393390 sym_index = find_elf_sym(s1->dynsymtab_section, symbol);
394391 }
395392 if (ret)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t