From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by sourceware.org (Postfix) with ESMTPS id 08F35386F831 for ; Mon, 29 Jun 2020 16:49:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 08F35386F831 Received: by mail-il1-x141.google.com with SMTP id t27so10112654ill.9 for ; Mon, 29 Jun 2020 09:49:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uMfwjNQWM6yt/YX77qnw9BRX/9lmFR2KBBhld/r77dU=; b=dFBjrbBGa2MmK8kSqeRqZMq+8UxCg2PyksLUHN4uIk+CyksRVenHKvuWMaGaMjXt9D PilV2gmB7S/pDmvhZafO5j/oxoAB5m9AGyriBF3XyOhoSxaFcJfo2R3IodkkoumKFy2F Zn/vTK1QFkOLtXXYEPnGXvf5qoH3zikYbBWs25ZWVpPQNiyFaezQSbvrsN2t72LaYBLO GPROl0SrXV/3+yvjNZ8krIfixaLn48aYPMpZy+x4bJBYwZ/VnvGwgOXqfCbZVZhHvpZX JbNJh/k1AkVgI3pXyIRWYuxewXz/yitOOibiDe4TZ8mrlLcFaG4OXOg1HCW56oky82ug vDhw== X-Gm-Message-State: AOAM533MU6hvSr4gVbLvkcOW0le5WvFqwSzjdyApzLLFUfmVcqPR0KcX hskL4cbw+IYuhsMaBxJdBI5bPcNuyLd6P4hxbfM= X-Google-Smtp-Source: ABdhPJzH6yUIqqPFHDoLiJa9b+PaL0wxgP9fAgiW/8b5HLtRr9pCeoW/AyozFYVTHTpDpovrIvGbEDMOuO6FWzEzOM4= X-Received: by 2002:a92:5f12:: with SMTP id t18mr17127726ilb.267.1593449368527; Mon, 29 Jun 2020 09:49:28 -0700 (PDT) MIME-Version: 1.0 References: <20200622211034.659739-1-alistair.francis@wdc.com> <87zh8u8d17.fsf@igel.home> <87o8p21bjh.fsf@oldenburg2.str.redhat.com> <87366dx35x.fsf@oldenburg2.str.redhat.com> <87sgedvnq3.fsf@oldenburg2.str.redhat.com> <87o8p1vnb9.fsf@oldenburg2.str.redhat.com> In-Reply-To: <87o8p1vnb9.fsf@oldenburg2.str.redhat.com> From: Alistair Francis Date: Mon, 29 Jun 2020 09:39:46 -0700 Message-ID: Subject: Re: [PATCH] Allow memset local PLT reference for RISC-V. To: Florian Weimer Cc: Alistair Francis via Libc-alpha , Andreas Schwab , Alistair Francis Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2020 16:49:30 -0000 On Mon, Jun 29, 2020 at 9:39 AM Florian Weimer wrote: > > * Alistair Francis: > > > On Mon, Jun 29, 2020 at 9:30 AM Florian Weimer wrote: > >> > >> * Alistair Francis: > >> > >> > There is also a PLT memset in libc_pic.a > >> > > >> > 1bc: 009aa023 sw s1,0(s5) > >> > memset (result->__data, '\0', > >> > 1c0: 865e mv a2,s7 > >> > 1c2: 4581 li a1,0 > >> > 1c4: 008a8513 addi a0,s5,8 > >> > 1c8: 00000097 auipc ra,0x0 > >> > 1c8: R_RISCV_CALL_PLT __GI_memset > >> > 1c8: R_RISCV_RELAX *ABS* > >> > 1cc: 000080e7 jalr ra # 1c8 <.LVL39+0x14> > >> > >> That's weird. What does a direct call (to a hidden symbol) look like, > >> relocation-wise. > > > > I'm not sure. How can I figure out? > > Look at different internal calls, e.g. __twalk_r and __libc_updwtmp (for > two variants, one with a hidden prototype and one without). Here is what I see from the libc_pic.a lib. __twalk_r 00000000 *UND* 00000000 __GI___twalk_r ... __twalk_r (loaded, do_release_shlib, handle); 1b2: 4088 lw a0,0(s1) 1b4: 8622 mv a2,s0 1b6: 00000597 auipc a1,0x0 1b6: R_RISCV_PCREL_HI20 do_release_shlib 1b6: R_RISCV_RELAX *ABS* 1ba: 00058593 mv a1,a1 1ba: R_RISCV_PCREL_LO12_I .L0 1ba: R_RISCV_RELAX *ABS* 1be: 00000097 auipc ra,0x0 1be: R_RISCV_CALL __GI___twalk_r 1be: R_RISCV_RELAX *ABS* 1c2: 000080e7 jalr ra # 1be <.L52+0xc> __libc_updwtmp 000009c0 g F .text 00000124 .hidden __libc_updwtmp ... 00000064 <.LVL8>: 64: 0141 addi sp,sp,16 __libc_updwtmp (file_name, utmp); 66: 00000317 auipc t1,0x0 66: R_RISCV_CALL __libc_updwtmp 66: R_RISCV_RELAX *ABS* 6a: 00030067 jr t1 # 66 <.LVL8+0x2> Alistair > > Thanks, > Florian >