From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by sourceware.org (Postfix) with ESMTPS id 903D13858010 for ; Mon, 22 Jan 2024 18:46:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 903D13858010 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 903D13858010 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705949172; cv=none; b=nkIE8WDuWaQQ0+I6VccNfSrD8mQBReKVfjqczNH6fNzzTBOkudlhSkb933TzMQEOF+0o3uUUxQARYb+U2ntTFyQDT4K3jU18fd5gnnNBQI5jT8OlmUdCngOyOUIyz9XmZYNOK8zwW9IKIyFRLpt31S8b9zJk0RC83J+woQSnJbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705949172; c=relaxed/simple; bh=WPm60Qj+6rJEoClfwrEiVU5LQFfNawbzGCy+8WGSXTI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=gF5FlXrGG0RUzQbsaCxqaeDBs1uaR2m6lDrLXxvGdNcT0A3VtITtANB6S4YMVrY3Dii06LrE3r53/UfudiL4lR7zHgrBMdIBjKM2DLKAC/esEyHJBLW5Xhw+/4cQ0Ak3Kpr9COQTwD3SAk8+/pXxsRKXeziUxjC/PzzXKdWUAmY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-dc256e97e0aso2075611276.2 for ; Mon, 22 Jan 2024 10:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705949170; x=1706553970; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xd/HZ+OZ3CHK/Bh5LDap1pd/sEP5ng1zCBg5car9uFs=; b=XtTwlQoDFygDhlefuJTRAlTCc/I+3qMyraEbflW+L2Bcjb4EjbMFTcwHEZyl/HALVk mEElbKYa4Ay94lZuSfbYKAGn7deCm3OCG9eAnIAujB+Z/qnNig2Ul/eyUwFB7lPee0JI SrZhObWlyyS6n4SSFz4MOSNplzIusl2Tbq1kYlMOswX4J4kBg61Ba0anpFHYdn+eZJUR P7EHPTUcFZRNaxNe/Qwq8y5fy3cTNMSKqSvif1qcKhBGJDProVHSwdRb7GZAsqcNtffN ubY1Z+zKq++fMb/t+OqTzAy35F0/mm9ZnbOMlFoXKlqyfS/+5yLHVyjIl9dZ0Ti6l2TV ooSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705949170; x=1706553970; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xd/HZ+OZ3CHK/Bh5LDap1pd/sEP5ng1zCBg5car9uFs=; b=IewiHzNz6tcP1BwsRYKUYcNHOctBctuIY9MoqEIUX84j/VcwHxcV2axg393UWjtnm1 EzHQRKWi4IqVlGpq9xkpn07VK5hGUos6DEUicBSaqcr/NHGgv2NF0JsnsLvbUQ/T5wKv fc7MCSXZug0YhJtROyZl9UD+DTdTYGG1lPcWdtYA7Q7IT72INcSQW6erdpYTJPSdMvV8 7xPjGpu96dg/pq75fHn7bifBg9mBkKJ1rD+TOiaEc3qlQlluQCfhWjNRck3pi5c9i1cC J3V7y9rNdMWDkZI2+02RE3HrgIGgr9Rhl6HeJgm+wBjzWb8iIpRgpL7JlyINvKns27hE mMYQ== X-Gm-Message-State: AOJu0Yx5nni2rsPgXLFYnB/+qdh7J/Weq0vcAk64h9Ji8LQ2sRlh0OCv NRMXK4NfM2HaxbyD1VA2U7FaklSGsraBDcKzI4GDDNdyZdGZ8qykMjid0FRfPlXaTz+EDa74PA8 Pev2FaAyTMtMZJuGEkRh4uouxKhE= X-Google-Smtp-Source: AGHT+IEb7atHHCBJJKmbXNCUlGeYL7Uyzekp1SWZv87vMhdkTiwIUD3wC2sDxwdI/kuyrsNEH1pxIyHShSoxRLrY6Kc= X-Received: by 2002:a25:8b8c:0:b0:db5:4ae6:1605 with SMTP id j12-20020a258b8c000000b00db54ae61605mr1995666ybl.65.1705949169900; Mon, 22 Jan 2024 10:46:09 -0800 (PST) MIME-Version: 1.0 References: <20240119194552.1255481-1-hjl.tools@gmail.com> <20240119194552.1255481-2-hjl.tools@gmail.com> <038d66e4-e85c-4ca0-822c-c18a1cc6edd0@suse.com> In-Reply-To: From: "H.J. Lu" Date: Mon, 22 Jan 2024 10:45:34 -0800 Message-ID: Subject: Re: [PATCH 1/4] ld: Add --text-section-ordering-file FILE To: Noah Goldstein Cc: Jan Beulich , Fangrui Song , binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3014.9 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,T_SCC_BODY_TEXT_LINE 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: On Mon, Jan 22, 2024 at 10:22=E2=80=AFAM Noah Goldstein wrote: > > On Mon, Jan 22, 2024 at 12:52=E2=80=AFPM H.J. Lu wr= ote: > > > > On Sun, Jan 21, 2024 at 11:37=E2=80=AFPM Jan Beulich wrote: > > > > > > On 20.01.2024 00:15, Fangrui Song wrote: > > > > It is a shame that the new feature only applies to .text . Data > > > > sections and other code sections should be reorderable as well. > > > > > > I second this remark. In fact I wonder why it is that text needs > > > > The perf data usually provides guidance for text section layout. > > > > > treating specially here. Can't the option just be > > > --section-ordering-file and then permit covering all kinds of > > > sections? > > Another issue with this approach is that it won't work for custom > linker scripts (because the `INCLUDE` of the ordering file has > been manually inserted in the defaults). Good point. I updated the documentation with This option is supported only for default linker scripts in ELF and PE COFF linkers. > A different approach for this patch that may alleviate both concerns > (work for custom linker scripts + for arbitrary sections) would be to > update the logic of `section: NAME` in `ldgram.y`. We shouldn't do it for linker generated sections, like .plt and .got. > We could insert the script contents upon entering any new section. > > This might blowup link time (if a link script is inserted at each section= ), > so we could add another auxiliary option to specify which sections > the config script should apply for and make it default to something like > `.data` and `.text`. Sounds like a good improvement. > > > > It requires much bigger changes to ld. > > > > > > -- > > H.J. --=20 H.J.