URL
https://opencores.org/ocsvn/zipcpu/zipcpu/trunk
Subversion Repositories zipcpu
Compare Revisions
- This comparison shows the changes necessary to convert path
/zipcpu/trunk
- from Rev 166 to Rev 165
- ↔ Reverse comparison
Rev 166 → Rev 165
/sw/binutils-2.25.patch
28,7 → 28,7
}; |
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/bfd-in2.h binutils-2.25/bfd/bfd-in2.h |
--- binutils-2.25-original/bfd/bfd-in2.h 2014-11-04 04:54:41.000000000 -0500 |
+++ binutils-2.25/bfd/bfd-in2.h 2016-07-11 15:37:10.745820768 -0400 |
+++ binutils-2.25/bfd/bfd-in2.h 2016-04-19 07:41:48.387151802 -0400 |
@@ -2283,6 +2283,8 @@ |
#define bfd_mach_aarch64_ilp32 32 |
bfd_arch_nios2, |
38,34 → 38,28
bfd_arch_last |
}; |
|
@@ -6066,6 +6068,31 @@ |
@@ -6066,6 +6068,25 @@ |
|
/* Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. */ |
BFD_RELOC_EPIPHANY_IMM8, |
+ |
+/* ZipCPU - 32 bit absolute value for LJMP instruction */ |
+/* ZIP CPU value (not address) relocations. */ |
+ BFD_RELOC_ZIP_VALUE, |
+ |
+/* ZipCPU - 18 bit PC-relative offset for BRA (ADD #x,PC) instruction */ |
+ BFD_RELOC_ZIP_BRANCH, |
+ |
+/* ZipCPU -- 14 (opB) or 13 (mov) bit PC-relative offsets for either generic |
+instructions as an operand B (such as xor lbl(PC),R0), or mov instructions |
+(ex. mov lbl(pc),uPC). */ |
+ BFD_RELOC_ZIP_OPB_PCREL, |
+ BFD_RELOC_ZIP_MOV_PCREL, |
+ |
+/* ZIP CPU value (not address) relocations. */ |
+ BFD_RELOC_ZIP_OPB_IMM, |
+ BFD_RELOC_ZIP_OPB_OFFSET, |
+ BFD_RELOC_ZIP_OPB_PCREL, |
+ BFD_RELOC_ZIP_OPB_GOTREL, |
+ BFD_RELOC_ZIP_MOV_OFFSET, |
+ BFD_RELOC_ZIP_MOV_PCREL, |
+ BFD_RELOC_ZIP_MOV_GOTREL, |
+ BFD_RELOC_ZIP_LDI, |
+ BFD_RELOC_ZIP_LLO, |
+ BFD_RELOC_ZIP_LHI, |
+ BFD_RELOC_ZIP_BREV, |
+ |
+/* ZipCPU -- Unused */ |
+/* This is the same as the ZIP_VALUE relocation, save only that the value is |
+right shifted by two, since it is an address and Zip addresses increment |
+by one per word, not one per byte. */ |
+ BFD_RELOC_ZIP_ADDRESS, |
BFD_RELOC_UNUSED }; |
|
238,8 → 232,8
|
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/elf32-zip.c binutils-2.25/bfd/elf32-zip.c |
--- binutils-2.25-original/bfd/elf32-zip.c 1969-12-31 19:00:00.000000000 -0500 |
+++ binutils-2.25/bfd/elf32-zip.c 2016-07-11 15:39:08.365117055 -0400 |
@@ -0,0 +1,1303 @@ |
+++ binutils-2.25/bfd/elf32-zip.c 2016-04-21 10:09:50.311094483 -0400 |
@@ -0,0 +1,1280 @@ |
+//////////////////////////////////////////////////////////////////////////////// |
+// |
+// Filename: tc-zip.c |
307,7 → 301,7
+ 32, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_dont, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_NONE", /* name */ |
+ FALSE, /* partial_inplace */ |
330,21 → 324,6
+ 0xffffffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* An 18 bit pc-relative relocation. */ |
+ HOWTO (R_ZIP_BRANCH, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 18, /* bitsize */ |
+ TRUE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_BRANCH", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x00000000, /* src_mask */ |
+ 0x0003ffff, /* dst_mask */ |
+ TRUE), /* pcrel_offset */ |
+ |
+ /* An 18 bit operand B immediate. */ |
+ HOWTO (R_ZIP_OPB_IMM, /* type */ |
+ 0, /* rightshift */ |
352,7 → 331,7
+ 18, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_OPB_IMM", /* name */ |
+ FALSE, /* partial_inplace */ |
367,7 → 346,7
+ 14, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_OPB_OFFSET", /* name */ |
+ FALSE, /* partial_inplace */ |
379,16 → 358,16
+ HOWTO (R_ZIP_OPB_PCREL, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 14, /* bitsize */ |
+ 18, /* bitsize */ |
+ TRUE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_OPB_PCREL", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x00000000, /* src_mask */ |
+ 0x00003fff, /* dst_mask-14 bits */ |
+ TRUE), /* pcrel_offset */ |
+ 0x0003ffff, /* dst_mask-14 bits */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* An 18 bit operand B immediate, but relative to the Global Offset Table. */ |
+ HOWTO (R_ZIP_OPB_GOTREL, /* type */ |
397,7 → 376,7
+ 18, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_OPB_GOTREL", /* name */ |
+ FALSE, /* partial_inplace */ |
412,7 → 391,7
+ 13, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_MOV_OFFSET", /* name */ |
+ FALSE, /* partial_inplace */ |
425,15 → 404,15
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 13, /* bitsize */ |
+ TRUE, /* pc_relative */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_MOV_PCREL", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0, /* src_mask */ |
+ 0x00001fff, /* dst_mask */ |
+ TRUE), /* pcrel_offset */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* */ |
+ HOWTO (R_ZIP_MOV_GOTREL, /* type */ |
442,7 → 421,7
+ 13, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_MOV_GOTREL", /* name */ |
+ FALSE, /* partial_inplace */ |
456,7 → 435,7
+ 23, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ complain_overflow_bitfield, /* complain_on_overflow */ |
+ zip_relocation, /* special_function */ |
+ "R_ZIP_LDI", /* name */ |
+ FALSE, /* partial_inplace */ |
477,7 → 456,7
+ 0, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+#ifdef USE_R_ZIP_LHI |
+ |
+ HOWTO (R_ZIP_LHI, /* type */ |
+ 16, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
491,7 → 470,6
+ 0, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+#endif |
+ |
+ HOWTO (R_ZIP_BREV, /* type -- LDIHI, but with bitreverse */ |
+ 0, /* rightshift */ |
534,7 → 512,6
+{ |
+ { BFD_RELOC_NONE, R_ZIP_NONE }, |
+ { BFD_RELOC_ZIP_VALUE, R_ZIP_VALUE }, |
+ { BFD_RELOC_ZIP_BRANCH, R_ZIP_BRANCH }, |
+ { BFD_RELOC_ZIP_OPB_IMM, R_ZIP_OPB_IMM }, |
+ { BFD_RELOC_ZIP_OPB_OFFSET, R_ZIP_OPB_OFFSET }, |
+ { BFD_RELOC_ZIP_OPB_PCREL, R_ZIP_OPB_PCREL }, |
544,7 → 521,7
+ { BFD_RELOC_ZIP_MOV_GOTREL, R_ZIP_MOV_GOTREL }, |
+ { BFD_RELOC_ZIP_LDI, R_ZIP_LDI }, |
+ { BFD_RELOC_ZIP_LLO, R_ZIP_LLO }, |
+ // { BFD_RELOC_ZIP_LHI, R_ZIP_LHI }, |
+ { BFD_RELOC_ZIP_LHI, R_ZIP_LHI }, |
+ { BFD_RELOC_ZIP_BREV, R_ZIP_BREV }, |
+ { BFD_RELOC_14, R_ZIP_OPB_OFFSET }, |
+ { BFD_RELOC_16, R_ZIP_LLO }, |
680,12 → 657,6
+ bfd_put_32(input_bfd, x, location); |
+ r = bfd_reloc_ok; |
+ } |
+ } else if (howto->type == R_ZIP_MOV_PCREL) { |
+ r = _bfd_final_link_relocate(howto, input_bfd, |
+ input_section, |
+ contents, rel->r_offset, |
+ relocation, |
+ rel->r_addend); |
+ } else { |
+ r = _bfd_final_link_relocate(howto, input_bfd, |
+ input_section, |
2169,22 → 2140,22
+#endif /* _ZIPBSD_H */ |
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/libbfd.h binutils-2.25/bfd/libbfd.h |
--- binutils-2.25-original/bfd/libbfd.h 2014-11-04 04:54:41.000000000 -0500 |
+++ binutils-2.25/bfd/libbfd.h 2016-07-11 15:37:10.753820721 -0400 |
+++ binutils-2.25/bfd/libbfd.h 2016-04-19 07:41:48.395151746 -0400 |
@@ -2953,6 +2953,19 @@ |
"BFD_RELOC_EPIPHANY_SIMM11", |
"BFD_RELOC_EPIPHANY_IMM11", |
"BFD_RELOC_EPIPHANY_IMM8", |
+ "BFD_RELOC_ZIP_VALUE", |
+ "BFD_RELOC_ZIP_BRANCH", |
+ "BFD_RELOC_ZIP_OPB_PCREL", |
+ "BFD_RELOC_ZIP_MOV_PCREL", |
+ "BFD_RELOC_ZIP_OPB_IMM", |
+ "BFD_RELOC_ZIP_OPB_OFFSET", |
+ "BFD_RELOC_ZIP_OPB_PCREL", |
+ "BFD_RELOC_ZIP_OPB_GOTREL", |
+ "BFD_RELOC_ZIP_MOV_OFFSET", |
+ "BFD_RELOC_ZIP_MOV_PCREL", |
+ "BFD_RELOC_ZIP_MOV_GOTREL", |
+ "BFD_RELOC_ZIP_LDI", |
+ "BFD_RELOC_ZIP_LLO", |
+ "BFD_RELOC_ZIP_LHI", |
+ "BFD_RELOC_ZIP_BREV", |
+ "BFD_RELOC_ZIP_ADDRESS", |
"@@overflow: BFD_RELOC_UNUSED@@", |
2344,7 → 2315,7
/* Tidy up when done. */ |
diff -Naur '--exclude=*.swp' binutils-2.25-original/bfd/reloc.c binutils-2.25/bfd/reloc.c |
--- binutils-2.25-original/bfd/reloc.c 2014-10-14 03:32:02.000000000 -0400 |
+++ binutils-2.25/bfd/reloc.c 2016-07-11 15:34:09.170906496 -0400 |
+++ binutils-2.25/bfd/reloc.c 2016-04-21 10:10:44.122704152 -0400 |
@@ -1362,7 +1362,7 @@ |
} |
|
2354,7 → 2325,7
} |
|
/* Relocate a given location using a given value and howto. */ |
@@ -7325,7 +7325,44 @@ |
@@ -7325,7 +7325,38 @@ |
BFD_RELOC_EPIPHANY_IMM8 |
ENUMDOC |
Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. |
2361,29 → 2332,19
- |
+ENUM |
+ BFD_RELOC_ZIP_VALUE |
+ENUMDOC |
+ ZipCPU - 32 bit absolute value for LJMP instruction |
+ENUM |
+ BFD_RELOC_ZIP_BRANCH |
+ENUMDOC |
+ ZipCPU - 18 bit PC-relative offset for BRA (ADD #x,PC) instruction |
+ENUM |
+ BFD_RELOC_ZIP_OPB_PCREL |
+ENUMX |
+ BFD_RELOC_ZIP_MOV_PCREL |
+ENUMDOC |
+ ZipCPU -- 14 (opB) or 13 (mov) bit PC-relative offsets for either generic |
+ instructions as an operand B (such as xor lbl(PC),R0), or mov instructions |
+ (ex. mov lbl(pc),uPC). |
+ENUM |
+ BFD_RELOC_ZIP_OPB_IMM |
+ENUMX |
+ BFD_RELOC_ZIP_OPB_OFFSET |
+ENUMX |
+ BFD_RELOC_ZIP_OPB_PCREL |
+ENUMX |
+ BFD_RELOC_ZIP_OPB_GOTREL |
+ENUMX |
+ BFD_RELOC_ZIP_MOV_OFFSET |
+ENUMX |
+ BFD_RELOC_ZIP_MOV_PCREL |
+ENUMX |
+ BFD_RELOC_ZIP_MOV_GOTREL |
+ENUMX |
+ BFD_RELOC_ZIP_LDI |
2390,6 → 2351,8
+ENUMX |
+ BFD_RELOC_ZIP_LLO |
+ENUMX |
+ BFD_RELOC_ZIP_LHI |
+ENUMX |
+ BFD_RELOC_ZIP_BREV |
+ENUMDOC |
+ ZIP CPU value (not address) relocations. |
2396,7 → 2359,9
+ENUM |
+ BFD_RELOC_ZIP_ADDRESS |
+ENUMDOC |
+ ZipCPU -- Unused |
+ This is the same as the ZIP_VALUE relocation, save only that the value is |
+ right shifted by two, since it is an address and Zip addresses increment |
+ by one per word, not one per byte. |
|
ENDSENUM |
BFD_RELOC_UNUSED |
2598,8 → 2563,8
optimize the copying in the simple case without using the |
diff -Naur '--exclude=*.swp' binutils-2.25-original/gas/config/tc-zip.c binutils-2.25/gas/config/tc-zip.c |
--- binutils-2.25-original/gas/config/tc-zip.c 1969-12-31 19:00:00.000000000 -0500 |
+++ binutils-2.25/gas/config/tc-zip.c 2016-07-15 11:00:12.695809274 -0400 |
@@ -0,0 +1,2431 @@ |
+++ binutils-2.25/gas/config/tc-zip.c 2016-05-12 15:50:06.250901352 -0400 |
@@ -0,0 +1,2404 @@ |
+//////////////////////////////////////////////////////////////////////////////// |
+// |
+// Filename: tc-zip.c |
3610,7 → 3575,7
+ insn->i_op = ZIPO_BUSY; |
+ insn->i_imm= -1; |
+ insn->i_areg = ZIP_PC; |
+ insn->i_breg = ZIP_RNONE; |
+ insn->i_breg = ZIP_PC; |
+ insn_form = NO_OP; |
+ } else if (strcasecmp(opstr, "JMP")==0) { |
+ insn->i_op = ZIPO_JMP; |
3864,7 → 3829,7
+ insn->i_op = ZIPO_OR; |
+ break; |
+ case ZIPO_BUSY: |
+ insn->i_op = ZIPO_ADD; |
+ insn->i_op = ZIPO_MOV; |
+ break; |
+ case ZIPO_NOT: |
+ insn->i_op = ZIPO_XOR; |
3928,20 → 3893,16
+ |
+ switch(op) { |
+ case ZIPO_MOV: |
+ imm = (a & 0x01fff); if (a&0x1000) imm |= -0x1000; break; |
+ imm = (a & 0x0fff); if (a&0x1fff) imm |= -0x1000; break; |
+ case ZIPO_LDI: |
+ imm = (a & 0x03fffff); break; |
+ case ZIPO_LDIn: |
+ imm = (a & 0x03fffff); imm |= -0x0200000; break; |
+/* |
+ * While this makes conceptual sense, it doesn't match the CPU. Hence let's |
+ * comment it out and make certain things still work. |
+ case ZIPO_LDILO: |
+#ifndef LONG_MPY |
+ case ZIPO_LDIHI: // BREVx would rm LDIHI |
+#endif |
+ imm = (a & 0x0ffff); break; |
+*/ |
+ default: |
+ if (a & 0x040000) { |
+ imm = (a & 0x03fff); |
4009,13 → 3970,11
+ break; |
+ default: |
+ if (a & 0x040000) { |
+ // Can't have an immediate and a register in |
+ // VLIW mode |
+ imma = a & 0x03fff; |
+ if (imma !=0) |
+ return 0; |
+ } else { |
+ imma = (a & 0x03fff); |
+ imma = (a & 0x03ffff); |
+ if (imma & 0x02000) // Sign extension? |
+ imma |= -0x02000; |
+ if ((imma < -8)||(imma > 7)) |
4139,7 → 4098,6
+ unsigned long symv = 0; |
+ int sym_defined = 0, this_segment = 0, sym_known = 0; |
+ symbolS *sym = NULL; |
+ unsigned immv = insn->i_imm; |
+ |
+ if (insn->i_rp) { |
+ fragS *sym_frag; |
4149,16 → 4107,7
+ sym_frag = symbol_get_frag(sym); |
+ this_segment = (S_GET_SEGMENT(sym) == seg); |
+ |
+#ifdef ZIP_DEBUG |
+ fprintf(stderr, "SYMV(%s) = %08lx + %08lx -> %08lx\n", |
+ S_GET_NAME(sym), |
+ S_GET_VALUE(sym), fragP->fr_offset, |
+ S_GET_VALUE(sym) + fragP->fr_offset); |
+#endif |
+ symv += fragP->fr_offset; |
+ // The immediate value has been included in the fragP->fr_offset |
+ // So, to keep us from applying it twice, we'll zero it here. |
+ immv = 0; |
+ |
+#ifdef ZIP_DEBUG |
+ { int this_frag = (sym_frag == fragP); |
4225,8 → 4174,7
+#ifdef ZIP_DEBUG |
+ if (sym_known) |
+ printf("%08lx@%08lx/%08lx - SYM(%s)-KNOWN %s%s%s%s%s\n", |
+ (unsigned long)fragP->fr_literal, |
+ fragP->fr_address/OCTETS_PER_BYTE, |
+ (unsigned long)fragP->fr_literal, fragP->fr_address/OCTETS_PER_BYTE, |
+ (unsigned long)symv, S_GET_NAME(sym), |
+ (S_GET_SEGMENT(sym) == absolute_section)?" abs":"", |
+ (S_GET_SEGMENT(sym) == expr_section)?" expr":"", |
4250,6 → 4198,7
+ (insn->i_rp)&&(symbol_get_frag(insn->i_rp->r_sym)==fragP)?1:0, |
+ this_segment, insn->i_imm); |
+#endif |
+ unsigned immv = insn->i_imm; |
+ switch(insn->i_op) { |
+ case ZIPO_LDI: // May or may not be conditional |
+ if ((sym_known)&&(this_segment) |
4265,7 → 4214,8
+ } |
+ |
+ insn->i_aux[0] = 0x7e000000; // NOOP -- if never used. |
+ immv += symv; |
+ if (insn->i_rp) |
+ immv += symv; |
+ if ((insn->i_cnd == ZIPC_ALWAYS) |
+ // and either no symbol, or we know the symbol |
+ &&((!insn->i_rp)||(sym_known)) |
4401,16 → 4351,10
+ // whereas |
+ // MOV BIGVAL(Ry),Rx |
+ // could be quietly compiled into |
+ // LDI BIGVAL,Rx |
+ // ADD.Z Ry,Rx (Note the contortions to avoid adjusting |
+ // ADD.NZ Ry,Rx ... the flag bits) |
+ // LDI BIGVAL,Ry |
+ // ADD Rx,Ry |
+ // This would give us access to full 32-bit offsets ... |
+ // as long as neither Rx nor Ry was a user register. On the |
+ // other hand, if we knew the flag bits would be set between |
+ // now and the next conditional instruction, we could do a |
+ // LDI BIGVAL,Rx |
+ // ADD Ry,Rx |
+ // and be okay with it. |
+ // as long as neither Rx nor Ry was a user register |
+ // |
+ // For now we just handle our normal 13 bit signed immediate |
+ // offsets. |
4417,19 → 4361,16
+ // |
+ if (insn->i_rp) { |
+ insn->i_rp->r_pcrel = (insn->i_breg == ZIP_PC); |
+ immv += symv; |
+ if (insn->i_rp->r_sym) |
+ immv += symv; |
+ if (insn->i_breg == ZIP_PC) { |
+ immv +=(int)(-fragP->fr_address/OCTETS_PER_BYTE |
+ -insn->i_rp->r_fr_offset-1); |
+ if ((sym_known)&&(this_segment)) { |
+ if ((sym_known)&&(this_segment)) |
+ // Tested--this works |
+ insn->i_rp->r_type = BFD_RELOC_NONE; |
+ } else { |
+#ifdef ZIP_DEBUG |
+ printf("ZIP_MOV_PCREL relocation needed for %s, pcrel = %d\n", S_GET_NAME(sym), insn->i_rp->r_pcrel); |
+#endif |
+ else |
+ insn->i_rp->r_type = BFD_RELOC_ZIP_MOV_PCREL; |
+ } |
+// } else if((zip_param_got)&&(insn->i_breg == ZIP_GBL)) { |
+// immv = symv; |
+// insn->i_rp->r_type = BFD_RELOC_ZIP_MOV_GOTREL; |
4437,6 → 4378,7
+ } else { |
+ // Do we really want to assume this is an |
+ // address? |
+ immv += symv; |
+ insn->i_rp->r_type = BFD_RELOC_ZIP_MOV_OFFSET; |
+ } |
+ } |
4765,15 → 4707,12
+ case BFD_RELOC_ZIP_MOV_OFFSET: |
+ case BFD_RELOC_ZIP_MOV_PCREL: |
+ case BFD_RELOC_ZIP_MOV_GOTREL: |
+#ifdef ZIP_DEBUG |
+ if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_OFFSET) |
+ printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_OFFSET\n"); |
+ else if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_PCREL) |
+ printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_PCREL\n"); |
+ else |
+ printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_GOTREL\n"); |
+ printf("Final-fix = %d\n", final_fix); |
+#endif |
+ // if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_OFFSET) |
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_OFFSET\n"); |
+ // else if (fixP->fx_r_type == BFD_RELOC_ZIP_MOV_PCREL) |
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_PCREL\n"); |
+ // else |
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_MOV_GOTREL\n"); |
+ mask = 0x1fff; iword = (iword &(~mask))|((*val)&mask); |
+ (*val) &= 0x01fff; |
+ md_number_to_chars((char *)buf, iword, 4); |
4805,7 → 4744,6
+ md_number_to_chars((char *)buf, iword, 4); |
+ fixP->fx_done = final_fix; |
+ break; |
+#ifdef USE_R_ZIP_LHI |
+ case BFD_RELOC_ZIP_LHI: |
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_LHI\n"); |
+ iword |= ((*val)>>16)&0x0ffff; |
4813,7 → 4751,6
+ md_number_to_chars((char *)buf, iword, 4); |
+ fixP->fx_done = final_fix; |
+ break; |
+#endif |
+ case BFD_RELOC_32: |
+ case BFD_RELOC_ZIP_VALUE: |
+ // printf("\tMD-APPLY-FIX: BFD_RELOC_ZIP_VALUE/32\n"); |
4989,6 → 4926,7
+ insn->i_imm,// Fixed/known offset to the symbol |
+ insn->i_rp->r_pcrel, // T if PC-Relative reloc |
+ BFD_RELOC_ZIP_BREV); // Reloc type |
+ // BFD_RELOC_ZIP_LHI); // Reloc type |
+ fix_new(fragP, |
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset+1), // where w/in frag? |
+ 4, // 1,2, or 4 usually ... ?? |
4998,7 → 4936,7
+ BFD_RELOC_ZIP_LLO); // Reloc type |
+ } else { |
+ insn->i_rp->r_fix = fix_new(fragP, |
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset), // where w/in frag? |
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset+1), // where w/in frag? |
+ 4, // 1,2, or 4 usually ... ?? |
+ insn->i_rp->r_sym, // Add symbol, |
+ insn->i_imm, // Fixed/known offset to the symbol |
5013,7 → 4951,7
+ OCTETS_PER_BYTE * (insn->i_rp->r_fr_offset +insn->i_naux), |
+ 4, // 1,2, or 4 usually ... ?? |
+ insn->i_rp->r_sym, // Add symbol, |
+ insn->i_imm, // Fixed/known offset to the symbol |
+ 0, // Fixed/known offset to the symbol |
+ insn->i_rp->r_pcrel, // T if PC-Relative reloc |
+ BFD_RELOC_ZIP_VALUE); // Reloc type |
+ } else { |
5025,7 → 4963,7
+ OCTETS_PER_BYTE * insn->i_rp->r_fr_offset, // where w/in frag? |
+ 4, // 1,2, or 4 usually ... ?? |
+ insn->i_rp->r_sym, // Add symbol, |
+ insn->i_imm, // Fixed/known offset to the symbol |
+ 0, // Fixed/known offset to the symbol |
+ insn->i_rp->r_pcrel, // T if PC-Relative reloc |
+ insn->i_rp->r_type); // Reloc type |
+ } |
6045,7 → 5983,7
/* Values for e_version. */ |
diff -Naur '--exclude=*.swp' binutils-2.25-original/include/elf/zip.h binutils-2.25/include/elf/zip.h |
--- binutils-2.25-original/include/elf/zip.h 1969-12-31 19:00:00.000000000 -0500 |
+++ binutils-2.25/include/elf/zip.h 2016-07-11 15:33:02.971302139 -0400 |
+++ binutils-2.25/include/elf/zip.h 2016-04-19 07:25:33.241829488 -0400 |
@@ -0,0 +1,74 @@ |
+//////////////////////////////////////////////////////////////////////////////// |
+// |
6091,16 → 6029,16
+START_RELOC_NUMBERS(elf_zip_reloc_type) |
+ RELOC_NUMBER (R_ZIP_NONE, 0) |
+ RELOC_NUMBER (R_ZIP_VALUE, 1) |
+ RELOC_NUMBER (R_ZIP_BRANCH, 2) |
+ RELOC_NUMBER (R_ZIP_OPB_IMM, 3) |
+ RELOC_NUMBER (R_ZIP_OPB_OFFSET, 4) |
+ RELOC_NUMBER (R_ZIP_OPB_PCREL, 5) |
+ RELOC_NUMBER (R_ZIP_OPB_GOTREL, 6) |
+ RELOC_NUMBER (R_ZIP_MOV_OFFSET, 7) |
+ RELOC_NUMBER (R_ZIP_MOV_PCREL, 8) |
+ RELOC_NUMBER (R_ZIP_MOV_GOTREL, 9) |
+ RELOC_NUMBER (R_ZIP_LDI, 10) |
+ RELOC_NUMBER (R_ZIP_LLO, 11) |
+ RELOC_NUMBER (R_ZIP_OPB_IMM, 2) |
+ RELOC_NUMBER (R_ZIP_OPB_OFFSET, 3) |
+ RELOC_NUMBER (R_ZIP_OPB_PCREL, 4) |
+ RELOC_NUMBER (R_ZIP_OPB_GOTREL, 5) |
+ RELOC_NUMBER (R_ZIP_MOV_OFFSET, 6) |
+ RELOC_NUMBER (R_ZIP_MOV_PCREL, 7) |
+ RELOC_NUMBER (R_ZIP_MOV_GOTREL, 8) |
+ RELOC_NUMBER (R_ZIP_LDI, 9) |
+ RELOC_NUMBER (R_ZIP_LLO, 10) |
+ RELOC_NUMBER (R_ZIP_LHI, 11) |
+ RELOC_NUMBER (R_ZIP_BREV ,12) |
+ RELOC_NUMBER (R_ZIP_BROKEN_BYTE,13) |
+END_RELOC_NUMBERS(R_ZIP_max) |
6660,8 → 6598,8
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo |
diff -Naur '--exclude=*.swp' binutils-2.25-original/opcodes/zip-dis.c binutils-2.25/opcodes/zip-dis.c |
--- binutils-2.25-original/opcodes/zip-dis.c 1969-12-31 19:00:00.000000000 -0500 |
+++ binutils-2.25/opcodes/zip-dis.c 2016-07-15 11:49:53.253965130 -0400 |
@@ -0,0 +1,377 @@ |
+++ binutils-2.25/opcodes/zip-dis.c 2016-04-28 13:23:40.816085799 -0400 |
@@ -0,0 +1,331 @@ |
+//////////////////////////////////////////////////////////////////////////////// |
+// |
+// Filename: zip-dis.c |
6725,14 → 6663,6
+} |
+ |
+static inline int |
+OFFSET_PC_MOV(uint32_t ins) { |
+ // 0.xxxx.01111.ccc.0.1111.0.iiiiiiiiiiiii |
+ // 0xxx.x011.11cc.c011.110i.iiii.iiii.iiii |
+ // |
+ return ((ins & 0x87c7e000)==0x03c3c000); |
+} |
+ |
+static inline int |
+TWOWORD_LJMP(uint32_t iword) { |
+ // LJMP a long jump instruction, for which the address of the target |
+ // is found in the next word |
6744,27 → 6674,11
+ return 0; |
+} |
+ |
+ |
+static inline int |
+TWOWORD_JSR(uint32_t iword, uint32_t nxtword) { |
+ // First word moves the return address to R0 |
+ if (iword!=0x03c3c001) |
+ return 0; |
+ // Second word is a BRA statement to ... anywhere |
+ // 0.1111.00010.ccc.0.iiiiiiiiiiiiiiiiii |
+ // 0111.1000.10cc.c0ii.iiii.iiii.iiii.iiii |
+ if ((nxtword&0xffc40000)==0x78800000) |
+ return 1; |
+ return 0; |
+} |
+ |
+static inline int |
+POSSIBLE_TWOWORD_BEGINNING(uint32_t iword) { |
+ // Unconditional LJMP |
+ if (TWOWORD_LJMP(iword)) |
+ return 1; |
+ if (iword == 0x03c3c001) |
+ return 1; |
+ // The conditional LJMP is three words, which we don't handle ... |
+ // Any BREV command could be the beginning of a twoword instruction |
+ // |
6840,26 → 6754,6
+ |
+ *refaddr = TWOWORD_VALUE(ins,nxtword); |
+ return; |
+ } else if (TWOWORD_JSR(ins, nxtword)) { |
+ int cv = zip_getbits(nxtword, ZIP_BITFIELD(3,19)); |
+ int iv = zip_sbits(nxtword, 18); |
+ |
+ *refaddr = iv + addr + 2; |
+ sprintf(line, "%s%s", "JSR", zip_ccstr[cv]); |
+ sprintf(line, "%-11s", line); |
+ sprintf(line, "%s0x%08x", line, *refaddr); |
+ |
+ return; |
+ } else if (OFFSET_PC_MOV(ins)) { |
+ int cv = zip_getbits(ins, ZIP_BITFIELD(3,19)); |
+ int dv = zip_getbits(ins, ZIP_REGFIELD(27)); |
+ int iv = zip_sbits(ins, 13); |
+ *refaddr = iv + addr + 1; |
+ sprintf(line, "%s%s", "MOV", zip_ccstr[cv]); |
+ sprintf(line, "%-11s", line); |
+ sprintf(line, "%s0x%08x", line, *refaddr); |
+ sprintf(line, "%s,%s", line, zip_regstr[dv]); |
+ return; |
+ } |
+ |
+ int i; |
7025,10 → 6919,8
+ // must match as well. |
+ if (TWOWORD_LOAD(iword,nxtword)) |
+ return 8; |
+ if (TWOWORD_JSR(iword,nxtword)) |
+ return 8; |
+ // if ((iword&0xffc7ffff)==0x7c87c001) // Conditional long jump |
+ // return 12; // LOD.C 1(PC),PC, BRA 1+PC, @ADDRESS |
+ if ((iword&0xffc7ffff)==0x7c87c001) // Conditional long jump |
+ return 12; // LOD.C 1(PC),PC, BRA 1+PC, @ADDRESS |
+ return 4; |
+} |
+ |
7090,8 → 6982,8
+#endif |
diff -Naur '--exclude=*.swp' binutils-2.25-original/opcodes/zip-opc.c binutils-2.25/opcodes/zip-opc.c |
--- binutils-2.25-original/opcodes/zip-opc.c 1969-12-31 19:00:00.000000000 -0500 |
+++ binutils-2.25/opcodes/zip-opc.c 2016-07-15 11:47:17.674912592 -0400 |
@@ -0,0 +1,563 @@ |
+++ binutils-2.25/opcodes/zip-opc.c 2016-05-02 14:15:12.743655341 -0400 |
@@ -0,0 +1,552 @@ |
+//////////////////////////////////////////////////////////////////////////////// |
+// |
+// Filename: zip-opc.c |
7156,7 → 7048,7
+ // Conditional branches |
+ // 0.1111.0111.ccc.0.111.10iiiii-- |
+ // 0111 1011 11cc c011 110i iiii iiii iiii |
+ { "BUSY", 0xffc7ffff, 0x7883ffff, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) }, |
+ { "BUSY", 0xffc7ffff, 0x7bc3dfff, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) }, |
+ { "BRA", 0xfffc0000, 0x78800000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
+ { "BLT", 0xfffc0000, 0x78880000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
+ { "BZ", 0xfffc0000, 0x78900000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
7165,7 → 7057,6
+ { "BGE", 0xfffc0000, 0x78a80000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
+ { "BC", 0xfffc0000, 0x78b00000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
+ { "BRV", 0xfffc0000, 0x78b80000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
+ { "BRV", 0xfffc0000, 0x78b80000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
+ // CLRF ... an XOR w/ self instruction |
+ // 0.rrrr.00100.ccc.1.rrrr.iiiii--- |
+ // 0rrr r001 00cc c1rr rr00 0000 0000 0000 |
7202,8 → 7093,6
+ // "INT", 0xff10007f, 0x9e00005f, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19), |
+ // Return to user space |
+ { "RTU", 0xffc7ffff, 0x70c00020, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) }, |
+ // The return instruction: JMP R0 (possibly conditional) |
+ { "RTN", 0xffc7ffff, 0x7bc00000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) }, |
+ // JMP (possibly a conditional jump, if not covered by branches above) |
+ // 0.1111.01111.ccc.a.rrrr.biiiiiiiiiiiiiiii |
+ // 0111.1011.11cc.c0rr.rrbi.iiii.iiii.iiii MOV x,PC |
7299,8 → 7188,7
+ // 0111.x000.00.xxx.xxx.xxxx.xxxx.xxxx.xxxx |
+ { "NOOP", 0xf7ffffff, 0x76000000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "BRK", 0xf7ffffff, 0x76400000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "BRK", 0xf7fc0000, 0x76400000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(18,0), ZIP_OPUNUSED }, |
+ { "LOCK", 0xf7f80000, 0x76800000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "LOCK", 0xf7ffffff, 0x76800000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ // |
+ // |
+ // LOD: 0rrr.r100.10cc.cxrr.rrii.iiii.iiii.iiii |
7340,8 → 7228,6
+ { "BNZ", 0xffd40000, 0xf8940000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_OPUNUSED }, |
+ // LDI 1.rrrr.1011x.ccc.iiiii -> 1rrr r101 1xcc ciii ii |
+ { "CLR", 0x8787c000, 0x85800000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(2,19) }, |
+ // RTN 1.1111.01111.ccc.1.0000 -> 1111.1011.11cc.c100.00 (Mov R0 to PC) |
+ { "RTN", 0xffc7c000, 0xfbc40000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19) }, |
+ // JMP 1.1111.01111.ccc.1rrrr -> 1111 1011 11cc c1rr rr (Mov to PC) |
+ { "JMP", 0xffc40000, 0xfbc40000, ZIP_REGFIELD(27),ZIP_OPUNUSED, ZIP_REGFIELD(14), ZIP_OPUNUSED, ZIP_BITFIELD(2,19) }, |
+ // XOR 1.rrrr.00100.ccc.01111 -> 1rrr r001 00cc c011 11 |
7426,10 → 7312,9
+ // |
+ { "NOOP", 0xf7c00000, 0xf6000000, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ // |
+ { "BRK", 0xf7c7c000, 0xf6400000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "BRK", 0xf7c40000, 0xf6400000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_OPUNUSED }, |
+ { "BRK", 0xf7c00000, 0xf6400000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_BITFIELD(2,19) }, |
+ // |
+ { "LOCK", 0xf7c00000, 0xf6800000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "LOCK", 0xf7c00000, 0xf6800000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,14), ZIP_BITFIELD(2,19) }, |
+ // |
+ // |
+ { "FPADD",0x87c40000, 0x86040000, ZIP_REGFIELD(27), ZIP_REGFIELD(27), ZIP_REGFIELD(14), ZIP_OPUNUSED, ZIP_BITFIELD(2,19) }, |
7475,9 → 7360,6
+ // "CLRF", 0xffc7cfff, 0x7907c000, ZIP_REGFIELD(27), ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(3,19), |
+ // CLR -- a LDI of zero |
+ // LDI 1xxx.xxxx.xxxx.xxxx.xxrr.rroo.ooo.iiiii -> 1rrr r100 1xcc ciii ii |
+ // RTN 1xxx -- xx11.1101.111.ccc.1.0000 -> 1xxx --- xx11.1101.1111.0000 |
+ { "RTN", 0x80203fff, 0x80003df0, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "RTN", 0x80203fff, 0x80203df0, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_BITFIELD(2,19) }, |
+ // JMP 1xxx -- xx11.1101.1111.rrrr (Mov to PC) |
+ { "JMP", 0x80203ff0, 0x80003df0, ZIP_REGFIELD(10),ZIP_OPUNUSED, ZIP_REGFIELD(0), ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ // Conditional jump, still move to PC at issue |
7617,10 → 7499,9
+ // |
+ { "NOOP", 0x80003bf0, 0x80003b00, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ // |
+ { "BRK", 0x80003bff, 0x80003b20, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "BRK", 0x80003bf0, 0x80003b20, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_IMMFIELD(4,0), ZIP_OPUNUSED }, |
+ { "BRK", 0x80003bf0, 0x80003b20, ZIP_REGFIELD(10), ZIP_REGFIELD(10), ZIP_OPUNUSED, ZIP_IMMFIELD(4,0), ZIP_OPUNUSED }, |
+ // |
+ { "LOCK", 0x80003bf0, 0x80003b40, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED, ZIP_OPUNUSED }, |
+ { "LOCK", 0x80003bf0, 0x80003b40, ZIP_REGFIELD(10), ZIP_REGFIELD(10), ZIP_OPUNUSED, ZIP_IMMFIELD(4,0), ZIP_OPUNUSED }, |
+ // |
+ // FPU instructions |
+ // |