changeset 555:646f1f0972b6

Update TCC_TARGET_* to TINYCC_TARGET_* (which is what new build sets).
author Rob Landley <rob@landley.net>
date Thu, 06 Mar 2008 21:19:16 -0600
parents 8c020de0af57
children d1fe34c5b92e
files i386/gen.c options.c tcc.c tcc.h tccelf.c tcctok.h
diffstat 6 files changed, 72 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/i386/gen.c	Thu Mar 06 20:53:55 2008 -0600
+++ b/i386/gen.c	Thu Mar 06 21:19:16 2008 -0600
@@ -526,7 +526,7 @@
     v = (-loc + 3) & -4; 
     saved_ind = ind;
     ind = func_sub_sp_offset - FUNC_PROLOG_SIZE;
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
     if (v >= 4096) {
         Sym *sym = external_global_sym(TOK___chkstk, &func_old_type, 0);
         oad(0xe8, -4); /* call __chkstk, (does the stackframe too) */
--- a/options.c	Thu Mar 06 20:53:55 2008 -0600
+++ b/options.c	Thu Mar 06 21:19:16 2008 -0600
@@ -462,7 +462,7 @@
                         } else if (!strcmp(p, "binary")) {
                             tccg_output_format = TCC_OUTPUT_FORMAT_BINARY;
                         } else
-#ifdef TCC_TARGET_COFF
+#ifdef TINYCC_TARGET_COFF
                         if (!strcmp(p, "coff")) {
                             tccg_output_format = TCC_OUTPUT_FORMAT_COFF;
                         } else
@@ -562,7 +562,7 @@
             pstrcpy(objfilename, sizeof(objfilename) - 1, 
                     /* strip path */
                     tcc_basename(files[0]));
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
             pe_guess_outfile(objfilename, tccg_output_type);
 #else
             if (tccg_output_type == TCC_OUTPUT_OBJ && !reloc_output) {
@@ -627,7 +627,7 @@
     } else if (tccg_output_type == TCC_OUTPUT_MEMORY) {
         ret = tcc_run(s, argc - optind, argv + optind);
     } else
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
     if (tccg_output_type != TCC_OUTPUT_OBJ) {
         ret = tcc_output_pe(s, outfile);
     } else
--- a/tcc.c	Thu Mar 06 20:53:55 2008 -0600
+++ b/tcc.c	Thu Mar 06 21:19:16 2008 -0600
@@ -27,15 +27,15 @@
 /* compile with built-in memory and bounds checker */
 static int do_bounds_check = 0;
 
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
 #include "i386/gen.c"
 #endif
 
-#ifdef TCC_TARGET_ARM
+#ifdef TINYCC_TARGET_ARM
 #include "arm/gen.c"
 #endif
 
-#ifdef TCC_TARGET_C67
+#ifdef TINYCC_TARGET_C67
 #include "c67-gen.c"
 #endif
 
@@ -3705,7 +3705,7 @@
                 sv.r = VT_LOCAL | VT_LVAL;
                 sv.c.ul = loc;
                 store(r, &sv);
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
                 /* x86 specific: need to pop fp register ST0 if saved */
                 if (r == TREG_ST0) {
                     o(0xd9dd); /* fstp %st(1) */
@@ -3888,7 +3888,7 @@
             Sym *sym;
             int *ptr;
             unsigned long offset;
-#if defined(TCC_TARGET_ARM) && !defined(TCC_ARM_VFP)
+#if defined(TINYCC_TARGET_ARM) && !defined(TCC_ARM_VFP)
             CValue check;
 #endif
             
@@ -3908,7 +3908,7 @@
 #endif
             ptr = section_ptr_add(data_section, size);
             size = size >> 2;
-#if defined(TCC_TARGET_ARM) && !defined(TCC_ARM_VFP)
+#if defined(TINYCC_TARGET_ARM) && !defined(TCC_ARM_VFP)
             check.d = 1;
             if(check.tab[0])
                 for(i=0;i<size;i++)
@@ -4004,7 +4004,7 @@
             }
         }
         vtop->r = r;
-#ifdef TCC_TARGET_C67
+#ifdef TINYCC_TARGET_C67
         /* uses register pairs for doubles */
         if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) 
             vtop->r2 = r+1;
