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: 698201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tP23x2tSfz9snk for ; Wed, 23 Nov 2016 23:40:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="NX9pr7ks"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id :mime-version:content-type; q=dns; s=default; b=ZTrrm0SiyuG3HYKx G2XVi7RItnEbli927FwD7leXxc+aYnw9yi2WU8ITLeGh9qg6oOZ/DS/O7eLDisal xS7XW6nnIYww64Tb9oXCrrV9+rgin3FDYtU1vpzlsOWCLy59wM9SLMQNUMkqkIFl lJFhfUbPC0AJXPVw4YvOqBQD24w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id :mime-version:content-type; s=default; bh=KWLXM4i2DsWE08RSJzaJZk jb3wI=; b=NX9pr7ksasz/8ASrbv3TB90olaDtGerP0Y6Ibo5BNdyHRf42nj2idh P+dI5ffj+QXS/Q7qAwG08N+++RIXganEDN18vsxhKK6JLQ3BmDMzUQG3w0iUn784 EoWdchwGlO19XaUnMRe6+gB8Im2x/rcFVDTwGQ0pzVOu+7Up0/0aQ= 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