From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2070.outbound.protection.outlook.com [40.107.7.70]) by sourceware.org (Postfix) with ESMTPS id BF6983858D35 for ; Fri, 8 Mar 2024 08:24:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF6983858D35 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=ericsson.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ericsson.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BF6983858D35 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.7.70 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709886279; cv=pass; b=Gh5OQgSjX+QXkkEtcRf2epIFY5JF8dC0t2mhpB+2whrbeca63Be6pzCp2UR3VZka5BBxH6lRi7Od+S7lGrfz1i2tkXZvWIFw5MoLOH/TGqpF2JE/1CsinNMlSwuZEqt/pAgxmpi9PGK/XbQyxacYR2XHR5lGr/QhZJEB0UdPzFs= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709886279; c=relaxed/simple; bh=HfD51E40mcoziXiwVd+Vp5RmZeJevKjlecP+WXBBkkY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=j+Pj9qL+kcOO3UEbyYWakqTFHmSvcVKDr+FHwWArStUZb362NnIPqVijGAXbPdzjGHJ8VXwyfGb4pEtNEwdklOKx4Wrfj92wb0Uk6rxLsQutC++3MKWPr30jTbMxajqVPv7JLovg1lNsuaISoiocoJ2QrV6qf/10LjCaiPA6XZM= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aNOOAFSvMpRwPsABXa4PJHVjlX7pRC1jmr5xF1QURf1I1Gmrv7ZaSAoPqdBcPs4l2sXQgEo7nSwEvWSk+8cFjakZbZBdI2LxO13xlDR6PAma39WyuC20flDZM2ioSo+WHc9oG67AxEqMZ98IbkxB+u1iaLB6u4OeE1piQSh/C8fSip8dKP4hMerTREJm/Z0KdJaFD7oga4DfqbUMdK1HJaJLVcd6K2cDIgzkn1PBLjTh5nF4gE8KrPPtq2nxLq7Ko6XwAMX8ZVt4C4ZbatZfCc8QFUDUgRkhLYs+7gP8nqt94k58jJzU73HZv4l8dpE2hS1ee8gXxAYIAeQSjoz5QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=66OQJWmASbwY7KcX3wMQD1yfX8p7YpZxcAb+oaTaFVY=; b=cN8KdvS2Pff09qj4I6lUalJeiRQsSf33/aylhz++gzy+Vxx9QOevqD0qPGU9FyfGi8caK03ol5Xq6zlU/8k4gKphU0pUWtKG0/uq92QwW/tX6iGWmRfOr8xAbXjqYpSQK+Y7p1cf79x5rDAcxsm5J9HiMkHRcXgLkBfnHCwq9eUJQtSoQw0lRkFfBXShGXNTIhREaLFPEYZ4KboWH4hppvr27nlvIRioIYtMelSOwLLp1orSFyTVG8bpQ7BxQITGDUN2GX8UHQ1Bh+1ekhyu0iILBibz8d8VIfZXoeKJeZ6L0EUtDh15B3AeiOGd0j3zGZLVHqfnKJ8UamOOTt+d7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=66OQJWmASbwY7KcX3wMQD1yfX8p7YpZxcAb+oaTaFVY=; b=dNW/V38qkD7AYqck/1v7iO3whZBfbrDsN217by8/fNqAd1ghjwVvRNp0aq8t8mVGvkU5WwZPplbMUjQaZvhjTYJmyVMnvug91A6pVo2pIPGx0DZ8vISLpkv9eOW8lugZ/qSOS1GbkhpXNGmk4R5IBk7TEQquGqOzfmTGhQu6DL/7hhk0gOrVG6rzMOjephBDcXcfOGrZfdMa1MH6b16wdqBtjG/e6KT3xl+N6Tvy8i5YCBC6FpCY/pyIiFdLRLLCy7xizCKoZY1aWPYoxmYEmc5+JrgNX1XWQv9i5d70K5qy7TsIbz1M4duIJk0vUnk2R8vFXZ/ePllWPu8fDLRJEg== Received: from AS4PR07MB8532.eurprd07.prod.outlook.com (2603:10a6:20b:4eb::20) by DB8PR07MB6460.eurprd07.prod.outlook.com (2603:10a6:10:13b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Fri, 8 Mar 2024 08:24:22 +0000 Received: from AS4PR07MB8532.eurprd07.prod.outlook.com ([fe80::9a2d:e299:3b79:ea6a]) by AS4PR07MB8532.eurprd07.prod.outlook.com ([fe80::9a2d:e299:3b79:ea6a%7]) with mapi id 15.20.7362.019; Fri, 8 Mar 2024 08:24:22 +0000 From: Bevin Hansson To: "binutils@sourceware.org" CC: "nickc@redhat.com" , "keescook@chromium.org" Subject: ld: provide /PASSTHRU/ section rule to avoid orphan warnings? Thread-Topic: ld: provide /PASSTHRU/ section rule to avoid orphan warnings? Thread-Index: AQHacTEeqwnMAbJUTUCdNdcmdbQ/bQ== Date: Fri, 8 Mar 2024 08:24:22 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ericsson.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AS4PR07MB8532:EE_|DB8PR07MB6460:EE_ x-ms-office365-filtering-correlation-id: 3888588a-6dc6-4819-72db-08dc3f49288a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mJ3Fg+N5mG2HxGNol74TmB/10GxsggvD8+kEHtQTz4JGjhglLnxUpU8iyWteKDynkjV1T2ARFqRm+v0HxYHvKqUgwr4BaMqBV1fFgWg4EVWxu/m30F21ChQqrFIm7PrcdJ5RR5VlOWx+nbsp6wpLCBDaNJ1cg6bK4l5K3W37UiBwnLCFeBQjc4U9uqBy9+imUhTIzF1Tv7oMrBaCKPurkuqGa6mZ3y7mG+Zk49Jn7aNdUO/R0pm7QqaEnAF6jYGPldzXoK7iM28c7SmweOsJXed2knEohuesugzqUz/kIqVEDViMFyik/fIgiBH7iIyTMSUwOdfFuv0zIxzkXLTiTonnHl28lHjyIDJm9SzpeLYSjsW3UllDbPtE88em+VjiyZDmXaHa8HLg4onkyiZwj9CoyNhMTQSXFoJaNd+nOJSsnp4yVtfO7ihM1CRTP7gqMujCfJv0tuV+shXmvSWeRfhFr1ThDkTgvdm4fId8mQOho04elB34T+B81Ko4EPIneG/cIFTOUCPWzztD4PL1zln+CTEi++i+35uiOH5wfXmJFKnzYHeLnJYsnFucWpcs5tZmLI2MHduC7hZPAsaCgt0SGhHdL10iwyvoy9acjfuziI9HKuvKXywxbWjf3cbREoEeAFV5iEgva+e22Wzq8AMCBB1laWTVV+U/Z6i0Nmx4P4FDPnmps9thxubsxXJNn351+7HB0bclQ25v7dsrYjwN0Jmre1XF2RccsG0Mt2U= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS4PR07MB8532.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?rTHeb0F4hlKYQTDafnytQuDIdi6mKHt3N+A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OZEWYW43WR4h/3qwRuwhvgN+E/j67LnrvftXbuPa4mvyiob+6eM94jcd?= =?iso-8859-1?Q?iweI1Bj218xNOWCl89+pHEFm/G3L6GTb5V++pIxG4xinWqG/g/lqS2fIuK?= =?iso-8859-1?Q?6qEWhQ62xTPNyza9fxwsGnPFZKANN3p2yWNAiK8680V0HaAqyhYuRmd3lS?= =?iso-8859-1?Q?5BV3QhfHtsOHIWQxdIKTua6CVKMPh1E3wq0lbuodDyS09j/09c8bbbcEhI?= =?iso-8859-1?Q?DsyL5XrhEoEihnQJ1t0OTOkYcAu2H34kyXk1rp7KcPSFCbD7DyA/Xp4NJl?= =?iso-8859-1?Q?JgU17CxhtFOWvI0iApUiMGAH5uYTkmJPjblJhn22c1s0/X/hj5NYzSpgfl?= =?iso-8859-1?Q?4TQXHWKlJOMHcNhMJyN3Y5pyqDrZEZxzQCBTvVnWtapL7vUJVSwd0JanAE?= =?iso-8859-1?Q?ErAwzpvMUroPlnGvpWVEElBtu1W3us2F/2AxWMx23OO/iW+KZM3cxND65u?= =?iso-8859-1?Q?3mgPpARqCWtmODuvyZxsPXSuOVGGF++g0F02+1uiIki4ag1SMlzS8+ItDQ?= =?iso-8859-1?Q?URpTdiLh6DcpULhhTJFbyaUmjnPNFEiqJRfQNCQmIdMcwFwo0cX+8jBCZh?= =?iso-8859-1?Q?VzqSAJi5pNTE2JsdTWgVTZvGfGPRhJdGkoAORT016Z0atUYEaQxJ9ms3JA?= =?iso-8859-1?Q?Ol2nk3vp8R+YH4wKNt4J6PSx2YYI+xOIroIseF1zqwJGaDx8+c2dGEhM1o?= =?iso-8859-1?Q?uaE2j/SGiLQYqj1YpsQMOdRek0/7UaDIaa?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS4PR07MB8532.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3888588a-6dc6-4819-72db-08dc3f49288a X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2024 08:24:22.4894 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: EYdS2FwvQCMuo43V0d5AST4OycPd+cJO45js7rQh6dJ7GLC/4eoxn8e+96paLcrivJeQONAvO+o3SwcYOcjQI4JIuBUWMKARbGcbvJJk1Wg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6460 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi,=0A= =0A= We also have a need for a feature like this in lld. There doesn't seem to b= e=0A= much more activity on this, so I'll offer my two cents on the topic.=0A= =0A= > So one way to address this problem would be to extend the --orphan-handli= ng=0A= > option so that it does not emit messages for certain sections. This has = the=0A= > advantage of not needing to extend the linker script syntax. How about= =0A= > something like --no-warn-orphan=3D option which could suppress = warnings=0A= > for matching sections ? Or --orphan-handling=3Dwarn-except-text which wo= uld=0A= > warn for any unplaced section that is not executable ?=0A= =0A= I think that the wildcard flag idea would cover our use case; not the more= =0A= specific option, though. However, I think that having the linker script fea= ture=0A= is a lot more flexible. It lets you express that sections in certain files= =0A= should be preserved, but later match everything of that section:=0A= =0A= /PASSTHRU/ : {=0A= foo.o(.bar.x);=0A= }=0A= =0A= .bar : {=0A= *(.bar*);=0A= }=0A= =0A= This would prevent the matching of the .bar.x section from that particular= =0A= file (since it has already been matched by the /PASSTHRU/), but would still= =0A= allow you to globally match anything with that prefix afterwards. This woul= dn't=0A= be possible with the option approach, since it would only take effect at th= e=0A= end after all of the matching is already done.=0A= =0A= However, this isn't the same behavior as what Kees' mentioned:=0A= > - Therefore for ordering purposes the /PASSTHRU/ section behaves like=0A= > it is "last" in the linker script, regardless of its actual position.= =0A= =0A= But maybe this is simpler to implement in ld than in lld? For the time bein= g I=0A= can't really see my above example as a use case for us specifically, but th= e=0A= need might pop up in the future. I think it's a bit odd to have it in the= =0A= linker script and then not have it behave as other 'special' output section= s=0A= do, like /DISCARD/. That wouldn't be what I'd expect as a user.=0A= =0A= Regardless, I do agree with Kees' point that having this kind of logic in= =0A= the linker invocation rather than the linker script is a bit cumbersome.=0A= =0A= > Or maybe no ordering should be expected and the user gets whatever the li= nker=0A= > decides to do.=0A= =0A= I think this is the reasonable behavior. The order of matches in the block= =0A= shouldn't matter in the same way that the order doesn't matter in a /DISCAR= D/=0A= block.=0A= =0A= / Bevin=