From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 995CD3858401; Fri, 17 Sep 2021 06:55:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 995CD3858401 Received: by mail-lf1-x12e.google.com with SMTP id p29so28804888lfa.11; Thu, 16 Sep 2021 23:55:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VJ+EEap1d8K9bqBOF9FGWfdoDIgUwnZrguQrgw7DKAc=; b=HdA2Jpj3qGGcKmb/9HaCdBhNjdTJGDWOK82udGayP8UdylrDZnwHPOcmgnfGJRWQU7 meSXJTP8BmQK5q4svtlyrPaa0IP5sOpZQFfPkc0HSUSNQi/F/bkbKwivCgBnPoPQ4WsW gZwRry8O4+xct12iHSL3bRla3BiEu1IC3n/AliLJ+Ypx+I9D2zETNRPr+kEl8qk8N7HP 4VyNQ58hHW/zRpCLrCZ5pSmxC/OsmGOBl0wUi0Rpe/l6OY+3KylYVFOmcMe2inM2PjBL LXSu/CvvLhRedh6B+yuYFjHIXkS1d1GWEVDbhIt68n0JAOaaeI+EWYoH2Z/fvEaREL/3 Cf0w== X-Gm-Message-State: AOAM530gokCVf9TDnoaHHWf3+afexg1mcb5VB7ZEo+Ex7j1/kb6yE+Dv s0HvyQ+NSQ70q96zREsRDuUX/q4nT81LQ3kANm8= X-Google-Smtp-Source: ABdhPJxxeMn9Qr9B0E8dimHoQFKvjG2A3/nGNbCPgeX1mUeVgikSYAYcDZLKYb84nELwIVXbZE0CXsiFHjc5i78IW8A= X-Received: by 2002:a2e:a54d:: with SMTP id e13mr8127765ljn.267.1631861720335; Thu, 16 Sep 2021 23:55:20 -0700 (PDT) MIME-Version: 1.0 References: <20210914190919.1728320-1-siddhesh@sourceware.org> <9d0f8dcc-35d4-d87a-b3b0-c006fdfe482f@sourceware.org> <877dfhp1lc.fsf@oldenburg.str.redhat.com> <0002ae3d-8957-2e3f-4fb3-298de3304ad2@redhat.com> <874kakjt2p.fsf@oldenburg.str.redhat.com> <08ca98e1-b141-b31f-2743-bd348cdd359d@sourceware.org> <87lf3vj243.fsf@oldenburg.str.redhat.com> <87fsu3j1g6.fsf@oldenburg.str.redhat.com> In-Reply-To: From: David Abdurachmanov Date: Fri, 17 Sep 2021 09:54:44 +0300 Message-ID: Subject: Re: [PATCH] ld.so: Remove DL_RO_DYN_SECTION To: "H.J. Lu" Cc: Florian Weimer , Siddhesh Poyarekar , GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 17 Sep 2021 06:55:25 -0000 On Fri, Sep 17, 2021 at 7:12 AM H.J. Lu via Libc-alpha wrote: > > On Thu, Sep 16, 2021 at 9:01 PM Florian Weimer wrote: > > > > * Florian Weimer: > > > > > * Siddhesh Poyarekar: > > > > > >> On 9/16/21 11:33 PM, Florian Weimer wrote: > > >>> * H. J. Lu: > > >>> > > >>>> No. Relocation of vDSO dynamic section is done by elf_get_dynamic_info. > > >>>> Here is a patch to remove the hack for vDSO. > > >>> I have concerns that this does not actually work on MIPS. What > > >>> happens > > >>> if the object has a single RWX LOAD segment? What kind of flags will > > >>> the link editor set on the DYNAMIC segment in this case? RWX or R, RX? > > >>> I suspect it will be RWX, which means that we actually need the special > > >>> case. > > >> > > >> The DYNAMIC segment flags will be based on .dynamic, which is > > >> read-only for MIPS. > > > > > > Right, as far as I can tell BFD ld does not copy the W bit to the > > > DYNAMIC segment even if it is located inside an RW LOAD segment. So > > > unless there are old binaries floating around which were linked > > > differently, the change should be correct for MIPS, too (and likewise > > > for RISC-V, although I did not check that). > > > > *sigh* > > > > I checked riscv64-linux-gnu-rv64imafdc-lp64d now, and binutils BFD ld is > > actually inconsistent with glibc there. There, DYNAMIC is RW: > > > > LOAD 0x0003f0 0x00000000000003f0 0x00000000000003f0 0x0001c0 0x0001c0 RW 0x1000 > > DYNAMIC 0x000440 0x0000000000000440 0x0000000000000440 0x000170 0x000170 RW 0x8 > > > > So libphobos and others would have to change if we adopt H.J.'s patch, I > > think. With it, RISC-V would be just like all the other non-MIPS > > targets. > > > > Glibc is wrong here. My patch will make it correct. > > Here is the updated patch with the new commit log. Back in 2019 I tried to remove DL_RO_DYN_SECTION for riscv while working on libphobos as it was a copy & paste mistake during the initial porting. IIRC there was no way in libphobos to dynamically check for glibc version and do different things. https://github.com/gcc-mirror/gcc/blob/master/libphobos/libdruntime/gcc/sections/elf.d#L763 Sadly the change was reverted back in the same 2019 as ABI change. https://sourceware.org/bugzilla/show_bug.cgi?id=24484 david > > -- > H.J.