added -f[no-]leading-underscore

tcc-xref
bellard 2005-06-15 22:32:10 +00:00
parent fe9b1f60ce
commit 0c7f0ed312
4 changed files with 13 additions and 27 deletions

View File

@ -4,6 +4,7 @@ version 0.9.23:
- '#pragma pack' support (grischka)
- '#include_next' support (Bernhard Fischer)
- ignore '-pipe' option
- added -f[no-]leading-underscore
version 0.9.22:

View File

@ -298,7 +298,7 @@ static void asm_free_labels(TCCState *st)
sec = SECTION_ABS;
else
sec = st->sections[s->r];
put_extern_sym(s, sec, (long)s->next, 0);
put_extern_sym2(s, sec, (long)s->next, 0, 0);
}
/* remove label */
table_ident[s->v - TOK_IDENT]->sym_label = NULL;

View File

@ -507,8 +507,7 @@ int tcc_output_coff(TCCState *s1, FILE *f)
AUXEF auxef;
int i;
Elf32_Sym *p;
char *name;
char _name[MAX_FUNCS];
const char *name;
int nstr;
int n = 0;
@ -521,26 +520,15 @@ int tcc_output_coff(TCCState *s1, FILE *f)
for (i = 0; i < nb_syms; i++) {
/* don't add underscores for Code Composer Version 2.xx */
#define ADD_UNDERSCORE 0
name = (char *) symtab_section->link->data + p->st_name;
#if ADD_UNDERSCORE
_name[0] = '_';
strcpy(_name + 1, name);
#else
strcpy(_name, name);
#endif
name = symtab_section->link->data + p->st_name;
for (k = 0; k < 8; k++)
csym._n._n_name[k] = 0;
if (strlen(_name) <= 8) {
strcpy(csym._n._n_name, _name);
if (strlen(name) <= 8) {
strcpy(csym._n._n_name, name);
} else {
if (pCoff_str_table - Coff_str_table + strlen(_name) >
if (pCoff_str_table - Coff_str_table + strlen(name) >
MAX_STR_TABLE - 1)
error("String table too large");
@ -548,8 +536,8 @@ int tcc_output_coff(TCCState *s1, FILE *f)
csym._n._n_n._n_offset =
pCoff_str_table - Coff_str_table + 4;
strcpy(pCoff_str_table, _name);
pCoff_str_table += strlen(_name) + 1; // skip over null
strcpy(pCoff_str_table, name);
pCoff_str_table += strlen(name) + 1; // skip over null
nstr++;
}

11
tccpe.c
View File

@ -383,13 +383,10 @@ ST char pe_type;
ST int pe_find_import(TCCState * s1, const char *symbol, char *ret)
{
int sym_index = find_elf_sym(s1->dynsymtab_section, symbol);
if (0 == sym_index) {
/* Hm, maybe it's '_symbol' instead of 'symbol' or '__imp__symbol' */
char buffer[100];
if (0 == memcmp(symbol, "__imp__", 7))
symbol += 6;
else
buffer[0] = '_', strcpy(buffer + 1, symbol), symbol = buffer;
if (0 == sym_index &&
!memcmp(symbol, "__imp__", 7)) {
/* Hm, maybe it's '_symbol' instead of '__imp__symbol' */
symbol += 6;
sym_index = find_elf_sym(s1->dynsymtab_section, symbol);
}
if (ret)