From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 07C6A385840B for ; Sat, 25 Dec 2021 03:04:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 07C6A385840B Received: by mail-pl1-x62f.google.com with SMTP id n16so7622087plc.2 for ; Fri, 24 Dec 2021 19:04:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Nl7LLM9poxT3K6Ga7Ipq8f8z2E2fk4Wg2b6SWBdK9Es=; b=b2iiBTaR9VMq8Qfc+/tBlkrtwIXLHYHp1hiKw2k9t/Tjfz5DBLNW4MDSYCE3pfiqu5 H1G1qSVONwqQg8c9KHnd+K+AuRl+DJgBAGYkBwd7Vu7r9NqfPYU+yIhXSmW5f4b3bUNk fkcfnKvUynQcFIdUZBL4AMuBRBKchdsIrpS3VOpfg+CD46o0u6Ifnv+ULYglAh8Zvzt5 6DEHkDkRAgdVS7XncDFPSWpbZcF1jkh04WrJpRsDMHcfq9uxA+Ebdf0CHRqa6E+DmgXf ZsOqWruJAkk4E2/Xa6ex/wOKgyg1Gz0p8ZQZsWnQkBmr+KoQd9thkZgboIbjcy/yvuj3 8ZOg== X-Gm-Message-State: AOAM533fX9MNOubjJcrZmVCErkCtVK3Ufi8DZen4nzJa0k+0XR+jzRpw Zy0i3SpLS3t52Cz0FzdZ+FQe7KpQIeI= X-Google-Smtp-Source: ABdhPJxQpqV9SNozMlrEKw8TWJUh3bLizk8o0/0XSpiIhFQw+fak9Erqk+c/2S36Sre9wT6cJh6V+g== X-Received: by 2002:a17:902:b189:b0:149:6c45:24c with SMTP id s9-20020a170902b18900b001496c45024cmr2120859plr.21.1640401446186; Fri, 24 Dec 2021 19:04:06 -0800 (PST) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id l22sm10514007pfc.167.2021.12.24.19.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Dec 2021 19:04:05 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id B30B21140F38; Sat, 25 Dec 2021 13:34:02 +1030 (ACDT) Date: Sat, 25 Dec 2021 13:34:02 +1030 From: Alan Modra To: "H.J. Lu" Cc: Binutils , Nick Clifton , Florian Weimer Subject: Re: [PATCH v2] elf: Set p_align to the minimum page size if possible Message-ID: References: <20211215163232.1787673-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3032.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: 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: Sat, 25 Dec 2021 03:04:09 -0000 On Fri, Dec 24, 2021 at 06:50:30PM -0800, H.J. Lu wrote: > On Fri, Dec 24, 2021 at 5:03 PM Alan Modra wrote: > > I don't see a way to change DT_LOAD p_align that is backwards > > compatible, except perhaps using a p_align of zero if the required > > segment alignment (as calculated from section alignment) is less than > > maxpagesize. That horrible hack just happens to work for older glibc, > > but may break other loaders. > > Neither 0 nor 1 work for older glibc: > > if (__glibc_unlikely ((ph->p_align & (GLRO(dl_pagesize) - 1)) != 0)) > { > errstring = N_("ELF load command alignment not page-aligned"); > goto lose; > } > if (__glibc_unlikely (((ph->p_vaddr - ph->p_offset) > & (ph->p_align - 1)) != 0)) > { > errstring > = N_("ELF load command address/offset not properly aligned"); > goto lose; > } Zero in p_align triggers neither of these conditions. Binaries with zero p_align run. I checked. -- Alan Modra Australia Development Lab, IBM