From patchwork Fri Sep 15 01:16:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangboshi X-Patchwork-Id: 22890 Received: (qmail 72558 invoked by alias); 15 Sep 2017 01:16:37 -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 72543 invoked by uid 89); 15 Sep 2017 01:16:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=rights, Hx-languages-length:2545 X-HELO: szxga04-in.huawei.com Subject: Re: [RFC][PATCH] AArch64: use movz/movk instead of literal pools in start.S To: Szabolcs Nagy CC: , GNU C Library References: <59B65347.503@arm.com> <336560e5-c9de-08bc-c850-28994cac2c33@huawei.com> <59BA3F64.60504@arm.com> From: Boshi Wang Message-ID: <2112d1ae-98b2-f555-99ed-99d1d24ac4da@huawei.com> Date: Fri, 15 Sep 2017 09:16:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <59BA3F64.60504@arm.com> X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.59BB29E9.0067, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 226d96cde6d9dd5ee313b7f8096acb52 On 2017/9/14 16:35, Szabolcs Nagy wrote: > On 14/09/17 04:21, Boshi Wang wrote: >> On 2017/9/11 17:11, Szabolcs Nagy wrote: >>> On 07/09/17 08:33, wangboshi wrote: >>>> 2017-09-07 Wang Boshi >>>> >>>> * sysdeps/aarch64/start.S: Use MOVL instead of literal pools. >>>> * sysdeps/aarch64/sysdep.h (MOVL): Add MOVL macro. >>>> >>> thanks, the patch looks good to me (except for a nit below), >>> do you have copyright assignment? >>> do you have commit rights to the glibc repo? >> I have read requirements of copyright assignment. I don't have that. >> >> I don't have commit rights, too. >> >> So how can I contribute the change? Could you give me some suggestions? >> > i think your change is just below the legally-significant limit > https://www.gnu.org/prep/maintain/maintain.html#Legally-Significant > so i can commit it for you. > > but getting your employer to sort it out with the fsf would be better, > in case you run into further issues that need glibc fixes. > That's great. I have a few doubt. Could you add my name into the patch? The new patch is here below. Thank you, Nagy. diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S index df1c642..51e8e82 100644 --- a/sysdeps/aarch64/start.S +++ b/sysdeps/aarch64/start.S @@ -71,9 +71,9 @@ _start: ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini] #else /* Set up the other arguments in registers */ - ldr PTR_REG (0), =main - ldr PTR_REG (3), =__libc_csu_init - ldr PTR_REG (4), =__libc_csu_fini + MOVL(0, main) + MOVL(3, __libc_csu_init) + MOVL(4, __libc_csu_fini) #endif /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index a749a70..152f5ba 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -137,6 +137,20 @@ ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \ OP PTR_REG (R), [x##T]; +/* Load an immediate into R. + Note R is a register number and not a register name. */ +#ifdef __LP64__ +# define MOVL(R, NAME) \ + movz PTR_REG(R), #:abs_g3:NAME; \ + movk PTR_REG(R), #:abs_g2_nc:NAME; \ + movk PTR_REG(R), #:abs_g1_nc:NAME; \ + movk PTR_REG(R), #:abs_g0_nc:NAME; +#else +# define MOVL(R, NAME) \ + movz PTR_REG(R), #:abs_g1:NAME; \ + movk PTR_REG(R), #:abs_g0_nc:NAME; +#endif + /* Since C identifiers are not normally prefixed with an underscore on this system, the asm identifier `syscall_error' intrudes on the C name space. Make sure we use an innocuous name. */