@@ -4060,7 +4060,7 @@
     vtop[-1].type.t = VT_INT | u;
 }
 
-#ifdef TCC_TARGET_ARM
+#ifdef TINYCC_TARGET_ARM
 /* expand long long on stack */
 void lexpand_nr(void)
 {
@@ -4125,7 +4125,7 @@
     vtop[-n + 1] = tmp;
 }
 
-#ifdef TCC_TARGET_ARM
+#ifdef TINYCC_TARGET_ARM
 /* like vrott but in other direction
    In ... I1 -> I(n-1) ... I1 In  [top is right]
  */
@@ -4146,7 +4146,7 @@
 {
     int v;
     v = vtop->r & VT_VALMASK;
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
     /* for x86, we need to pop the FP stack */
     if (v == TREG_ST0) {
         o(0xd8dd); /* fstp %st(1) */
@@ -4398,12 +4398,12 @@
             if (a == 0) {
                 b = gtst(0, 0);
             } else {
-#if defined(TCC_TARGET_I386)
+#if defined(TINYCC_TARGET_I386)
                 b = psym(0x850f, 0);
-#elif defined(TCC_TARGET_ARM)
+#elif defined(TINYCC_TARGET_ARM)
                 b = ind;
                 o(0x1A000000 | encbranch(ind, 0, 1));
-#elif defined(TCC_TARGET_C67)
+#elif defined(TINYCC_TARGET_C67)
                 error("not implemented");
 #else
 #error not supported
@@ -4972,7 +4972,7 @@
                 }
             } else {
             do_itof:
-#if !defined(TCC_TARGET_ARM)
+#if !defined(TINYCC_TARGET_ARM)
                 gen_cvt_itof1(dbt);
 #else
                 gen_cvt_itof(dbt);
@@ -5101,9 +5101,9 @@
         *a = LDOUBLE_ALIGN;
         return LDOUBLE_SIZE;
     } else if (bt == VT_DOUBLE || bt == VT_LLONG) {
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
         *a = 4;
-#elif defined(TCC_TARGET_ARM)
+#elif defined(TINYCC_TARGET_ARM)
 #ifdef TCC_ARM_EABI
         *a = 8;
 #else
@@ -5593,7 +5593,7 @@
         case TOK_STDCALL3:
             ad->func_call = FUNC_STDCALL;
             break;
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
         case TOK_REGPARM1:
         case TOK_REGPARM2:
             skip('(');
@@ -6367,7 +6367,7 @@
         }
         break;
     case TOK_LSTR:
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
         t = VT_SHORT | VT_UNSIGNED;
 #else
         t = VT_INT;
@@ -7687,7 +7687,7 @@
         /* only parse strings here if correct type (otherwise: handle
            them as ((w)char *) expressions */
         if ((tok == TOK_LSTR && 
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
              (t1->t & VT_BTYPE) == VT_SHORT && (t1->t & VT_UNSIGNED)) ||
 #else
              (t1->t & VT_BTYPE) == VT_INT) ||
@@ -8352,7 +8352,7 @@
                         cur_text_section = text_section;
                     sym->r = VT_SYM | VT_CONST;
                     gen_function(sym);
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
                     if (ad.dllexport) {
                         ((Elf32_Sym *)symtab_section->data)[sym->c].st_other |= 1;
                     }
@@ -8637,7 +8637,7 @@
 
 #ifdef CONFIG_TCC_ASM
 
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
 #include "i386/asm.c"
 #endif
 #include "tccasm.c"
@@ -8655,11 +8655,11 @@
 
 #include "tccelf.c"
 
-#ifdef TCC_TARGET_COFF
+#ifdef TINYCC_TARGET_COFF
 #include "tcccoff.c"
 #endif
 
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
 #include "win32/tccpe.c"
 #endif
 
@@ -8671,7 +8671,7 @@
 
     s1->nb_errors = 0;
     
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
     pe_add_runtime(s1);
 #else
     tcc_add_runtime(s1);
@@ -8820,10 +8820,10 @@
     /* standard defines */
     tcc_define_symbol(s, "__STDC__", NULL);
     tcc_define_symbol(s, "__STDC_VERSION__", "199901L");
-#if defined(TCC_TARGET_I386)
+#if defined(TINYCC_TARGET_I386)
     tcc_define_symbol(s, "__i386__", NULL);
 #endif
-#if defined(TCC_TARGET_ARM)
+#if defined(TINYCC_TARGET_ARM)
     tcc_define_symbol(s, "__ARM_ARCH_4__", NULL);
     tcc_define_symbol(s, "__arm_elf__", NULL);
     tcc_define_symbol(s, "__arm_elf", NULL);
@@ -8846,7 +8846,7 @@
     tcc_define_symbol(s, "__PTRDIFF_TYPE__", "int");
 
     /* wchar type and default library paths */
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
     tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short");
 #else
     tcc_define_symbol(s, "__WCHAR_TYPE__", "int");
@@ -8875,7 +8875,7 @@
 #ifdef CHAR_IS_UNSIGNED
     tccg_char_is_unsigned = 1;
 #endif
-#if defined(TCC_TARGET_PE) && 0
+#if defined(TINYCC_TARGET_PE) && 0
     /* XXX: currently the PE linker is not ready to support that */
     tccg_leading_underscore = 1;
 #endif
@@ -8977,7 +8977,7 @@
         ret = tcc_assemble(s1, 0);
     } else 
 #endif
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
     if (!strcmp(ext, "def")) {
         ret = pe_load_def_file(s1, fdopen(file->fd, "rb"));
     } else
