From patchwork Fri Jan 19 19:45:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 189664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp1245645dyb; Fri, 19 Jan 2024 11:46:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLtUNI4IE3RZHPDiVmhysHJGWMVrE6hA0hJCO7InNXtbsAUjZfydd9nZS8oFXVFR6Mmr+o X-Received: by 2002:a05:6358:5924:b0:176:227b:8a83 with SMTP id g36-20020a056358592400b00176227b8a83mr228264rwf.40.1705693572042; Fri, 19 Jan 2024 11:46:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705693572; cv=pass; d=google.com; s=arc-20160816; b=xSWv2VVu0uMXpPTqeRDEVz2KE7Hp5XcrIEJ1EaVlKhSHKEv/pTcZs0kgxRw60MLHGG mVxThhgobWo8cFUQm8xXXPiTO1Ez7hiA/2US/gdBOFpHbCSp4BuQeH7YGhSmRwaBy1AE bV9cjtrIi8VME5uZh/0/u6wBzKhle0Lk1jKK6VX7B3RLr6Z6bIsa3Fq6dQNGKg7jlpg+ HPCKqxy1U+REzWTjpdjMk0m2arJ/CNN/wDTKq6oO93WUQCip7HS7HAZLT9pejaS+JuMr Ef8lYitgaTbgMl+lCua4xxpDlUAUI8fThSc8mDC982662ic4EmnSha6YRHofUvYJTV6x mLVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=/xveZzabHWfIPuR73+/NXRfYOpF7WGKeVxb6u6saKKo=; fh=I4TDTPfdhpJth25vq3MR3x6A2ccRZ5VQhtbAuQn+ryM=; b=q6jLud+Sqkl5+zP48J414BEC+/I5zrb3Pjuq6OOdOciF4s62+MVvUI8NZxmQ35zbnC blyjQxfw8+34yW7uU4YxvFZS0NQHra+B+XxJbYq7hOaad8wax7gX5+sAhMxwkFlXyh4c 45wVSEvdvl4mKKk/zrXc7oHg8/6/Ew7Fbb9LsysrV+0wXuD8gVW3YvtP5t1EwOXLPV5I B3M5MQ5mxFEOnjZF7lheTiqabv9KhE4Olys2zUKjSWFcWf9B8ULZcjz578cm0LcE84yx 52vsUkfGxAJoD3paglBfJHHWfiT1u/le5WEZccKVfLXdydMOj75IfPKnlcZxR0fu7bYE Fk1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bEAwJ3n7; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id v2-20020a0cdd82000000b00683699ff517si1943500qvk.345.2024.01.19.11.46.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:46:12 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bEAwJ3n7; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88C1D3858C2D for ; Fri, 19 Jan 2024 19:46:11 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id C1E853858C33 for ; Fri, 19 Jan 2024 19:45:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C1E853858C33 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 C1E853858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705693559; cv=none; b=T/V6EmMyd31L7sL3g8cNgbPvjyajhwo7OcZNJeMmcqcrpGPjvIO83jc8VQq9WHI3+cv/JsoZC3KLtBfcAPQ1a4U+LXAWbQw4sphL2gdfRf62Z01Elu+ibdLa7TIdJDZ+374AvfLv+mLxtE0SledYNCxXz6bqWae/B49EIIcR9xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705693559; c=relaxed/simple; bh=SYIE1jHi1b+MG75+0veaTsPPTaFcK7u73ZwBJcxBzaE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=J2bg6l53KlxYscEftwLLW6eKfg5yqV3oNsif4D4V+i65lOztise6JsJvUajgWWcxWhhF3+Jgm6/184NMOgDKkzP/yqBGXdUQmKBUipT2oCjGaytiej8QilLjVtfib1umKsBuSzYrnwvCye/XXh1S0Pel6euqr5ABOrSG5opzRVw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5cf495b46caso728865a12.1 for ; Fri, 19 Jan 2024 11:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705693555; x=1706298355; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/xveZzabHWfIPuR73+/NXRfYOpF7WGKeVxb6u6saKKo=; b=bEAwJ3n7LUeyDxDcVj+sCb/7RK0Usrt9PYt3PVWVZQEOJ/GEZZJG4nixMfUHihfyhq GvOJ173QvnHmgxHPGfVdvZYfZB+X2azqsIoDR9/yqiVg8sFfmAdkH6lhbCatINoMM/1I QDoP6fhg2cNvpt2mt5D9fC8MlJ4dRKw1UoDkhcI4zsSnwZKLX8MOJGC78mfSMuQVdeYD aVGDzrtq1TjtCO0pZAmewdf7+ZoLPWmYVXVxi/QjmKGjc5NzBOFl10g7MuCyZzqrOiho azkPZSX/gDwB7m62NmUAIjr/iY9cLi96KjJdMY0IIfezAZsvlCMNeDfJNCzIcu+qsPUt vGOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705693555; x=1706298355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/xveZzabHWfIPuR73+/NXRfYOpF7WGKeVxb6u6saKKo=; b=XCE3G1C8DpAwkqAENjdScYr0UVzBd4J9/M4NLwazR+vk0TFhAAetTgp927QBmWgWJS GFbA5pem/oxBjSsT5T3+2ihzGBOX2KXjLG8c5IJ/VLjqywftdAAlV0STAUzSDMS5WPRz x+RZtyg7T/DSDzeTTNAYtxERViR/dGsjciouMjaK+c3D1DIfBRdMzjLFh/w1TXLioq1+ PsfeBbOGHp/JjCe5Kn1u3f7xvjr4IvXoPO0HW7W+QtDclwy4XG1odw5fm8ZwZF1OEc/M uj7uYmaMNkJ5oAleFdAES56wL0dKfdagAgjqN08rwP05EIvIlrRwADttMEOGx+BMyuI3 boIg== X-Gm-Message-State: AOJu0YzD5nt8A6XQGYwkMPQbZ74HpUIVNwlurLjihBJmKCYn5oF9YDss MX3UNN0a//TymzUTje1pCgdhatDjkffspzwZP0k4UrJ++uzbwV/sXdDspAQf X-Received: by 2002:a17:90a:ae01:b0:28c:be2e:a676 with SMTP id t1-20020a17090aae0100b0028cbe2ea676mr234215pjq.53.1705693554750; Fri, 19 Jan 2024 11:45:54 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.168.9]) by smtp.gmail.com with ESMTPSA id j24-20020a17090a7e9800b0028cbfdbd804sm4423755pjl.45.2024.01.19.11.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:45:54 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id CECD07403BE; Fri, 19 Jan 2024 11:45:52 -0800 (PST) From: "H.J. Lu" To: binutils@sourceware.org Cc: goldstein.w.n@gmail.com Subject: [PATCH 3/4] ld: Include the text section order file in PE COFF linker scripts Date: Fri, 19 Jan 2024 11:45:51 -0800 Message-ID: <20240119194552.1255481-4-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240119194552.1255481-1-hjl.tools@gmail.com> References: <20240119194552.1255481-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3024.2 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, 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 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+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788549342852013209 X-GMAIL-MSGID: 1788549342852013209 Include the text section order file in PE COFF linker scripts and enable --text-section-ordering-file tests for PE COFF targets. * scripttempl/i386beos.sc: Include the text section order file. * scripttempl/i386go32.sc: Likewise. * scripttempl/mcorepe.sc: Likewise. * scripttempl/pe.sc: Likewise. * scripttempl/pep.sc: Likewise. * testsuite/ld-scripts/text-order-1a.d: Remove target. * testsuite/ld-scripts/text-order-1b.d: Likewise. * testsuite/ld-scripts/text-order-1c.d: Likewise. * testsuite/ld-scripts/text-order.exp: Only run for ELF and PE COFF targets. --- ld/scripttempl/i386beos.sc | 1 + ld/scripttempl/i386go32.sc | 1 + ld/scripttempl/mcorepe.sc | 1 + ld/scripttempl/pe.sc | 1 + ld/scripttempl/pep.sc | 1 + ld/testsuite/ld-scripts/start.s | 2 ++ ld/testsuite/ld-scripts/text-order-1a.d | 1 - ld/testsuite/ld-scripts/text-order-1b.d | 1 - ld/testsuite/ld-scripts/text-order-1c.d | 1 - ld/testsuite/ld-scripts/text-order.exp | 3 ++- 10 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ld/scripttempl/i386beos.sc b/ld/scripttempl/i386beos.sc index 6c512e67760..cc3d737b21c 100644 --- a/ld/scripttempl/i386beos.sc +++ b/ld/scripttempl/i386beos.sc @@ -60,6 +60,7 @@ SECTIONS { ${RELOCATING+ __text_start__ = . ;} ${RELOCATING+ KEEP (*(SORT_NONE(.init)))} + ${RELOCATING+INCLUDE config.text_section_ordering_file} *(.text) ${R_TEXT} *(.glue_7t) diff --git a/ld/scripttempl/i386go32.sc b/ld/scripttempl/i386go32.sc index 9b992279e4e..3a229319988 100644 --- a/ld/scripttempl/i386go32.sc +++ b/ld/scripttempl/i386go32.sc @@ -34,6 +34,7 @@ ${RELOCATING+ENTRY (${ENTRY})} SECTIONS { .text ${RELOCATING+ ${TARGET_PAGE_SIZE}+SIZEOF_HEADERS} : { + ${RELOCATING+INCLUDE config.text_section_ordering_file} *(.text) ${RELOCATING+*(.text.*)} ${RELOCATING+*(.gnu.linkonce.t*)} diff --git a/ld/scripttempl/mcorepe.sc b/ld/scripttempl/mcorepe.sc index 3262102e85e..13dc5b1c89e 100644 --- a/ld/scripttempl/mcorepe.sc +++ b/ld/scripttempl/mcorepe.sc @@ -66,6 +66,7 @@ SECTIONS .text ${RELOCATING+ __image_base__ + __section_alignment__ } : { ${RELOCATING+ KEEP (*(SORT_NONE(.init)))} + ${RELOCATING+INCLUDE config.text_section_ordering_file} *(.text) ${R_TEXT} ${RELOCATING+ *(.text.*)} diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc index 70f5194b02f..b2691e0ef18 100644 --- a/ld/scripttempl/pe.sc +++ b/ld/scripttempl/pe.sc @@ -91,6 +91,7 @@ SECTIONS .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} : { ${RELOCATING+KEEP (*(SORT_NONE(.init)))} + ${RELOCATING+INCLUDE config.text_section_ordering_file} *(.text) ${R_TEXT} ${RELOCATING+ *(.text.*)} diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc index 63039f11574..f35e50c9430 100644 --- a/ld/scripttempl/pep.sc +++ b/ld/scripttempl/pep.sc @@ -92,6 +92,7 @@ SECTIONS .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} : { ${RELOCATING+KEEP (*(SORT_NONE(.init)))} + ${RELOCATING+INCLUDE config.text_section_ordering_file} *(.text) ${R_TEXT} ${RELOCATING+ *(.text.*)} diff --git a/ld/testsuite/ld-scripts/start.s b/ld/testsuite/ld-scripts/start.s index 4d8239479a6..3f646267716 100644 --- a/ld/testsuite/ld-scripts/start.s +++ b/ld/testsuite/ld-scripts/start.s @@ -5,6 +5,8 @@ start: _start: .global __start __start: + .global _mainCRTStartup /* Used by PE targets. */ +_mainCRTStartup: .global main /* Used by HPPA targets. */ main: .globl _main /* Used by LynxOS targets. */ diff --git a/ld/testsuite/ld-scripts/text-order-1a.d b/ld/testsuite/ld-scripts/text-order-1a.d index d6f976f42ad..3aca3d6d5e9 100644 --- a/ld/testsuite/ld-scripts/text-order-1a.d +++ b/ld/testsuite/ld-scripts/text-order-1a.d @@ -3,7 +3,6 @@ #source: start.s #ld: --text-section-ordering-file text-order-1a.t #nm: -n -#target: [is_elf_format] #... [0-9a-f]+ T yyy diff --git a/ld/testsuite/ld-scripts/text-order-1b.d b/ld/testsuite/ld-scripts/text-order-1b.d index 3d6f4fd8d66..c9d83276da6 100644 --- a/ld/testsuite/ld-scripts/text-order-1b.d +++ b/ld/testsuite/ld-scripts/text-order-1b.d @@ -3,7 +3,6 @@ #source: start.s #ld: --text-section-ordering-file text-order-1b.t #nm: -n -#target: [is_elf_format] #... [0-9a-f]+ T yyy diff --git a/ld/testsuite/ld-scripts/text-order-1c.d b/ld/testsuite/ld-scripts/text-order-1c.d index 4166d634606..91f0a6bee4d 100644 --- a/ld/testsuite/ld-scripts/text-order-1c.d +++ b/ld/testsuite/ld-scripts/text-order-1c.d @@ -3,5 +3,4 @@ #source: start.s #ld: --text-section-ordering-file text-order-1c.t #nm: -n -#target: [is_elf_format] #error: .*: nested include 'text-order-1b.t' in the text section ordering file: 'text-order-1c.t' diff --git a/ld/testsuite/ld-scripts/text-order.exp b/ld/testsuite/ld-scripts/text-order.exp index 30cb531137e..2e51fd6f62a 100644 --- a/ld/testsuite/ld-scripts/text-order.exp +++ b/ld/testsuite/ld-scripts/text-order.exp @@ -18,7 +18,8 @@ # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, # MA 02110-1301, USA. -if { !([is_elf_format] && ![is_generic]) } { +# ELF and PE COFF linker targets support input .text.* sections. +if { !([is_elf_format] || [is_pecoff_format]) } { return } From patchwork Fri Jan 19 19:45:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 189663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp1245639dyb; Fri, 19 Jan 2024 11:46:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWInjCfbq03/1n3TlS+fjWP9HSrMI4WkhQ/0Sxck92JLT+9ryC3dsHP3aydR7HqrUcw05M X-Received: by 2002:a05:620a:170d:b0:783:e4e:33ea with SMTP id az13-20020a05620a170d00b007830e4e33eamr659814qkb.71.1705693571668; Fri, 19 Jan 2024 11:46:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705693571; cv=pass; d=google.com; s=arc-20160816; b=uYoWlMv6VR0mswfVTZREJt9Y7ESGizdwGugQRpBoSVPArzOKgqVqjsaUFiaRNfGTBR Fry8d4KC/hbm/no8Aaf4FzBq5PB3gMPVcJghmmOMKFrHrgpiTdr6PxcWKr3T9UCIcCD6 LV7ePuk+OZJTeWSos0UijfYi7nnT4amIE48QZjmC0MYUQ3DX3PgqqY1wSX9zoJFWMx3x c2dDmyj28616BKxg/US38nCWq3JoSH8moL0/9AtgjFu8Zw2KSgIThHcl8d62V4Yoqubk 69Btzv+z21PGYDMCyl4ajk4dGc6ECuXvZFUdbV1+x7mkEdiQNBTxQNiYOX2hm4CnbCzT tl5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=eiRhm/SFhYQSUWcbAheGnWodl8EYmeghEJUA8R94uVw=; fh=I4TDTPfdhpJth25vq3MR3x6A2ccRZ5VQhtbAuQn+ryM=; b=zb5S2FygHpjLdn/a9hKQNnvjcxfoAyR5wdHOr9BP+sVjHMxeKSgLaKikN4u1IgFs5i +cYNZPf09vudzovEyO66IjRzLfxAZ62geN0ZmZXz5Reic42SQHjUbWxt/ha81PcRRH2a YyRne5DSmMw0jkuKCMMjly4SdkhDlRQYOxTzUvdiF9OB1XakQNK8CSmFfCov0V17x7CA mbU49L8ZzR7L1pO1XGWxe1qpHCy8xGZ1V0s4Azf9MaLyhBPbrrwzbzet/bZmpXcbFx/B iVaIvOc9wagQeBzsgrCDCZUaHI9kfTeOZt0iiGD/gqfRqLocvp2PzGmGG8Rj5rXPLXLY EHwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bwuJsVym; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id da32-20020a05620a362000b00783338c59b2si16248740qkb.596.2024.01.19.11.46.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:46:11 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bwuJsVym; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B150385E456 for ; Fri, 19 Jan 2024 19:46:11 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 902443858C2D for ; Fri, 19 Jan 2024 19:45:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 902443858C2D 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 902443858C2D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705693559; cv=none; b=UGqNBBX1y1vPZe2QNkUmx6lld/pHb54zxrE0RhrGsokBVmixArYCmEqnO2RtEATHqa2dZG4+HcIRCfd1Bq/BN7PBo9QKbDwIdGoaS9T/0ROnEFyhOzKnpq346ky+6yR8rHePuqwOpMmbCdO2oscdcEKqpHeyoZkxs3Jj3S6u/FE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705693559; c=relaxed/simple; bh=/l2FZuGeJpU/bk2zl7y9IXgWSIUMTl+bhvmLk3r592o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=w+u8MS+UsqStDfpdi3R9sr/sVlyclNGXzmDntD0mPogbTm7P5iPZsas289abn++IAM4qQr+IbDV0cJpq6NrUhv3XpBuqZx5b/yxnmGIG4y4420TkKi/467q3eU894pu/LwcvuSoVm0YTtmhBjwQXya69CqZ1S1RbROePGgtMgs4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5ce74ea4bf2so830468a12.0 for ; Fri, 19 Jan 2024 11:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705693554; x=1706298354; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eiRhm/SFhYQSUWcbAheGnWodl8EYmeghEJUA8R94uVw=; b=bwuJsVym02DCg37kolc0RYqUn43pyJtKLtgJ/YJHCd9zqYBOA/XxGhTcYd9hF3hH5e L9Y58xKyJgDX79hix9WJOXX9S8KKfHF92DrP7L5QwGbhogvQU2zwapwxko4vHG9rk+Fz uRETFgodZlBvYdtmuI8wvSNCRFOOKD2Agxo9EAFKQhN1yN0BvwxCRHKmM+mVGXPt6MGJ +B7RPmkPVuCmZL/Tk9Uk5J1IAiXlCW39S01ZvXArDNM8711ZdcYSKsGdDZjnN9YiBKQ/ u37PERZavoBJAMoTT3o8FlnuNYAhg45x9lNfk+oWU6Z5mQ3olXwqcsavMjYDAdnvSWw2 2P4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705693554; x=1706298354; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eiRhm/SFhYQSUWcbAheGnWodl8EYmeghEJUA8R94uVw=; b=n1rgSYOyzWhupPasbizp9YkIJfHRUv0/9sZ6RV0n4QqHKLublmp8uyvlv+1fwGpN80 bbr7WWnYOtRsoLZY+PE0dItzLlyQOP2IoACVFtjdZ9FoplCxn4XZ/8wKQrUVjv7A6nmX wS5tLIPrKN1I07XAiJneZ1oW7588SBL6ULWyhao0clxlSy5IVFmj/B9k7GAfjx9uEuu1 xK4Cqkrnj6juIOyq9uA/WodZXSBL/zgyKLmPtj5NKsNJSMOwekWbDZ+houO5/YCzZT2o pNe+NKr+8hbrRQ+L2OGWJK39mJtMYOvH+EzdvSlNwrJFprplbWfwSeD8wpl1dRLTD5oB /YOg== X-Gm-Message-State: AOJu0YzErx64zvoBBQE2969LfqkgkYnWQEOBuen9Bxkh/35RgMaoQStC lXkeBRgQgc6Ul/T/d/08FTJe56uuy+fI1jJAE1LXHyN9yS6j0MGYzIKwCZSW X-Received: by 2002:a17:90a:e642:b0:290:38f2:8a05 with SMTP id ep2-20020a17090ae64200b0029038f28a05mr485761pjb.5.1705693554471; Fri, 19 Jan 2024 11:45:54 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.168.9]) by smtp.gmail.com with ESMTPSA id sn8-20020a17090b2e8800b0028afdb88d08sm4494177pjb.23.2024.01.19.11.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:45:54 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id D9A2E7406A1; Fri, 19 Jan 2024 11:45:52 -0800 (PST) From: "H.J. Lu" To: binutils@sourceware.org Cc: goldstein.w.n@gmail.com Subject: [PATCH 4/4] ld: Document --text-section-ordering-file FILE Date: Fri, 19 Jan 2024 11:45:52 -0800 Message-ID: <20240119194552.1255481-5-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240119194552.1255481-1-hjl.tools@gmail.com> References: <20240119194552.1255481-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3024.2 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, 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 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+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788549342638159118 X-GMAIL-MSGID: 1788549342638159118 --text-section-ordering-file FILE is supported only in ELF and PE COFF linkers which support input .text.* sections. * NEWS: Mention --text-section-ordering-file FILE. * ld.texi: Document text-section-ordering-file FILE. --- ld/NEWS | 3 +++ ld/ld.texi | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/ld/NEWS b/ld/NEWS index c3ebe320e5e..c98570f308a 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -1,5 +1,8 @@ -*- text -*- +* Add the linker option, --text-section-ordering-file FILE, for ELF and + PE COFF linker to specify the input text section order. + Changes in 2.42: * Add -z mark-plt/-z nomark-plt options to x86-64 ELF linker to mark PLT diff --git a/ld/ld.texi b/ld/ld.texi index 4fda259a552..d1bb59202de 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -2541,6 +2541,17 @@ patterns in the linker script. This option will apply @code{SORT_BY_ALIGNMENT} to all wildcard section patterns in the linker script. +@kindex text-section-ordering-file=@file{file} +@item text-section-ordering-file=@file{file} +This option groups input text sections together in the order specified +in the file which contains the list of text section wildcards starting +with @code{.}, separated by whitespace. + +If the @option{verbose} option is enabled, the contents of the text +section ordering file will be reported. + +This option is supported only in ELF and PE COFF linkers. + @kindex --spare-dynamic-tags @item --spare-dynamic-tags=@var{count} This option specifies the number of empty slots to leave in the