From: Jason Eckhardt Date: Wed, 6 Aug 2003 23:59:36 +0000 (+0000) Subject: gas: X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e4c808f2d67640c158bef94067fd955f3935611b;p=pf3gnuchains%2Fpf3gnuchains3x.git gas: 2003-08-06 Jason Eckhardt * config/tc-i860.c (i860_handle_align): New function. * config/tc-i860.h (HANDLE_ALIGN): Define macro. (MAX_MEM_FOR_RS_ALIGN_CODE): Define macro. gas/testsuite: 2003-08-06 Jason Eckhardt * gas/i860/dir-align01.{s,d}: New files. * gas/i860/i860.exp: Execute the new test above. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 8e1356c074..bbb0d78b0b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,11 @@ 2003-08-06 Jason Eckhardt + * config/tc-i860.c (i860_handle_align): New function. + * config/tc-i860.h (HANDLE_ALIGN): Define macro. + (MAX_MEM_FOR_RS_ALIGN_CODE): Define macro. + +2003-08-06 Jason Eckhardt + * config/tc-i860.c (i860_process_insn): Check that instructions with their dual-bit set are 8-byte aligned. diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c index d170b7047c..b281d523df 100644 --- a/gas/config/tc-i860.c +++ b/gas/config/tc-i860.c @@ -1462,3 +1462,36 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, } return reloc; } + +/* This is called from HANDLE_ALIGN in write.c. Fill in the contents + of an rs_align_code fragment. */ + +void +i860_handle_align (fragS *fragp) +{ + /* Instructions are always stored little-endian on the i860. */ + static const unsigned char le_nop[] = { 0x00, 0x00, 0x00, 0xA0 }; + + int bytes; + char *p; + + if (fragp->fr_type != rs_align_code) + return; + + bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix; + p = fragp->fr_literal + fragp->fr_fix; + + /* Make sure we are on a 4-byte boundary, in case someone has been + putting data into a text section. */ + if (bytes & 3) + { + int fix = bytes & 3; + memset (p, 0, fix); + p += fix; + fragp->fr_fix += fix; + } + + memcpy (p, le_nop, 4); + fragp->fr_var = 4; +} + diff --git a/gas/config/tc-i860.h b/gas/config/tc-i860.h index 72a5b6a52b..c5c39b45c0 100644 --- a/gas/config/tc-i860.h +++ b/gas/config/tc-i860.h @@ -86,4 +86,10 @@ extern int target_big_endian; visible symbols can be overridden. */ #define EXTERN_FORCE_RELOC 0 +/* Bits for filling in rs_align_code fragments with NOPs. */ +extern void i860_handle_align (struct frag *); +#define HANDLE_ALIGN(fragp) i860_handle_align (fragp) + +#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4) + #endif /* TC_I860 */ diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 30591b7228..51a1239619 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2003-08-06 Jason Eckhardt + * gas/i860/dir-align01.{s,d}: New files. + * gas/i860/i860.exp: Execute the new test above. + +2003-08-06 Jason Eckhardt + * gas/i860/dual02-err.l: Update expected error message. * gas/i860/README.i860: Remove dual02-err from known failure list. diff --git a/gas/testsuite/gas/i860/dir-align01.d b/gas/testsuite/gas/i860/dir-align01.d new file mode 100644 index 0000000000..bc4f677074 --- /dev/null +++ b/gas/testsuite/gas/i860/dir-align01.d @@ -0,0 +1,17 @@ +#as: +#objdump: -d +#name: i860 dir-align01 + +.*: +file format .* + +Disassembly of section \.text: + +00000000 <\.text>: + 0: 00 20 a6 90 adds %r4,%r5,%r6 + 4: 00 00 00 a0 shl %r0,%r0,%r0 + 8: 00 00 00 a0 shl %r0,%r0,%r0 + c: 00 00 00 a0 shl %r0,%r0,%r0 + 10: 00 50 6c 91 adds %r10,%r11,%r12 + 14: a1 b1 1a 4b fmlow.dd %f22,%f24,%f26 + 18: 30 74 f0 49 pfadd.ss %f14,%f15,%f16 + 1c: b0 8c 54 4a pfadd.sd %f17,%f18,%f20 diff --git a/gas/testsuite/gas/i860/dir-align01.s b/gas/testsuite/gas/i860/dir-align01.s new file mode 100644 index 0000000000..595eb3fcff --- /dev/null +++ b/gas/testsuite/gas/i860/dir-align01.s @@ -0,0 +1,11 @@ +# Test that .text section alignments use nops (0xA0000000) to fill +# rather than 0. + .text + adds %r4,%r5,%r6 + .align 16 + adds %r10,%r11,%r12 + fmlow.dd %f22,%f24,%f26 + pfadd.ss %f14,%f15,%f16 + pfadd.sd %f17,%f18,%f20 + + diff --git a/gas/testsuite/gas/i860/i860.exp b/gas/testsuite/gas/i860/i860.exp index 601995b81f..3a1ceed5c4 100644 --- a/gas/testsuite/gas/i860/i860.exp +++ b/gas/testsuite/gas/i860/i860.exp @@ -17,6 +17,7 @@ if [istarget i860-*-*] { run_dump_test "bitwise" run_dump_test "branch" run_dump_test "bte" + run_dump_test "dir-align01" run_dump_test "dir-intel01" run_dump_test "dir-intel02" run_list_test "dir-intel03-err" ""