@@ -9003,7 +9003,7 @@
                 ret = tcc_load_object_file(s1, fd, 0);
             } else if (ehdr.e_type == ET_DYN) {
                 if (tccg_output_type == TCC_OUTPUT_MEMORY) {
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
                     ret = -1;
 #else
                     void *h;
@@ -9025,7 +9025,7 @@
             file->line_num = 0; /* do not display line number if error */
             ret = tcc_load_archive(s1, fd);
         } else 
-#ifdef TCC_TARGET_COFF
+#ifdef TINYCC_TARGET_COFF
         if (*(uint16_t *)(&ehdr) == COFF_C67_MAGIC) {
             ret = tcc_load_coff(s1, fd);
         } else
@@ -9079,7 +9079,7 @@
     
     /* first we look for the dynamic library if not static linking */
     if (!tccg_static_link) {
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
         snprintf(buf, sizeof(buf), "%s.def", libraryname);
 #else
         snprintf(buf, sizeof(buf), "lib%s.so", libraryname);
@@ -9156,7 +9156,7 @@
     }
 
     /* add libc crt1/crti objects */
-#ifndef TCC_TARGET_PE
+#ifndef TINYCC_TARGET_PE
     if ((tccg_output_type == TCC_OUTPUT_EXE || tccg_output_type == TCC_OUTPUT_DLL)
         && !tccg_nostdlib)
     {
--- a/tcc.h	Thu Mar 06 20:53:55 2008 -0600
+++ b/tcc.h	Thu Mar 06 21:19:16 2008 -0600
@@ -59,33 +59,33 @@
 //#define ASM_DEBUG
 
 /* target selection */
-//#define TCC_TARGET_I386   /* i386 code generator */
-//#define TCC_TARGET_ARM    /* ARMv4 code generator */
-//#define TCC_TARGET_C67    /* TMS320C67xx code generator */
+//#define TINYCC_TARGET_I386   /* i386 code generator */
+//#define TINYCC_TARGET_ARM    /* ARMv4 code generator */
+//#define TINYCC_TARGET_C67    /* TMS320C67xx code generator */
 
 /* default target is I386 */
-#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) && \
-    !defined(TCC_TARGET_C67)
-#define TCC_TARGET_I386
-#endif
+//#if !defined(TINYCC_TARGET_I386) && !defined(TINYCC_TARGET_ARM) && \
+//    !defined(TINYCC_TARGET_C67)
+//#define TINYCC_TARGET_I386
+//#endif
 
-#if !defined(WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \
-    !defined(TCC_TARGET_C67)
+#if !defined(WIN32) && !defined(TCC_UCLIBC) && !defined(TINYCC_TARGET_ARM) && \
+    !defined(TINYCC_TARGET_C67)
 #define CONFIG_TCC_BCHECK /* enable bound checking code */
 #endif
 
-#if defined(WIN32) && !defined(TCC_TARGET_PE)
+#if defined(WIN32) && !defined(TINYCC_TARGET_PE)
 #define CONFIG_TCC_STATIC
 #endif
 
 /* define it to include assembler support */
-#if !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_C67)
+#if !defined(TINYCC_TARGET_ARM) && !defined(TINYCC_TARGET_C67)
 #define CONFIG_TCC_ASM
 #endif
 
 /* object format selection */
-#if defined(TCC_TARGET_C67)
-#define TCC_TARGET_COFF
+#if defined(TINYCC_TARGET_C67)
+#define TINYCC_TARGET_COFF
 #endif
 
 #define FALSE 0
@@ -116,7 +116,7 @@
     char str[1];
 } TokenSym;
 
-#ifdef TCC_TARGET_PE
+#ifdef TINYCC_TARGET_PE
 typedef unsigned short nwchar_t;
 #define LIB_PATH_SEPCHAR ';'
 #else
--- a/tccelf.c	Thu Mar 06 20:53:55 2008 -0600
+++ b/tccelf.c	Thu Mar 06 21:19:16 2008 -0600
@@ -454,7 +454,7 @@
     int type, sym_index;
     unsigned char *ptr;
     unsigned long val, addr;
-#if defined(TCC_TARGET_I386)
+#if defined(TINYCC_TARGET_I386)
     int esym_index;
 #endif
 
@@ -474,7 +474,7 @@
 
         /* CPU specific */
         switch(type) {
-#if defined(TCC_TARGET_I386)
+#if defined(TINYCC_TARGET_I386)
         case R_386_32:
             if (tccg_output_type == TCC_OUTPUT_DLL) {
                 esym_index = s1->symtab_to_dynsym[sym_index];
@@ -520,7 +520,7 @@
             /* we load the got offset */
             *(int *)ptr += s1->got_offsets[sym_index];
             break;
-#elif defined(TCC_TARGET_ARM)
+#elif defined(TINYCC_TARGET_ARM)
 	case R_ARM_PC24:
 	case R_ARM_CALL:
 	case R_ARM_JUMP24:
@@ -570,7 +570,7 @@
 	    fprintf(stderr,"FIXME: handle reloc type %x at %lx [%.8x] to %lx\n",
                     type,addr,(unsigned int )ptr,val);
             break;
-#elif defined(TCC_TARGET_C67)
+#elif defined(TINYCC_TARGET_C67)
 	case R_C60_32:
 	    *(int *)ptr += val;
 	    break;
@@ -682,7 +682,7 @@
     p[3] = val >> 24;
 }
 
-#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_ARM)
+#if defined(TINYCC_TARGET_I386) || defined(TINYCC_TARGET_ARM)
 static uint32_t get32(unsigned char *p)
 {
     return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
@@ -732,7 +732,7 @@
         sym = &((Elf32_Sym *)symtab_section->data)[sym_index];
         name = symtab_section->link->data + sym->st_name;
         offset = sym->st_value;
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
         if (reloc_type == R_386_JMP_SLOT) {
             Section *plt;
             uint8_t *p;
@@ -771,7 +771,7 @@
             if (tccg_output_type == TCC_OUTPUT_EXE)
                 offset = plt->data_offset - 16;
         }
-#elif defined(TCC_TARGET_ARM)
+#elif defined(TINYCC_TARGET_ARM)
 	if (reloc_type == R_ARM_JUMP_SLOT) {
             Section *plt;
             uint8_t *p;
@@ -802,7 +802,7 @@
             if (tccg_output_type == TCC_OUTPUT_EXE)
                 offset = plt->data_offset - 16;
         }
-#elif defined(TCC_TARGET_C67)
+#elif defined(TINYCC_TARGET_C67)
         error("C67 got not implemented");
 #else
 #error unsupported CPU
@@ -840,7 +840,7 @@
             rel++) {
             type = ELF32_R_TYPE(rel->r_info);
             switch(type) {
-#if defined(TCC_TARGET_I386)
+#if defined(TINYCC_TARGET_I386)
             case R_386_GOT32:
             case R_386_GOTOFF:
             case R_386_GOTPC:
@@ -859,7 +859,7 @@
                                   sym_index);
                 }
                 break;
-#elif defined(TCC_TARGET_ARM)
+#elif defined(TINYCC_TARGET_ARM)
 	    case R_ARM_GOT_BREL:
             case R_ARM_GOTOFF32:
             case R_ARM_BASE_PREL:
@@ -878,7 +878,7 @@
                                   sym_index);
                 }
                 break;
