jfp@practic.UUCP (John F. Peters) (05/28/89)
Immediate operands are wrongfully limited to one byte for the 'andw' and 'andd' ops; here are the corrections to ns32k-opcode.h. *** ns32k-opcode.h.00 Mon Apr 24 09:20:21 1989 --- ns32k-opcode.h Sat May 27 23:41:02 1989 *************** *** 109,116 **** { "adjspw", 11,16, 0x057d, "1W", 2, "", 20,21 }, { "adjspd", 11,16, 0x057f, "1D", 4, "", 20,21 }, { "andb", 6,16, 0x28, "1B2B", 1, "", 20,21 }, ! { "andw", 6,16, 0x29, "1W2W", 1, "", 20,21 }, ! { "andd", 6,16, 0x2b, "1D2D", 1, "", 20,21 }, { "ashb", 14,24, 0x044e, "1B2B", 1, "", 20,21 }, { "ashw", 14,24, 0x054e, "1B2W", 1, "", 20,21 }, { "ashd", 14,24, 0x074e, "1B2D", 1, "", 20,21 }, --- 109,116 ---- { "adjspw", 11,16, 0x057d, "1W", 2, "", 20,21 }, { "adjspd", 11,16, 0x057f, "1D", 4, "", 20,21 }, { "andb", 6,16, 0x28, "1B2B", 1, "", 20,21 }, ! { "andw", 6,16, 0x29, "1W2W", 2, "", 20,21 }, ! { "andd", 6,16, 0x2b, "1D2D", 4, "", 20,21 }, { "ashb", 14,24, 0x044e, "1B2B", 1, "", 20,21 }, { "ashw", 14,24, 0x054e, "1B2W", 1, "", 20,21 }, { "ashd", 14,24, 0x074e, "1B2D", 1, "", 20,21 }, -- jfp@practic.com {uunet,sun,pyramid}!practic!jfp 408 749 8900
jfp@practic.UUCP (John F. Peters) (06/01/89)
DESCRIPTION: (1) .word and .int are fixed-up with bytes reversed (2) "Probably harmless" used-before-set error in encode_operand(ns32k.c) (3) Minor typo in #if !defined(32032) (ns32k.c) REPEAT-BY: Assemble this trivial program with a32k and inspect the output. Note that ordinary integers appear (correctly) with lsb first, but expressions requiring fixup are rendered msb first. --------------------- .text words: .word 1 .word 2 .word L1-L0 .word L2-L0 ints: .int 1 .int 2 .int L1-L0 .int L2-L0 labels: L0: .byte 0 L1: .byte 0 L2: .byte 0 --------------------- FIX: 32k has three sorts of constants: big-endian immediate (md_number_to_imm) im_disp==0 big-endian displacement (md_number_to_disp) im_disp==1 little-endian (md_number_to_chars) im_disp==2 Fixup_segment(write.c) decides among these three cases based on the fixS field fx_im_disp. However, cons(read.c) builds a fixS using fix_new(write.c), which forces fx_im_disp to 0. A similar situation arises during "broken_word" handling in write_object_file(write.c). My fix is conditional compiling of calls to fix_new_ns32k(ns32k.c), with the im_disp parameter set to 2. This is not such a desirable strategy since it introduces machine-dependence; a better approach would be machine-dependent procedures for constants and "broken_words". *** Makefile.00 Fri May 12 11:45:32 1989 --- Makefile Wed May 31 10:46:53 1989 *************** *** 50,59 **** # to include the mc68851 mmu coprocessor instructions un-comment # the next line, and comment out the following line. (68020 only) ! OPTIONS = -Dm68851 ! # OPTIONS = ! a: a68 ! @rm -f a ! @ln a68 a ! lint: lint_68k # To make the VAX assembler compile as the default, un-comment the next five --- 50,59 ---- # to include the mc68851 mmu coprocessor instructions un-comment # the next line, and comment out the following line. (68020 only) ! # OPTIONS = -Dm68851 ! #OPTIONS = ! #a: a68 ! # @rm -f a ! # @ln a68 a ! #lint: lint_68k # To make the VAX assembler compile as the default, un-comment the next five *************** *** 75,83 **** # To make the ns32k assembler compile as the default, un comment the # next five lines, and comment out the 'a:' groups for the other assemblers. ! #OPTIONS = ! #a: a32k ! # @rm -f a ! # @ln a32k a ! #lint: lint_32k # To make the sparc assembler compile as the default, un comment the --- 75,83 ---- # To make the ns32k assembler compile as the default, un comment the # next five lines, and comment out the 'a:' groups for the other assemblers. ! OPTIONS = -DNS32032 ! a: a32k ! @rm -f a ! @ln a32k a ! lint: lint_32k # To make the sparc assembler compile as the default, un comment the *** ns32k.c.00 Thu May 11 12:35:16 1989 --- ns32k.c Wed May 31 10:43:06 1989 *************** *** 227,231 **** }; ! #if !defined(NS32032) && !defined(NS32032) #define NS32032 #endif --- 227,231 ---- }; ! #if !defined(NS32032) && !defined(NS32532) #define NS32032 #endif *************** *** 733,736 **** --- 733,737 ---- if (i>3) as_fatal("Internal error check ns32k-opcode.h"); pcrel=0; + pcrel_adjust=0; tmp=0; switch (operandsP[(loop<<1)+1]) { *** read.c.00 Wed Mar 29 08:40:40 1989 --- read.c Wed May 31 10:32:37 1989 *************** *** 1300,1304 **** --- 1300,1308 ---- register segT segment; expressionS exp; + #if defined(NS32032) || defined(NS32532) + void fix_new_ns32k(); /* 32k requires im_disp==2 for small-endian consts */ + #else void fix_new(); + #endif /* *************** *** 1395,1401 **** --- 1399,1417 ---- case SEG_TEXT: case SEG_DATA: + #if defined(NS32032) || defined(NS32532) + /* + * Ordinary (non-immed, non-disp) 32k constants are + * little-endian, communicate this to fixup_segment + * with im_disp == 2 + */ + fix_new_ns32k (frag_now, p - frag_now -> fr_literal, nbytes, + exp . X_add_symbol, exp . X_subtract_symbol, + exp . X_add_number, 0, + 0, 2, 0, 0); + #else fix_new (frag_now, p - frag_now -> fr_literal, nbytes, exp . X_add_symbol, exp . X_subtract_symbol, exp . X_add_number, 0); + #endif break; *** write.c.00 Fri May 12 11:45:20 1989 --- write.c Wed May 31 10:38:50 1989 *************** *** 429,433 **** --- 429,444 ---- for(lie=broken_words; lie; lie=lie->next_broken_word) if(!lie->added) { + #if defined(NS32032) || defined(NS32532) + void fix_new_ns32k(); + /* + * Ordinary (non-immed, non-disp) 32k constants are + * little-endian, communicate this to fixup_segment + * with im_disp == 2 + */ + fix_new_ns32k(lie->frag,lie->word_goes_here - lie->frag->fr_literal,2,lie->add,lie->sub,lie->addnum,0, + 0, 2, 0, 0); + #else fix_new(lie->frag,lie->word_goes_here - lie->frag->fr_literal,2,lie->add,lie->sub,lie->addnum,0); + #endif /* md_number_to_chars(lie->word_goes_here, lie->add->sy_value ***************** -- jfp@practic.com {uunet,sun,pyramid}!practic!jfp 408 749 8900
ewerlid@kuling.UUCP (Ove Ewerlid) (06/02/89)
The current version of the ns32k-GAS has suffered when upgrades of the GAS has been done. The main reason for this is that the ns32k uses certain features that is different from the VAX and m68k. The original implementaion of those features have been mangled. There has also been a lack of a machine to test it on. GAS is going to see more of those features when RISCs are ported to it. As far as the ns32k-GAS is concerned a major rewrite of the code is hopefully going to take place soon. The goal for this rewrite is to get it going on an Encore using robotussin to deal with the COFF.