From patchwork Mon Nov 11 11:44:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 100749 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BACBC3858C33 for ; Mon, 11 Nov 2024 11:45:21 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by sourceware.org (Postfix) with ESMTPS id CE2B43858D28 for ; Mon, 11 Nov 2024 11:44:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE2B43858D28 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 CE2B43858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731325493; cv=none; b=rhxZdoG/iH9goj/ipdtlY7hxvuxMOCcZ+G0W8sKsbKoIfLd5BIjjZlj+smR5LFkg6pIkp5tyAo8FfXoJqSsbnhSVeeKIUINO10OOobT9CIkelpJrxed6H6AmnA+J8xsJeZwiZuaX8EE22aD4jXgcVcIS2crvWGWLC3CNqRP1w9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1731325493; c=relaxed/simple; bh=CYoxb5+DKPnh3dMCQJbACC6+y8GqM7Gw+98wA4jy9Kg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=bZWstfXufq9SYksroLQrP305taDTA6p6vTuAIu8JBOSFEDspuno6xHGU3IEzIsG29SyA8EogiMlBbe5zpl/R/1NBVhB4jrq4S3RvDBRFNQ05tBH3kbX6oYvxi7c0JmXOUEgjN1Yuj+cCCQOGKQ5OZnhPS1aNrLTe04jqDMWJX4I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-e0875f1e9edso5675762276.1 for ; Mon, 11 Nov 2024 03:44:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731325485; x=1731930285; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lrXFaBWsinGEy6AG48MDV/OmZGvc90ixWKs85Qm/bSQ=; b=GNGRB1ZV7+txCK2r1rR/oI3JJcUtq5XrD2Rebp+pMBkSlKxkYVnfpWQO05Zr8cVoit xkyCS9hWYV1oPjSjPeAaAtH3vXgo5lBsnW+K4R+FWsizpUoPkeDC/PmFy4uRzdocNygf Mi/RWc9v92wFD8Vcp6crGmrsrXqzYPFIihM1QvqoDKsUshfNMe2LHh6JHyWYoondzTLk AYkChOhmckVjJ05/+EVj8vzSuoRdwlL7ri686jjylSdI1pKbPVxzby5jZvLFvjPpLEbD OyExapFdjGHrUvFNJKmYR6jiQeBH8UznDsthlCfzg18GwgoDoPhwZtuAOhRnAmtRuBbg PnEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731325485; x=1731930285; h=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=lrXFaBWsinGEy6AG48MDV/OmZGvc90ixWKs85Qm/bSQ=; b=KiWg0mEwE6XjUeeAv8RGNkzjx31afGEXoSOoj0SALgyX/WshDMI6qf9CryUuk2VPwN MZo2Ridds8zeoM3XM1Zikems6NaBTs2WVTe1hHK/P9T3SrPSERL30kZD8nQ7i3vHad8H FqON/tEy8sT9DYYH5q8nsQQO8wY46+65wLyYAhVsNcGhPN9rkrWV8nXqTXMCj2w1GX4q d6bmid4vUYF/xDQ5S6eAdEz6zHbShEgnLLlo4acUvUTLreVrXiVPeilb8Rykjrd97VyS oC8D4NO+lh4Su5iypDR+cysbNSfQEYW+BabqURXsoyODx7Z/GbLMwHqBuOSGHofYwbGg 9+rA== X-Gm-Message-State: AOJu0YwTNnW6CW1+o+Uu2K1ABA9GeJf2U3NEuiGXf3Utwas3GaNluwKV Kgzglqr0STQTSJMM6pgj0jAQ6rY+dUTpw1mRNBvdwxhqqGMni3OMwgggxgj2HAY8XYbBLwsHieG sDS9TKuyxLhzXkmcWMBeJxvmv5azcKFRbCpUCiq9g X-Google-Smtp-Source: AGHT+IHXw7C+WV80BNO2QEFjXE/5g7dmYhbZIP3maUj5C62cjQnzr1RWnDa5RAm5CqdjN0Ka8ZdKw493nUk3ihOSk8M= X-Received: by 2002:a05:690c:360b:b0:6ea:87dc:49b1 with SMTP id 00721157ae682-6eaddda37famr118793227b3.10.1731325484983; Mon, 11 Nov 2024 03:44:44 -0800 (PST) MIME-Version: 1.0 References: <30dbebec-4fed-4f49-9140-100299138c23@redhat.com> <2bca81a3-039d-4ab1-8fff-47ca8071308b@redhat.com> In-Reply-To: <2bca81a3-039d-4ab1-8fff-47ca8071308b@redhat.com> From: "H.J. Lu" Date: Mon, 11 Nov 2024 19:44:08 +0800 Message-ID: Subject: [PATCH] ld: Move note sections after .rodata section To: Nick Clifton Cc: Binutils X-Spam-Status: No, score=-3016.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org On Mon, Nov 11, 2024 at 7:08 PM Nick Clifton wrote: > > Hi H.J. > > >> I like the idea of moving the note sections into the same segment as the > >> .rodata section, but I also like the idea of linker scripts explicitly > >> handling known sections, rather than assuming that, for example, the orphan > >> section handling code will not change in the future. > >> > >> So how about something like the attached (untested) patch which moves the > >> known note sections from misc-sections.sc to elf.sc ? This should achieve > >> your aims whilst also making sure that (known) notes will always be placed > >> after the read only data. > >> > > > > It works for me. > > OK, please could you apply that patch, together with your test case ? > This is what I am checking in. Thanks. From 6a64b407f5f45657c9578878ace131459700d957 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 7 Nov 2024 12:39:19 +0800 Subject: [PATCH] ld: Move note sections after .rodata section Move note sections after .rodata section so that note sections are placed in the same PT_LOAD segment together with .rodata section, instead of a separate PT_LOAD segment. PR ld/32341 * scripttempl/misc-sections.sc: Move note sections to ... * scripttempl/elf.sc: Here, after .rodata section. * testsuite/ld-elf/pr32341.d: New file. * testsuite/ld-elf/pr32341.s: Likewise. Co-Authored-By: Nick Clifton Signed-off-by: H.J. Lu --- ld/scripttempl/elf.sc | 11 +++++++++++ ld/scripttempl/misc-sections.sc | 11 ----------- ld/testsuite/ld-elf/pr32341.d | 15 +++++++++++++++ ld/testsuite/ld-elf/pr32341.s | 26 ++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 ld/testsuite/ld-elf/pr32341.d create mode 100644 ld/testsuite/ld-elf/pr32341.s diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 6ef93dcc906..0d539fcbd38 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -668,6 +668,17 @@ cat <