From patchwork Sat Dec 2 16:19:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 843901 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-87755-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="j36acqN7"; dkim-atps=neutral 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 3ypxDS1krPz9sPt for ; Sun, 3 Dec 2017 03:19:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:mime-version:content-type:date:subject:cc :to:message-id; q=dns; s=default; b=bSxIzJ0LhTNltitdDEU0j5oLkuWH dKlAuyWV9WEA9L2RA0V4QSyIuU/dafvnW02wdzhki+ZNW18PAgxRuSA3b6WMKzST uc6gGxW9ECijG2TiwcTN82f8IWWZTgLNv8XXagEa78hhYoTBrtPq1Cj2MKI+q78y T44Ek3+JJyswZRI= 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:from:mime-version:content-type:date:subject:cc :to:message-id; s=default; bh=9UrsHlQixEArn8Nes8LBDOPjjvc=; b=j3 6acqN7/uzz5IztPL+7G9UqhIr2LwsZ8AolvG/tIXU4bmgicLuIp23Lz5BI42gQiB SBBlWilHn9QNPouI7IyowdPHFofuolImxgTwqb9/a/X8xtGF/HZtWDxALA2Ye3VO 3E4i0WZMzL9+d3aBKuZHPsJx6yB+EI4rv+t+SEn8E= Received: (qmail 55409 invoked by alias); 2 Dec 2017 16:19:28 -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 55394 invoked by uid 89); 2 Dec 2017 16:19:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=bl, Hx-spam-relays-external:192.168.2.25, H*r:ip*192.168.2.25, H*RU:192.168.2.25 X-HELO: torfep01.bell.net From: John David Anglin Mime-Version: 1.0 (Apple Message framework v1085) Date: Sat, 2 Dec 2017 11:19:22 -0500 Subject: [COMMITTED] hppa: Improve PIC pc-relative instruction sequences Cc: Carlos O'Donell To: GNU C Library Message-Id: <99A68D04-81BA-47A7-B659-937E1EDF6E61@bell.net> The priority level of user code on PA-RISC is always 3. The "depi" instruction used to clear the priority level saved in the link register can be eliminated by adjusting the offsets of the following $PIC_pcrel$ instructions. Tested with no observed regressions. Committed to trunk. Dave --- John David Anglin dave.anglin@bell.net 2017-12-02 John David Anglin * sysdeps/hppa/dl-fptr.c (elf_machine_resolve): Remove unnecessary depi instruction from PIC pc-relative sequence. * sysdeps/hppa/dl-fptr.h (ELF_MACHINE_LOAD_ADDRESS): Likewise. * sysdeps/hppa/dl-machine.h (elf_machine_dynamic): Likewise. (elf_machine_load_address): Likewise. (elf_machine_runtime_setup): Likewise. diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c index 96fd09d192..d2cc413403 100644 --- a/sysdeps/hppa/dl-fptr.c +++ b/sysdeps/hppa/dl-fptr.c @@ -329,9 +329,8 @@ elf_machine_resolve (void) Elf32_Addr addr; asm ("b,l 1f,%0\n" -" depi 0,31,2,%0\n" -"1: addil L'_dl_runtime_resolve - ($PIC_pcrel$0 - 8),%0\n" -" ldo R'_dl_runtime_resolve - ($PIC_pcrel$0 - 12)(%%r1),%0\n" +" addil L'_dl_runtime_resolve - ($PIC_pcrel$0 - 1),%0\n" +"1: ldo R'_dl_runtime_resolve - ($PIC_pcrel$0 - 5)(%%r1),%0\n" : "=r" (addr) : : "r1"); return addr; diff --git a/sysdeps/hppa/dl-fptr.h b/sysdeps/hppa/dl-fptr.h index 0cb50524fd..3ed86bb230 100644 --- a/sysdeps/hppa/dl-fptr.h +++ b/sysdeps/hppa/dl-fptr.h @@ -31,9 +31,8 @@ extern void _dl_fptr_init (void); #define ELF_MACHINE_LOAD_ADDRESS(var, symbol) \ asm ( \ " b,l 1f,%0\n" \ -" depi 0,31,2,%0\n" \ -"1: addil L'" #symbol " - ($PIC_pcrel$0 - 8),%0\n" \ -" ldo R'" #symbol " - ($PIC_pcrel$0 - 12)(%%r1),%0\n" \ +" addil L'" #symbol " - ($PIC_pcrel$0 - 1),%0\n" \ +"1: ldo R'" #symbol " - ($PIC_pcrel$0 - 5)(%%r1),%0\n" \ : "=&r" (var) : : "r1"); #endif /* !dl_hppa_fptr_h */ diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index acfb9fc31f..11ee9ca2eb 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -81,10 +81,9 @@ elf_machine_dynamic (void) { Elf32_Addr dynamic; - asm ("b,l 1f,%0\n" -" depi 0,31,2,%0\n" -"1: addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8),%0\n" -" ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%%r1),%0\n" + asm ("bl 1f,%0\n" +" addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 1),%0\n" +"1: ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 5)(%%r1),%0\n" : "=r" (dynamic) : : "r1"); return dynamic; @@ -100,10 +99,9 @@ elf_machine_load_address (void) Elf32_Addr dynamic; asm ( -" b,l 1f,%0\n" -" depi 0,31,2,%0\n" -"1: addil L'_DYNAMIC - ($PIC_pcrel$0 - 8),%0\n" -" ldo R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%0\n" +" bl 1f,%0\n" +" addil L'_DYNAMIC - ($PIC_pcrel$0 - 1),%0\n" +"1: ldo R'_DYNAMIC - ($PIC_pcrel$0 - 5)(%%r1),%0\n" : "=r" (dynamic) : : "r1"); return dynamic - elf_machine_dynamic (); @@ -339,14 +337,13 @@ asm ( \ just like a branch reloc. This sequence gets us the \ runtime address of _DYNAMIC. */ \ " bl 0f,%r19\n" \ -" depi 0,31,2,%r19\n" /* clear priviledge bits */ \ -"0: addil L'_DYNAMIC - ($PIC_pcrel$0 - 8),%r19\n" \ -" ldo R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%r1),%r26\n" \ +" addil L'_DYNAMIC - ($PIC_pcrel$0 - 1),%r19\n" \ +"0: ldo R'_DYNAMIC - ($PIC_pcrel$0 - 5)(%r1),%r26\n" \ \ /* The link time address is stored in the first entry of the \ GOT. */ \ -" addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%r19\n" \ -" ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%r1),%r20\n" \ +" addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 9),%r19\n" \ +" ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 13)(%r1),%r20\n" \ \ " sub %r26,%r20,%r20\n" /* Calculate load offset */ \ \