From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 943EA3858D32 for ; Fri, 10 Mar 2023 17:57:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 943EA3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=emagii.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emagii.com Received: from smtpclient.apple (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id EE31F1205C8; Fri, 10 Mar 2023 18:57:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emagii.com; s=default; t=1678471025; bh=WrLSjCmwrKn/mgB35Emt5YJTD6vKpttrMnwzc/XqhrA=; h=From:Subject:To; b=Zh6c2bQqyowt+jgkHAlUja4CIils19yAUnXjjlKS5h56ke8lw345noZ5JUJ0vTVNb Reap/oZhcnSKGY96KHCiqB7Imi5tR7krSJy93AfZ6siJ2dx2q+ZwbYls/I7B9AIqKa Z+FhtLmiyLLzl5NFXvfRNGGEJnzbYBakYW1N0nvg= Authentication-Results: emagii.beebytevps.io; spf=pass (sender IP is 84.55.68.216) smtp.mailfrom=binutils@emagii.com smtp.helo=smtpclient.apple Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Ulf Samuelsson Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v1 0/7 SECTOR: Support aligning to flash sector boundary Date: Fri, 10 Mar 2023 18:57:00 +0100 Message-Id: <95D14810-3DEE-44ED-B071-72BC8C3C3AC0@emagii.com> References: Cc: binutils@sourceware.org, nickc@redhat.com In-Reply-To: To: Michael Matz X-Mailer: iPad Mail (19F77) X-PPP-Message-ID: <167847102479.395227.14547836121245574296@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MIME_QP_LONG_LINE,SPF_HELO_FAIL,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Since the proposal defines the begin, end and size of a sector as symbols, you can do already today. . =3D ALIGN(=E2=80=9Dbank00#04#size=E2=80=9D). Right now, the symbols are defined late, but that is easily changed. Best Regards Ulf Samuelsson > 10 mars 2023 kl. 18:31 skrev Michael Matz : >=20 > =EF=BB=BFHello. >=20 > On Fri, 10 Mar 2023, Ulf Samuelsson wrote: >=20 >>> . =3D ALIGN(TOSECTOR) >>=20 >> I considered it, but came to the conclusion that it opens a bag of worms.= >>=20 >> To fit this into the grammar, TOSECTOR (or maybe just SECTOR) >> needs to be a valid expression, returning the size of the flash sector >> where the location counter is. >>=20 >> Since expressions are available everywhere, you run into situations >> where it really does not make sense for "SECTOR" to have a value. >=20 > So, make SECTOR an expression taking an address as well. Call it=20 > SECTORSIZE and make it return the sector size for the given argument (an=20= > address, so that 'dot' can be given in output sections), or 1 if no sector= =20 > is associated with the argument. Then your alignment expression will=20 > become >=20 > . =3D ALIGN(SECTORSIZE(.)) >=20 > and SECTORSIZE now _can_ make sense in other than output sections (when=20= > you for instance give it, say, a symbolname defined elsewhere in an=20 > utput section). >=20 >> To create an function which collapses 100+ statements into a single=20 >> expression may stress the expression evaluator in unpredictable ways. >>=20 >> Have the linker been tested with 100-200 lines+ expressions? >=20 > Yes. Such thoughts shouldn't prevent an orthogonal implementation of=20 > features anyway. You can also open-code the implementation of SECTORSIZE=20= > with a helper routine, not resorting to linkerscript expressions at all,=20= > if you worry about performance of that. >=20 >> The alternative that I could consider is to add it in the Output Section=20= >> Description There you can specify ALIGN_WITH_INPUT which has a similar=20= >> syntax as ALIGN_SECTOR so alignment is specified either using an=20 >> expression or a special keyword already today. >=20 > I think having it available as expression to be used in ALIGN (or other)=20= > expressions is the better choice. >=20 >=20 > Ciao, > Michael.