This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Fix handling of R_MIPS_PC16 relocations


Maciej W. Rozycki wrote:
[snip]
>  I don't think the following bit is OK -- you've just defined
> BFD_RELOC_16_PCREL to behave just like BFD_RELOC_16_PCREL_S2 would: 
> 
> diff -BurpNX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
> --- src-orig/gas/config/tc-mips.c	Fri Aug 31 22:00:08 2001
> +++ src/gas/config/tc-mips.c	Thu Sep  6 21:58:05 2001
> @@ -1898,6 +1978,10 @@ append_insn (place, ip, address_expr, re
>  		 | ((address_expr->X_add_number & 0x3fffc) >> 2));
>  	      break;
>  
> +	    case BFD_RELOC_16_PCREL:
> +	      ip->insn_opcode |= (address_expr->X_add_number >> 2) & 0xffff;
> +	      break;
> +
>  	    case BFD_RELOC_16_PCREL_S2:
>  	      goto need_reloc;
>  
> 
>  You'd do something like "ip->insn_opcode |= address_expr->X_add_number &
> 0xffff" for a BFD_RELOC_16_PCREL reloc. 

I've overlooked this reminiscent from my earlier patch, thanks
for reviewing. I'll check in the following patch under the obvious
rule.


Thiemo


2001-09-12  Thiemo Seufer  <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* config/tc-mips.c (append_insn): Don't rightshift BFD_RELOC_16_PCREL.


diff -BurpNX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c	Fri Sep  7 08:11:31 2001
+++ src/gas/config/tc-mips.c	Wed Sep 12 19:55:09 2001
@@ -1899,7 +1978,7 @@ append_insn (place, ip, address_expr, re
 	      break;
 
 	    case BFD_RELOC_16_PCREL:
-	      ip->insn_opcode |= (address_expr->X_add_number >> 2) & 0xffff;
+	      ip->insn_opcode |= address_expr->X_add_number & 0xffff;
 	      break;
 
 	    case BFD_RELOC_16_PCREL_S2:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]