Unified · Split
| @@ -2,9 +2,10 @@ version 0.9.21: · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | - ARM target support (Daniel Glöckner) |
| 4 | 4 | - added '-funsigned-char, '-fsigned-char' and |
| 5 | − '-Wimplicit-function-declaration'. | |
| 6 | −- fixed assignment of const struct in struct. | |
| 5 | + '-Wimplicit-function-declaration' | |
| 6 | +- fixed assignment of const struct in struct | |
| 7 | 7 | - line comment fix (reported by Bertram Felgenhauer) |
| 8 | +- initial TMS320C67xx support (TK) | |
| 8 | 9 | |
| 9 | 10 | version 0.9.20: |
| 10 | 11 | |
| @@ -114,6 +114,9 @@ tcc_g: tcc.c i386-gen.c tccelf.c tccasm.c i386-asm.c tcctok.h libtcc.h i386-asm. · 113 unmodified lines | ||
| 114 | 114 | tcc: tcc_g Makefile |
| 115 | 115 | strip -s -R .comment -R .note -o $@ $< |
| 116 | 116 | |
| 117 | +c67-tcc: tcc.c c67-gen.c tccelf.c tccasm.c tcctok.h libtcc.h Makefile | |
| 118 | + $(CC) $(CFLAGS) -DTCC_TARGET_C67 -o $@ $< $(LIBS) | |
| 119 | + | |
| 117 | 120 | # TinyCC runtime libraries |
| 118 | 121 | libtcc1.o: libtcc1.c |
| 119 | 122 | $(CC) -O2 -Wall -c -o $@ $< |
| @@ -710,6 +710,7 @@ void gfunc_prolog(CType *func_type) · 709 unmodified lines | ||
| 710 | 710 | addr += size; |
| 711 | 711 | } |
| 712 | 712 | last_itod_magic=0; |
| 713 | + loc = 0; | |
| 713 | 714 | } |
| 714 | 715 | |
| 715 | 716 | /* generate function epilog */ |
| @@ -217,6 +217,7 @@ typedef struct · 216 unmodified lines | ||
| 217 | 217 | chances of collision with official or non-GNU unofficial values. */ |
| 218 | 218 | |
| 219 | 219 | #define EM_ALPHA 0x9026 |
| 220 | +#define EM_C60 0x9c60 | |
| 220 | 221 | |
| 221 | 222 | /* Legal values for e_version (version). */ |
| 222 | 223 | |
| @@ -1592,4 +1593,21 @@ typedef Elf32_Addr Elf32_Conflict; · 1369 unmodified lines | ||
| 1592 | 1593 | /* Keep this the last entry. */ |
| 1593 | 1594 | #define R_ARM_NUM 256 |
| 1594 | 1595 | |
| 1596 | +/* TMS320C67xx specific declarations */ | |
| 1597 | +/* XXX: no ELF standard yet */ | |
| 1598 | + | |
| 1599 | +/* TMS320C67xx relocs. */ | |
| 1600 | +#define R_C60_32 1 | |
| 1601 | +#define R_C60_GOT32 3 /* 32 bit GOT entry */ | |
| 1602 | +#define R_C60_PLT32 4 /* 32 bit PLT address */ | |
| 1603 | +#define R_C60_COPY 5 /* Copy symbol at runtime */ | |
| 1604 | +#define R_C60_GLOB_DAT 6 /* Create GOT entry */ | |
| 1605 | +#define R_C60_JMP_SLOT 7 /* Create PLT entry */ | |
| 1606 | +#define R_C60_RELATIVE 8 /* Adjust by program base */ | |
| 1607 | +#define R_C60_GOTOFF 9 /* 32 bit offset to GOT */ | |
| 1608 | +#define R_C60_GOTPC 10 /* 32 bit PC relative offset to GOT */ | |
| 1609 | + | |
| 1610 | +#define R_C60HI16 0x55 // high 16 bit MVKH embedded | |
| 1611 | +#define R_C60LO16 0x54 // low 16 bit MVKL embedded | |
| 1612 | + | |
| 1595 | 1613 | #endif /* elf.h */ |
| @@ -427,6 +427,7 @@ void gfunc_prolog(CType *func_type) · 426 unmodified lines | ||
| 427 | 427 | oad(0xb8, 0); /* call to function */ |
| 428 | 428 | func_bound_offset = lbounds_section->data_offset; |
| 429 | 429 | } |
| 430 | + loc = 0; | |
| 430 | 431 | } |
| 431 | 432 | |
| 432 | 433 | /* generate function epilog */ |
| @@ -62,21 +62,32 @@ · 61 unmodified lines | ||
| 62 | 62 | /* target selection */ |
| 63 | 63 | //#define TCC_TARGET_I386 /* i386 code generator */ |
| 64 | 64 | //#define TCC_TARGET_ARM /* ARMv4 code generator */ |
| 65 | +//#define TCC_TARGET_C67 /* TMS320C67xx code generator */ | |
| 65 | 66 | |
| 66 | 67 | /* default target is I386 */ |
| 67 | −#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) | |
| 68 | +#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) && \ | |
| 69 | + !defined(TCC_TARGET_C67) | |
| 68 | 70 | #define TCC_TARGET_I386 |
| 69 | 71 | #endif |
| 70 | 72 | |
| 71 | −#if !defined(WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) | |
| 73 | +#if !defined(WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \ | |
| 74 | + !defined(TCC_TARGET_C67) | |
| 72 | 75 | #define CONFIG_TCC_BCHECK /* enable bound checking code */ |
| 73 | 76 | #endif |
| 74 | 77 | |
| 75 | 78 | /* define it to include assembler support */ |
| 76 | −#if !defined(TCC_TARGET_ARM) | |
| 79 | +#if !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_C67) | |
| 77 | 80 | #define CONFIG_TCC_ASM |
| 78 | 81 | #endif |
| 79 | 82 | |
| 83 | +#if !defined(WIN32) | |
| 84 | +#define FALSE 0 | |
| 85 | +#define false 0 | |
| 86 | +#define TRUE 1 | |
| 87 | +#define true 1 | |
| 88 | +typedef int BOOL; | |
| 89 | +#endif | |
| 90 | + | |
| 80 | 91 | /* path to find crt1.o, crti.o and crtn.o. Only needed when generating |
| 81 | 92 | executables or dlls */ |
| 82 | 93 | #define CONFIG_TCC_CRT_PREFIX "/usr/lib" |
| @@ -801,6 +812,10 @@ static inline int is_float(int t) · 718 unmodified lines | ||
| 801 | 812 | #include "arm-gen.c" |
| 802 | 813 | #endif |
| 803 | 814 | |
| 815 | +#ifdef TCC_TARGET_C67 | |
| 816 | +#include "c67-gen.c" | |
| 817 | +#endif | |
| 818 | + | |
| 804 | 819 | #ifdef CONFIG_TCC_STATIC |
| 805 | 820 | |
| 806 | 821 | #define RTLD_LAZY 0x001 |
| @@ -4614,6 +4629,11 @@ int gv(int rc) · 3807 unmodified lines | ||
| 4614 | 4629 | } |
| 4615 | 4630 | } |
| 4616 | 4631 | vtop->r = r; |
| 4632 | +#ifdef TCC_TARGET_C67 | |
| 4633 | + /* uses register pairs for doubles */ | |
| 4634 | + if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) | |
| 4635 | + vtop->r2 = r+1; | |
| 4636 | +#endif | |
| 4617 | 4637 | } |
| 4618 | 4638 | return r; |
| 4619 | 4639 | } |
| @@ -4964,6 +4984,8 @@ void gen_opl(int op) · 344 unmodified lines | ||
| 4964 | 4984 | #elif defined(TCC_TARGET_ARM) |
| 4965 | 4985 | b = ind; |
| 4966 | 4986 | o(0x1A000000 | encbranch(ind, 0, 1)); |
| 4987 | +#elif defined(TCC_TARGET_C67) | |
| 4988 | + error("not implemented"); | |
| 4967 | 4989 | #else |
| 4968 | 4990 | #error not supported |
| 4969 | 4991 | #endif |
| @@ -5624,7 +5646,11 @@ static int type_size(CType *type, int *a) · 654 unmodified lines | ||
| 5624 | 5646 | *a = LDOUBLE_ALIGN; |
| 5625 | 5647 | return LDOUBLE_SIZE; |
| 5626 | 5648 | } else if (bt == VT_DOUBLE || bt == VT_LLONG) { |
| 5627 | − *a = 4; /* XXX: i386 specific */ | |
| 5649 | +#ifdef TCC_TARGET_I386 | |
| 5650 | + *a = 4; | |
| 5651 | +#else | |
| 5652 | + *a = 8; | |
| 5653 | +#endif | |
| 5628 | 5654 | return 8; |
| 5629 | 5655 | } else if (bt == VT_INT || bt == VT_ENUM || bt == VT_FLOAT) { |
| 5630 | 5656 | *a = 4; |
| @@ -8673,7 +8699,6 @@ static void decl(int l) · 3042 unmodified lines | ||
| 8673 | 8699 | /* push a dummy symbol to enable local sym storage */ |
| 8674 | 8700 | sym_push2(&local_stack, SYM_FIELD, 0, 0); |
| 8675 | 8701 | gfunc_prolog(&type); |
| 8676 | − loc = 0; | |
| 8677 | 8702 | rsym = 0; |
| 8678 | 8703 | #ifdef CONFIG_REG_VARS |
| 8679 | 8704 | macro_ptr = func_str.str; |
| @@ -548,6 +548,14 @@ static void relocate_section(TCCState *s1, Section *s) · 547 unmodified lines | ||
| 548 | 548 | fprintf(stderr,"FIXME: handle reloc type %x at %lx [%.8x] to %lx\n", |
| 549 | 549 | type,addr,(unsigned int )ptr,val); |
| 550 | 550 | break; |
| 551 | +#elif defined(TCC_TARGET_C67) | |
| 552 | + case R_C60_32: | |
| 553 | + *(int *)ptr += val; | |
| 554 | + break; | |
| 555 | + default: | |
| 556 | + fprintf(stderr,"FIXME: handle reloc type %x at %lx [%.8x] to %lx\n", | |
| 557 | + type,addr,(unsigned int )ptr,val); | |
| 558 | + break; | |
| 551 | 559 | #else |
| 552 | 560 | #error unsupported processor |
| 553 | 561 | #endif |
| @@ -754,6 +762,8 @@ static void put_got_entry(TCCState *s1, · 200 unmodified lines | ||
| 754 | 762 | if (s1->output_type == TCC_OUTPUT_EXE) |
| 755 | 763 | offset = plt->data_offset - 16; |
| 756 | 764 | } |
| 765 | +#elif defined(TCC_TARGET_C67) | |
| 766 | + error("C67 got not implemented"); | |
| 757 | 767 | #else |
| 758 | 768 | #error unsupported CPU |
| 759 | 769 | #endif |
| @@ -828,6 +838,25 @@ static void build_got_entries(TCCState *s1) · 68 unmodified lines | ||
| 828 | 838 | sym_index); |
| 829 | 839 | } |
| 830 | 840 | break; |
| 841 | +#elif defined(TCC_TARGET_C67) | |
| 842 | + case R_C60_GOT32: | |
| 843 | + case R_C60_GOTOFF: | |
| 844 | + case R_C60_GOTPC: | |
| 845 | + case R_C60_PLT32: | |
| 846 | + if (!s1->got) | |
| 847 | + build_got(s1); | |
| 848 | + if (type == R_C60_GOT32 || type == R_C60_PLT32) { | |
| 849 | + sym_index = ELF32_R_SYM(rel->r_info); | |
| 850 | + sym = &((Elf32_Sym *)symtab_section->data)[sym_index]; | |
| 851 | + /* look at the symbol got offset. If none, then add one */ | |
| 852 | + if (type == R_C60_GOT32) | |
| 853 | + reloc_type = R_C60_GLOB_DAT; | |
| 854 | + else | |
| 855 | + reloc_type = R_C60_JMP_SLOT; | |
| 856 | + put_got_entry(s1, reloc_type, sym->st_size, sym->st_info, | |
| 857 | + sym_index); | |
| 858 | + } | |
| 859 | + break; | |
| 831 | 860 | #else |
| 832 | 861 | #error unsupported CPU |
| 833 | 862 | #endif |
| @@ -1415,6 +1444,8 @@ int tcc_output_file(TCCState *s1, const char *filename) · 581 unmodified lines | ||
| 1415 | 1444 | put32(p + 12, x + get32(p + 12) + s1->plt->data - p); |
| 1416 | 1445 | p += 16; |
| 1417 | 1446 | } |
| 1447 | +#elif defined(TCC_TARGET_C67) | |
| 1448 | + /* XXX: TODO */ | |
| 1418 | 1449 | #else |
| 1419 | 1450 | #error unsupported CPU |
| 1420 | 1451 | #endif |