From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 585FE3940830 for ; Wed, 12 Jan 2022 14:15:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 585FE3940830 Received: by mail-pl1-x631.google.com with SMTP id a7so1510591plh.1 for ; Wed, 12 Jan 2022 06:15:20 -0800 (PST) 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=MaxWpl/+v9w4KyDlHV8rOUVfQiW2XEpZe3WFfTT5qAY=; b=40mARP7z6aZ6tlokCqoWOIjaQMlD+vkq4+M0Rr31o3Od/a22ehoPYDxaFJJPm0r7pu ehLJk0bZh38vmxfV27FmULTLFRC2Oz28kxukvOvqBvZwMJndrdt1v7tX89yzEJMSmge0 Pv0Y6gXBJNoxdpN7Ao0IfsPgqM8bGY0rEoHzOc1zbeC3LGKp0BbsuEmNbJCru0b7zPaU ywLHYsMGwdvABXO7caOKz54gLe3U0gFOEUcxe71tspVJxlCIRl8IpI9GJQOa+wcxWet4 IxQWf5YvT/i2n2INcQIrT6c4zKKdGWKHiMI+Q1HlLbyI6+wPaZ7G2bwV3/3WqLRkVi6n cspA== X-Gm-Message-State: AOAM531lKeo96Ru+MZhvCYQdinJSrvJFNS29sOdwqGObXFtHcRCC07ec JRbA2dmyp3yf031jTkLwAcybqmbGUy5y4wWeg7v9cidbqmw= X-Google-Smtp-Source: ABdhPJykY6TZ9BUJG3howROMO204cZGDaJCQHKdbadRtCn3Z/LOHtzgk3mU8SBkFtgCngiRbaIIpg6IHu5kagD/pPcE= X-Received: by 2002:a17:90a:4e81:: with SMTP id o1mr9086448pjh.28.1641996919242; Wed, 12 Jan 2022 06:15:19 -0800 (PST) MIME-Version: 1.0 References: <20220111140634.2250914-1-hjl.tools@gmail.com> <20220111140634.2250914-5-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Wed, 12 Jan 2022 06:14:43 -0800 Message-ID: Subject: Re: [PATCH v3 4/9] ld: Initial DT_RELR support To: Alan Modra Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3021.6 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2022 14:15:21 -0000 On Tue, Jan 11, 2022 at 10:11 PM Alan Modra wrote: > > On Tue, Jan 11, 2022 at 06:06:29AM -0800, H.J. Lu via Binutils wrote: > > Add a -z pack-relative-relocs option to enable DT_RELR and create a > > relr.dyn section for DT_RELR. DT_RELR is implemented with the linker > > relaxation infrastructure, but it doesn't require the --relax option > > enabled. -z pack-relative-relocs implies -z combreloc. -z nocombreloc > > implies -z nopack-relative-relocs. > > Like Fangrui, I think these options should not interact in this way. > -z pack-relative-relocs -z combreloc > -> .relr.dyn for relative encoding, .rel{,a}.dyn for others > -z pack-relative-relocs -z nocombreloc > -> .relr.dyn for relative encoding, .rela. for others > > In other words, -z pack-relative-relocs overrides the place where > RELATIVE dynrelocs go, other dynrelocs are still controlled by > combreloc. I removed the combreloc change. > > --- a/ld/ldlang.c > > +++ b/ld/ldlang.c > > @@ -7699,7 +7699,8 @@ lang_find_relro_sections (void) > > void > > lang_relax_sections (bool need_layout) > > { > > - if (RELAXATION_ENABLED) > > + /* NB: Also enable relaxation to layout sections for DT_RELR. */ > > + if (RELAXATION_ENABLED || link_info.enable_dt_relr) > > { > > /* We may need more than one relaxation pass. */ > > int i = link_info.relax_pass; > > Also, this isn't correct. You should instead arrange for relaxation > to be enabled by the x86 target code. Not every target that > implements DT_RELR will want to use bfd_relax_section. It might be > true that this will do no harm for targets that currently use > bfd_generic_relax_section (that does nothing) but it's still wrong > to turn on relaxation like this. I will push this one unchanged. I don't want to change RELAXATION_ENABLED for DT_RELR since RELAXATION_ENABLED should be false in lang_size_sections (NULL, !RELAXATION_ENABLED); We improve it after my patches are checked in. > -- > Alan Modra > Australia Development Lab, IBM Thanks. -- H.J.