changeset 373:64bb1c7ea969

[project @ 2005-06-15 22:32:10 by bellard] added -f[no-]leading-underscore
author bellard
date Wed, 15 Jun 2005 22:32:10 +0000
parents a8da3b580b5e
children 685cc79d02d6
files Changelog tccasm.c tcccoff.c tccpe.c
diffstat 4 files changed, 13 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/Changelog	Sun Apr 17 13:15:54 2005 +0000
+++ b/Changelog	Wed Jun 15 22:32:10 2005 +0000
@@ -4,6 +4,7 @@
 - '#pragma pack' support (grischka)
 - '#include_next' support (Bernhard Fischer)
 - ignore '-pipe' option
+- added -f[no-]leading-underscore
 
 version 0.9.22:
 
--- a/tccasm.c	Sun Apr 17 13:15:54 2005 +0000
+++ b/tccasm.c	Wed Jun 15 22:32:10 2005 +0000
@@ -298,7 +298,7 @@
                 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;
--- a/tcccoff.c	Sun Apr 17 13:15:54 2005 +0000
+++ b/tcccoff.c	Wed Jun 15 22:32:10 2005 +0000
@@ -507,8 +507,7 @@
 	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 @@
 
 	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 @@
 		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++;
 	    }
 
--- a/tccpe.c	Sun Apr 17 13:15:54 2005 +0000
+++ b/tccpe.c	Wed Jun 15 22:32:10 2005 +0000
@@ -383,13 +383,10 @@
 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)