-#elif defined(TCC_TARGET_C67)
+#elif defined(TINYCC_TARGET_C67)
 	    case R_C60_GOT32:
             case R_C60_GOTOFF:
             case R_C60_GOTPC:
@@ -994,7 +994,7 @@
         /* add bound check code */
         snprintf(buf, sizeof(buf), "%s/bcheck.o", tinycc_path);
         tcc_add_file(s1, buf);
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
         if (tccg_output_type != TCC_OUTPUT_MEMORY) {
             /* add 'call __bound_init()' in .init section */
             init_section = find_section(s1, ".init");
@@ -1523,7 +1523,7 @@
                 p = s1->plt->data;
                 p_end = p + s1->plt->data_offset;
                 if (p < p_end) {
-#if defined(TCC_TARGET_I386)
+#if defined(TINYCC_TARGET_I386)
                     put32(p + 2, get32(p + 2) + s1->got->sh_addr);
                     put32(p + 8, get32(p + 8) + s1->got->sh_addr);
                     p += 16;
@@ -1531,7 +1531,7 @@
                         put32(p + 2, get32(p + 2) + s1->got->sh_addr);
                         p += 16;
                     }
-#elif defined(TCC_TARGET_ARM)
+#elif defined(TINYCC_TARGET_ARM)
 		    int x;
 		    x=s1->got->sh_addr - s1->plt->sh_addr - 12;
 		    p +=16;
@@ -1539,7 +1539,7 @@
 		        put32(p + 12, x + get32(p + 12) + s1->plt->data - p);
 			p += 16;
 		    }
