mips16 fix
Clinton Popetz
cpopetz@cygnus.com
Thu Jan 13 14:39:00 GMT 2000
Currently padding for alignment in mips code is done with zeros. This is a
problem for mips16, where the noop is 0x6500 (and where a zero is a addiu
$s0,$sp,0.) The appended patch fixes this. Ok?
Also, the following two patches (neither of which were mine) fix mips16
bugs as well:
http://sourceware.cygnus.com/ml/binutils/1999-12/msg00021.html
http://sourceware.cygnus.com/ml/binutils/1999-q3/msg00717.html
I've applied them locally at Cygnus, but I wanted to make sure they weren't
forgotten.
-Clint
2000-01-13 Clinton Popetz <cpopetz@cygnus.com>
* config/tc-mips.c (mips_do_align): New function.
* config/tc-mips.h (md_do_align): Define.
Index: tc-mips.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-mips.c,v
retrieving revision 1.8
diff -c -2 -p -r1.8 tc-mips.c
*** tc-mips.c 1999/11/01 19:29:55 1.8
--- tc-mips.c 2000/01/13 22:28:06
*************** static procS *cur_proc_ptr;
*** 11437,11440 ****
--- 11437,11470 ----
static int numprocs;
+ /* When we align code in the .text section of mips16, use the correct two
+ byte nop pattern of 0x6500 (move $0,$0) */
+
+ int
+ mips_do_align (n, fill, len, max)
+ int n;
+ const char *fill;
+ int len;
+ int max;
+ {
+ if (fill == NULL
+ && subseg_text_p (now_seg)
+ && n > 1
+ && mips_opts.mips16)
+ {
+ static const unsigned char be_nop[] = { 0x65, 0x00 };
+ static const unsigned char le_nop[] = { 0x00, 0x65 };
+
+ frag_align (1, 0, 0);
+
+ if (target_big_endian)
+ frag_align_pattern (n, be_nop, 2, max);
+ else
+ frag_align_pattern (n, le_nop, 2, max);
+ return 1;
+ }
+
+ return 0;
+ }
+
static void
md_obj_begin ()
Index: tc-mips.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-mips.h,v
retrieving revision 1.2
diff -c -2 -p -r1.2 tc-mips.h
*** tc-mips.h 1999/06/03 00:29:37 1.2
--- tc-mips.h 2000/01/13 22:28:14
*************** extern int mips_relax_frag PARAMS ((stru
*** 56,59 ****
--- 56,62 ----
#define md_operand(x)
+ extern int mips_do_align PARAMS ((int, const char *, int, int));
+ #define md_do_align(n,fill,len,max,l) if (mips_do_align (n,fill,len,max)) goto l
+
/* We permit PC relative difference expressions when generating
embedded PIC code. */
More information about the Binutils
mailing list