From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13176 invoked by alias); 12 May 2017 01:40:01 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 10932 invoked by uid 89); 12 May 2017 01:39:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-8.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,LOTS_OF_MONEY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=$28 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 May 2017 01:39:58 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id 241FC45BFCCD5 for ; Fri, 12 May 2017 02:39:56 +0100 (IST) Received: from [10.20.78.226] (10.20.78.226) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server id 14.3.294.0; Fri, 12 May 2017 02:39:56 +0100 Date: Fri, 12 May 2017 01:40:00 -0000 From: "Maciej W. Rozycki" To: CC: Matthew Fortune Subject: [committed] MIPS/GAS: Unify GP-relative percent-ops Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2017-05/txt/msg00147.txt.bz2 For a reason that is unclear commit d6f165938798 ("Support for MIPS16 HI16/LO16 relocations"), , which has added support for the R_MIPS16_GPREL relocation, has spelled its corresponding MIPS16 percent-op as `%gprel', rather than `%gp_rel' which is how its regular MIPS counterpart is spelled. To make assembly code sharing easier between the regular MIPS and the MIPS16 ISA make both percent-op spellings acceptable in both kinds of code now. Parts of this change by Matthew Fortune. gas/ * config/tc-mips.c (mips_percent_op): Add "%gprel". (mips16_percent_op): Add "%gp_rel". * testsuite/gas/mips/elf-rel8.s:: Add `%gprel' forms. * testsuite/gas/mips/elf-rel8-mips16.s: Add `%gp_rel' forms. * testsuite/gas/mips/elf-rel8.d: Adjust accordingly. * testsuite/gas/mips/elf-rel8-mips16.d: Likewise. --- binutils-mips16-matthewf-gprel.diff Index: binutils/gas/config/tc-mips.c =================================================================== --- binutils.orig/gas/config/tc-mips.c 2017-05-12 00:12:16.440212444 +0100 +++ binutils/gas/config/tc-mips.c 2017-05-12 02:01:55.271447015 +0100 @@ -14094,6 +14094,7 @@ static const struct percent_op_match mip {"%got_lo", BFD_RELOC_MIPS_GOT_LO16}, {"%got", BFD_RELOC_MIPS_GOT16}, {"%gp_rel", BFD_RELOC_GPREL16}, + {"%gprel", BFD_RELOC_GPREL16}, {"%half", BFD_RELOC_16}, {"%highest", BFD_RELOC_MIPS_HIGHEST}, {"%higher", BFD_RELOC_MIPS_HIGHER}, @@ -14113,6 +14114,7 @@ static const struct percent_op_match mip static const struct percent_op_match mips16_percent_op[] = { {"%lo", BFD_RELOC_MIPS16_LO16}, + {"%gp_rel", BFD_RELOC_MIPS16_GPREL}, {"%gprel", BFD_RELOC_MIPS16_GPREL}, {"%got", BFD_RELOC_MIPS16_GOT16}, {"%call16", BFD_RELOC_MIPS16_CALL16}, Index: binutils/gas/testsuite/gas/mips/elf-rel8-mips16.d =================================================================== --- binutils.orig/gas/testsuite/gas/mips/elf-rel8-mips16.d 2017-05-12 00:12:16.451626351 +0100 +++ binutils/gas/testsuite/gas/mips/elf-rel8-mips16.d 2017-05-12 01:24:29.372183202 +0100 @@ -34,5 +34,11 @@ 32: R_MIPS16_GPREL gvar 36: f000 4c00 addiu \$4,0 36: R_MIPS16_GPREL gvar - 3a: 6500 nop + 3a: f000 9a80 lw \$4,0\(\$2\) + 3a: R_MIPS16_GPREL gvar + 3e: f000 da80 sw \$4,0\(\$2\) + 3e: R_MIPS16_GPREL gvar + 42: f000 4c00 addiu \$4,0 + 42: R_MIPS16_GPREL gvar + 46: 6500 nop #pass Index: binutils/gas/testsuite/gas/mips/elf-rel8-mips16.s =================================================================== --- binutils.orig/gas/testsuite/gas/mips/elf-rel8-mips16.s 2017-05-12 00:12:16.494331325 +0100 +++ binutils/gas/testsuite/gas/mips/elf-rel8-mips16.s 2017-05-12 01:24:29.397970410 +0100 @@ -32,6 +32,13 @@ lw $4,%gprel(gvar)($2) sw $4,%gprel(gvar)($2) addiu $4,%gprel(gvar) + + # Check the alternative form. + + lw $4,%gp_rel(gvar)($2) + sw $4,%gp_rel(gvar)($2) + addiu $4,%gp_rel(gvar) + .align 6 .end foo Index: binutils/gas/testsuite/gas/mips/elf-rel8.d =================================================================== --- binutils.orig/gas/testsuite/gas/mips/elf-rel8.d 2017-05-12 00:12:16.507519877 +0100 +++ binutils/gas/testsuite/gas/mips/elf-rel8.d 2017-05-12 01:24:29.476514484 +0100 @@ -54,4 +54,10 @@ 5c: R_MIPS_GPREL16 gvar 60: 27840000 addiu \$4,\$28,0 60: R_MIPS_GPREL16 gvar + 64: 8f840000 lw \$4,0\(\$28\) + 64: R_MIPS_GPREL16 gvar + 68: af840000 sw \$4,0\(\$28\) + 68: R_MIPS_GPREL16 gvar + 6c: 27840000 addiu \$4,\$28,0 + 6c: R_MIPS_GPREL16 gvar \.\.\. Index: binutils/gas/testsuite/gas/mips/elf-rel8.s =================================================================== --- binutils.orig/gas/testsuite/gas/mips/elf-rel8.s 2017-05-12 00:12:16.521783066 +0100 +++ binutils/gas/testsuite/gas/mips/elf-rel8.s 2017-05-12 01:24:29.554556813 +0100 @@ -46,6 +46,12 @@ sw $4,%gp_rel(gvar)($28) addiu $4,$28,%gp_rel(gvar) + # Check the alternative form. + + lw $4,%gprel(gvar)($28) + sw $4,%gprel(gvar)($28) + addiu $4,$28,%gprel(gvar) + .space 64 .end foo