From patchwork Wed Nov 23 12:39:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 17727 Received: (qmail 53862 invoked by alias); 23 Nov 2016 12:40:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 53823 invoked by uid 89); 23 Nov 2016 12:40:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=hardcoded, sk:R_MICRO, sk:r_micro, $28 X-HELO: mailapp01.imgtec.com Date: Wed, 23 Nov 2016 12:39:39 +0000 From: "Maciej W. Rozycki" To: CC: "Joseph S. Myers" Subject: [PATCH] MIPS: Use R_MICROMIPS_JALR rather than R_MIPS_JALR in microMIPS code Message-ID: User-Agent: Alpine 2.20.17 (DEB 179 2016-10-28) MIME-Version: 1.0 In a microMIPS compilation of `.init' code use the R_MICROMIPS_JALR relocation intended for PIC call relaxation in microMIPS code rather than the corresponding R_MIPS_JALR relocation meant for regular MIPS code only. * sysdeps/mips/mips32/crti.S (JALR_RELOC): New macro. (_init): Use it in place of hardcoded R_MIPS_JALR. * sysdeps/mips/mips64/n32/crti.S (JALR_RELOC): New macro. (_init): Use it in place of hardcoded R_MIPS_JALR. * sysdeps/mips/mips64/n64/crti.S (JALR_RELOC): New macro. (_init): Use it in place of hardcoded R_MIPS_JALR. --- No regressions with the `mips-mti-linux-gnu' target in o32 regular MIPS and microMIPS multilib testing and neither in n32 and n64 regular MIPS multilib testing. OK to apply? Maciej glibc-umips-jalr.diff Index: glibc/sysdeps/mips/mips32/crti.S =================================================================== --- glibc.orig/sysdeps/mips/mips32/crti.S 2016-11-17 15:28:32.000000000 +0000 +++ glibc/sysdeps/mips/mips32/crti.S 2016-11-17 15:36:52.838901381 +0000 @@ -40,6 +40,12 @@ #include +#ifdef __mips_micromips +# define JALR_RELOC R_MICROMIPS_JALR +#else +# define JALR_RELOC R_MIPS_JALR +#endif + #ifndef PREINIT_FUNCTION # define PREINIT_FUNCTION __gmon_start__ #endif @@ -71,13 +77,13 @@ lw $2,%got(PREINIT_FUNCTION)($28) beq $2,$0,.Lno_weak_fn lw $25,%call16(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION + .reloc 1f,JALR_RELOC,PREINIT_FUNCTION 1: jalr $25 .Lno_weak_fn: .insn #else lw $25,%got(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION + .reloc 1f,JALR_RELOC,PREINIT_FUNCTION 1: jalr $25 #endif Index: glibc/sysdeps/mips/mips64/n32/crti.S =================================================================== --- glibc.orig/sysdeps/mips/mips64/n32/crti.S 2016-11-17 15:30:48.000000000 +0000 +++ glibc/sysdeps/mips/mips64/n32/crti.S 2016-11-17 15:37:17.195020438 +0000 @@ -40,6 +40,12 @@ #include +#ifdef __mips_micromips +# define JALR_RELOC R_MICROMIPS_JALR +#else +# define JALR_RELOC R_MIPS_JALR +#endif + #ifndef PREINIT_FUNCTION # define PREINIT_FUNCTION __gmon_start__ #endif @@ -71,13 +77,13 @@ lw $2,%got_disp(PREINIT_FUNCTION)($28) beq $2,$0,.Lno_weak_fn lw $25,%call16(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION + .reloc 1f,JALR_RELOC,PREINIT_FUNCTION 1: jalr $25 .Lno_weak_fn: .insn #else lw $25,%got_disp(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION + .reloc 1f,JALR_RELOC,PREINIT_FUNCTION 1: jalr $25 #endif Index: glibc/sysdeps/mips/mips64/n64/crti.S =================================================================== --- glibc.orig/sysdeps/mips/mips64/n64/crti.S 2016-11-17 15:30:56.000000000 +0000 +++ glibc/sysdeps/mips/mips64/n64/crti.S 2016-11-17 15:38:09.690102763 +0000 @@ -40,6 +40,12 @@ #include +#ifdef __mips_micromips +# define JALR_RELOC R_MICROMIPS_JALR +#else +# define JALR_RELOC R_MIPS_JALR +#endif + #ifndef PREINIT_FUNCTION # define PREINIT_FUNCTION __gmon_start__ #endif @@ -71,13 +77,13 @@ ld $2,%got_disp(PREINIT_FUNCTION)($28) beq $2,$0,.Lno_weak_fn ld $25,%call16(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION + .reloc 1f,JALR_RELOC,PREINIT_FUNCTION 1: jalr $25 .Lno_weak_fn: .insn #else ld $25,%got_disp(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION + .reloc 1f,JALR_RELOC,PREINIT_FUNCTION 1: jalr $25 #endif