-#elif defined(TCC_TARGET_C67)
+#elif defined(TINYCC_TARGET_C67)
                     /* XXX: TODO */
 #else
 #error unsupported CPU
@@ -1643,7 +1643,7 @@
     }
     f = fdopen(fd, "wb");
 
-#ifdef TCC_TARGET_COFF
+#ifdef TINYCC_TARGET_COFF
     if (tccg_output_format == TCC_OUTPUT_FORMAT_COFF) {
         tcc_output_coff(s1, f);
     } else
@@ -1665,7 +1665,7 @@
 #ifdef __FreeBSD__
         ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
 #endif
-#ifdef TCC_TARGET_ARM
+#ifdef TINYCC_TARGET_ARM
 #ifdef TCC_ARM_EABI
 	ehdr.e_ident[EI_OSABI] = 0;
 	ehdr.e_flags = 4 << 24;
--- a/tcctok.h	Thu Mar 06 20:53:55 2008 -0600
+++ b/tcctok.h	Thu Mar 06 21:19:16 2008 -0600
@@ -114,7 +114,7 @@
 
 /* pragma */
      DEF(TOK_pack, "pack")
-#if !defined(TCC_TARGET_I386)
+#if !defined(TINYCC_TARGET_I386)
      /* already defined for assembler */
      DEF(TOK_ASM_push, "push")
      DEF(TOK_ASM_pop, "pop")
@@ -135,7 +135,7 @@
      DEF(TOK___moddi3, "__moddi3")
      DEF(TOK___udivdi3, "__udivdi3")
      DEF(TOK___umoddi3, "__umoddi3")
-#if defined(TCC_TARGET_ARM)
+#if defined(TINYCC_TARGET_ARM)
      DEF(TOK___modsi3, "__modsi3")
      DEF(TOK___umodsi3, "__umodsi3")
 #ifdef TCC_ARM_EABI
@@ -163,7 +163,7 @@
      DEF(TOK___fixdfdi, "__fixdfdi")
      DEF(TOK___fixxfdi, "__fixxfdi")
 #endif
-#elif defined(TCC_TARGET_C67)
+#elif defined(TINYCC_TARGET_C67)
      DEF(TOK__divi, "_divi")
      DEF(TOK__divu, "_divu")
      DEF(TOK__divf, "_divf")
@@ -238,7 +238,7 @@
  DEF_ASM(org)
  DEF_ASM(quad)
 
-#ifdef TCC_TARGET_I386
+#ifdef TINYCC_TARGET_I386
 
 /* WARNING: relative order of tokens is important. */
  DEF_ASM(al)