From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by sourceware.org (Postfix) with ESMTPS id B090F385AC0A for ; Thu, 3 Feb 2022 20:04:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B090F385AC0A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f44.google.com with SMTP id ah7so12091143ejc.4 for ; Thu, 03 Feb 2022 12:04:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version; bh=mNk1+d/xOBPUWh183wNjej5bZcKgjYP45MqtmmKZ78c=; b=rx3K/etWXD8pzOegdNnQbXdk/B2JlR5H/LtFtJBVXQGwIXXq0ECpQtKxaivosRelLL bwshUE1piU7KIsv2oOgjH8LqnkbAcKWtgDTYVoXoWqAOdFk1Oj08PsSjgJxpsSelCVvs VCm0cyHRc3J1/I7JdVIzPxWqngoa6zzoT286n6bE+JZe8/1QcX1zm+IUj/DrcTpWNt54 AX7nKHuXlrdMwuzLz8HK/d9tpBRsFgPSNsDrH7YfQ0TdSz8vKhz+7vhdcJmN88fwTBOw ClKTlywNUpLxJF8DqhH7C6A6i+D/jMrkiN49OlpMddDAmnZd4kQFOuVX4UD0KzVlbIPK TgWA== X-Gm-Message-State: AOAM532LgPoAaVU9lhOX59XAs0qINYWk+V25HPEquOBZulDvAGb3RCRE bzknBFhwDBCQDEfKZNsXmIA= X-Google-Smtp-Source: ABdhPJyA8H9dpje/UAxb8/kcP3yMHrhBhQCNppLvgRKiWHX8fOEzA0rUANcP8OzKyUwI4/Nsxvby1Q== X-Received: by 2002:a17:907:948c:: with SMTP id dm12mr32230376ejc.770.1643918673489; Thu, 03 Feb 2022 12:04:33 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:df86:cebc:8870:2184]) by smtp.gmail.com with ESMTPSA id e19sm15989482ejl.225.2022.02.03.12.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 12:04:33 -0800 (PST) Message-ID: <5483e1b249b67e143c540362213625cf1dccaefb.camel@debian.org> Subject: Re: [PATCH] ld: Support customized output section type From: Luca Boccassi To: Fangrui Song Cc: Nick Clifton , binutils@sourceware.org, Alan Modra Date: Thu, 03 Feb 2022 20:04:28 +0000 In-Reply-To: <20220203194656.ljthsfag5chdzadb@gmail.com> References: <20220202071044.1480421-1-maskray@google.com> <20220202183206.fhnivs3kb4ntnkmp@gmail.com> <20220203194656.ljthsfag5chdzadb@gmail.com> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-9VDXpJ9JGaCMTdovkQoR" User-Agent: Evolution 3.42.3-1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, BODY_8BITS, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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: Thu, 03 Feb 2022 20:04:36 -0000 --=-9VDXpJ9JGaCMTdovkQoR Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2022-02-03 at 11:46 -0800, Fangrui Song wrote: > On 2022-02-03, Luca Boccassi wrote: > > On Wed, 2022-02-02 at 10:32 -0800, Fangrui Song wrote: > > > On 2022-02-02, Nick Clifton via Binutils wrote: > > > > Hi Fangrui, > > > >=20 > > > > > The current output section type allows to set the ELF section > > > > > type to > > > > > SHT_PROGBITS or SHT_NOLOAD. This patch allows an arbitrary > > > > > section value > > > > > to be specified. Some ELF section type names are supported as > > > > > well, > > > >=20 > > > > Thanks for the patch submission.=C2=A0 I am regression testing it a= t > > > > the moment > > > > but in the meantime a couple of things stood out for me: > > > >=20 > > > >=20 > > > > > +@item TYPE =3D @var{type} > > > > > +Set the section type to the integer @var{type}. For the ELF > > > > > output > > > > > +file, some type names (e.g. @code{SHT_NOTE}) are also > > > > > allowed for > > > > > +@var{type}. > > > >=20 > > > > Rather than having users guess, it would probably be best to > > > > list which > > > > type names are supported. > > > >=20 > > > > Also it is probably worth documenting that it is the user's > > > > fault if they > > > > set the section type to something which has special semantics > > > > (eg SHT_GROUP) > > > > but then they do not also arrange for whatever necessary > > > > support that feature > > > > needs.=C2=A0 Something like: "it is the user's responsibility to > > > > ensure that > > > > any special requirements of the section type are met". > > >=20 > > > Thanks for the quick review! Adopted the wording and the change > > > below. > > > The new patch is in the attachment. > > >=20 > > >=20 > > > For SHT_GROUP, I think it is useful to support SHT_GROUP as well. > > > I > > > actually did an experiment last night but SHT_GROUP led to an > > > internal > > > error. There may be some issues that need to be fixed to use the > > > SHT_GROUP feature. > > >=20 > > > >=20 > > > >=20 > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cas= e type_section: > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 if (os->sectype_value->type.node_class =3D=3D > > > > > etree_name > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && os->sectype_value->type.node_code =3D= =3D > > > > > NAME) > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0{ > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const char *name =3D os->sectype_value- > > > > > >name.name; > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (strcmp (name, "SHT_PROGBITS") =3D=3D = 0) > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 type =3D SHT_PROGBITS; > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (strcmp (name, "SHT_NOTE") =3D=3D= 0) > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 type =3D SHT_NOTE; > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (strcmp (name, "SHT_NOBITS") =3D= =3D 0) > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 type =3D SHT_NOBITS; > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (strcmp (name, "SHT_INIT_ARRAY") = =3D=3D > > > > > 0) > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 type =3D SHT_INIT_ARRAY; > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (strcmp (name, "SHT_FINI_ARRAY") = =3D=3D > > > > > 0) > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 type =3D SHT_FINI_ARRAY; > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else if (strcmp (name, "SHT_PREINIT_ARRAY= ") > > > > > =3D=3D 0) > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 type =3D SHT_PREINIT_ARRAY; > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 else > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 einfo (_ ("%F%P: invalid type= for output > > > > > section `%s'\n"), > > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 os->name); > > > >=20 > > > > It might be worth adding SHT_STRTAB to this list, as I can > > > > imagine some > > > > weird sceanario where someone would want it. > > >=20 > > > Added. > > >=20 > > > >=20 > > > > Also - given that this is a new feature, there really ought to > > > > be an entry > > > > for it in the ld/NEWS file. > > >=20 > > > Added. The NEW entry is for 2.39, but feel free to port it to > > > 2.38 if > > > you think appropriate:) > >=20 > > Hi, > >=20 > > I tested this patch, it doesn't seem to allow combining multiple > > attributes. Tried both in the same brackets and separately, eg: > >=20 > > .note.foo (READONLY) (TYPE=3DSHT_NOTE) > >=20 > > .note.foo (READONLY TYPE=3DSHT_NOTE) > >=20 > > Could you please send a new revision that fixes this (no opinion on > > the > > syntax), so that we can use it? Thanks! > >=20 >=20 > It doesn't, as I am not sure the combination is useful. I understand you don't like it, but as I've already explained again, and again, and again, it is needed, and frankly I'm getting exhausted. If you don't want to update your patch that's fine, it's no problem at all, I'll send a follow-up myself if it gets merged. --=20 Kind regards, Luca Boccassi --=-9VDXpJ9JGaCMTdovkQoR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEErCSqx93EIPGOymuRKGv37813JB4FAmH8NUwACgkQKGv37813 JB4W2A//dyWRSUh9erON3slEVc/s0I24Fg7VQgWgJfwskUj1zKRcKH1EegGKYBO9 m+Afduqv1lNM3DNtMwTVmhz6on++JuOLbO3bpLEYXqOUYS9C8qMCLt/zyQ3Ug4ic mN3Ym9VD4tdA9vqyJawagRd0mToRvPX5cf6uhuuYuRb6VbD6tSWLMjkcRHwg+bry 3M66NfHvHKmefL7NQyTOUt0zTJSvgswsw74k+4Bo4K32EVjZWHVcHdPuNWyUseFU AnScWs9ICPBZdBqK6jTW/h+pwt9Ev2vFKCjPdYhj1dKvHU4sOOrNMGd/gnWxnpsh 6FtUUakYOCvbhYib5gVBrbMjN9EkN80BWOmM2O0vbXuWRWU51GURY/XV+/lnFVxQ QC7dsGvB1sEXs917w/+KgBtzcUk71pZdQrLG1JzSaNGnBA2OHcokdEPvtalFDN8t 8+upMYe5kGxZpyccTHJ+tIYacZJ05xz9xf2ToMg/1o0d25QFWEZ6i4HTtlOPtzbC K0HqMEJloI90cjvsvz3GiaX49nwh6UD1JIEbYThpgZLB1ODrvNlqz4V1tJVlaZMv ylJfJzzIcryIROg9CcDi+SgDGdTXNuhqQhNddrvEPxMjJgkkiHJNTgEXLEXKZXKa BDiD5zPV4q7ue3VCd9Xf/m6aW6Wmg8czYhwezINNeypfr3kEXKk= =AsZP -----END PGP SIGNATURE----- --=-9VDXpJ9JGaCMTdovkQoR--