From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smarthost4.atos.net (smtppost.atos.net [193.56.114.177]) by sourceware.org (Postfix) with ESMTPS id 3D9ED3858C2C for ; Thu, 14 Oct 2021 14:10:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D9ED3858C2C X-IronPort-AV: E=Sophos;i="5.85,372,1624312800"; d="scan'208,217";a="278907429" X-MGA-submission: =?us-ascii?q?MDHt1hhgDVPnTJdG1pVK09YPkINXm7/qsQDJpu?= =?us-ascii?q?+2LMpe5QVCgI4x5bAL0H4GLb0W1WpdmwOSoIIOynAzo7hI53ZEtelvAJ?= =?us-ascii?q?WqKZydlD/47SZ325uQBJ63maBlJg7MlhoBYvH2mBjSbeBpru/I3qTW9e?= =?us-ascii?q?uS?= Received: from mail.sis.atos.net (HELO GITEXCPRDMB23.ww931.my-it-solutions.net) ([10.89.29.133]) by smarthost4.atos.net with ESMTP/TLS/AES256-GCM-SHA384; 14 Oct 2021 16:10:44 +0200 Received: from GITEXCPRDMB24.ww931.my-it-solutions.net (10.89.29.134) by GITEXCPRDMB23.ww931.my-it-solutions.net (10.89.29.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 14 Oct 2021 16:10:44 +0200 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (172.16.214.168) by GITEXCPRDMB24.ww931.my-it-solutions.net (10.89.29.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14 via Frontend Transport; Thu, 14 Oct 2021 16:10:44 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WhVrDA9eDD62gTFT4reBNbWknDbtDWbXEHYNGnJ31jranJWAPfa5wOroIDXG8b2Nj/RIotdFPeGJ+BHdK3r0FyaYPiOuqX3LMg++jod6RgAL1DkH9WOHx7tZQdExzQEMjqHaqsAQWz3zDNoKDgc4rikgj/ho0msIuz8hOMwpXlnBORmBo6P5OB0TDf/bxiOVS33MPV2cgXPqpyFprdhTSdZdDlM8rsiWY0IlajINdkuFslGM7l2kSl2xFn/nMliv8cNr3cZzWRjx0unExysnk6X7InSlWivlSzcZymnol8KEVQet58VtLvgekj94ATsl1pjWtlsu3nEHCvDGIjdh0A== 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=822PLhEHKFqaTAz0coSP35eWyDhWqy/mJtTq4dBpCcM=; b=luRKR+lOeF/8WORz9tniov9SzD8xjdI0bez7jR58ZOg21Rh1dZcPmXD8VJDuX/UwEgfk+oaungSAY9ZM8/dJ5oakTRIxIAvo7sYfJ3mu0HfLj7XA3Nl7nQrFKOpRynqPEAgbDeC26skp3MqilwzeIRmT3nlTGhlCFSganWx8jcTrLuPl+mEFZF7kSdJuGAjDhV2Y6wo/Me3tbq5vVyKKTOuSaolFZA7SymfpJln6wrznZcEn/ubHPUId+7r2i0dw7absGLOa77a/GMotzOEIFHB/bwIEFQXobWK7J9Q/+8L6/tmoqo8/tFqnl72/TjyA/tzs0csMeoPRVtg0NBc3Sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=atos.net; dmarc=pass action=none header.from=atos.net; dkim=pass header.d=atos.net; arc=none Received: from PA4PR02MB6686.eurprd02.prod.outlook.com (2603:10a6:102:ff::14) by PA4PR02MB6542.eurprd02.prod.outlook.com (2603:10a6:102:f9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.22; Thu, 14 Oct 2021 14:10:43 +0000 Received: from PA4PR02MB6686.eurprd02.prod.outlook.com ([fe80::d85f:8147:a57e:92cb]) by PA4PR02MB6686.eurprd02.prod.outlook.com ([fe80::d85f:8147:a57e:92cb%6]) with mapi id 15.20.4587.026; Thu, 14 Oct 2021 14:10:43 +0000 From: "CHIGOT, CLEMENT" To: David Edelsohn CC: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH] aix: ensure reference to __tls_get_addr is in text section. Thread-Topic: [PATCH] aix: ensure reference to __tls_get_addr is in text section. Thread-Index: AQHXwMl7qHonc+nZOkGaxPyORBSIz6vSgSwAgAADtrc= Date: Thu, 14 Oct 2021 14:10:43 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_e463cba9-5f6c-478d-9329-7b2295e4e8ed_Enabled=True; MSIP_Label_e463cba9-5f6c-478d-9329-7b2295e4e8ed_SiteId=33440fc6-b7c7-412c-bb73-0e70b0198d5a; MSIP_Label_e463cba9-5f6c-478d-9329-7b2295e4e8ed_SetDate=2021-10-14T14:10:42.965Z; MSIP_Label_e463cba9-5f6c-478d-9329-7b2295e4e8ed_Name=Atos For Internal Use - All Employees; MSIP_Label_e463cba9-5f6c-478d-9329-7b2295e4e8ed_ContentBits=0; MSIP_Label_e463cba9-5f6c-478d-9329-7b2295e4e8ed_Method=Standard; suggested_attachment_session_id: 077ad205-a70c-2bd6-89d5-7af8ca8c2dff x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 97ba1304-1c7d-409d-ddfd-08d98f1c692f x-ms-traffictypediagnostic: PA4PR02MB6542: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:901; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LxX1fzntpKrESw+Om+CGwh4J84QXyo4dxPjgzdcs+T5Uh1uKUSXhhF33gOeJ4+aJECn0NQieNv0W4hW9KPXbw2POw22uyrYj8L5OMHxd9R+noELYZfA7iOTzbZ08xuiirB8m2v0sTjcJ2uKFD5wSAK/n7WQKYkN923JfMRHMlQLpQ6kpcv4CScUhOgaxF6T9OwauVnSKlN3HS3JudaLGPQjo6q93VldCQ1zwTKWYCu+RkhCAnkTQ/9MKzDY8xexxXqUfV3izadmA6NWlr9RFTmODWU4l9Zx3HJPHNlYiVszPaR230hYGf+j1B4Q20S4P4EYJfvG4FPf+BO4gLVEAQgZMSoUaj43HRUc7scPEAZE514BtjzBaBjKdwuZiI4EU8fYynlUpTJu9EygEzJ4PpEEds2ns3c95XF8CbJoQ93IrdSAJbUu/as6zPQkkNxXR5L9lJAwgnJ90JWkIHxcKjoJsXsYRBN5BKrMLub7HE4g4hf+Jn17vAeTkrq9DL4NT/U31+csJ0bwyZAS0X1eTmGipqKwA3ooVxDIYokEuRPcSjavuUyec3Rv/7/hmV8pvKvliEcWyPUzs3/OCkg3cJWV49Qj7gymHXQ9kCYvyaQLjORKn2v5O/R/yotAyjLsKweuGAVDjJ72AORepmqcLq70sbs/LlbN0bRlfuFzRmLvqX/t9ComkniLiP5x8HpmC6fA3WM2atyUtMCP/j+JzRA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR02MB6686.eurprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(55016002)(86362001)(6506007)(38070700005)(122000001)(76116006)(82960400001)(66446008)(66946007)(33656002)(64756008)(19627405001)(2906002)(5660300002)(508600001)(53546011)(7696005)(316002)(9686003)(186003)(38100700002)(66476007)(8936002)(71200400001)(4326008)(52536014)(26005)(91956017)(6916009)(66556008)(8676002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?lhe22ylxht8xuT5LFO6ZzAwTikFsoC6MekMWe+2FR3SQapIn4Pb0L5irfD?= =?iso-8859-1?Q?FwMOYiMbe7Xs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7f?= =?iso-8859-1?Q?KTQ+n3oPvKPpZGALJ2EMaYmPW/Cw7DkH4nFi801e7YMyZN2PpwcoGJm2lR?= =?iso-8859-1?Q?cMHU3Rf+XMTWc/977KpyvqhJ+l1WlAzYWheRpPxCMgLDg9n15ndRg88pcQ?= =?iso-8859-1?Q?6UJMZ3nawLtv/gt8h5RIQB9DWkrXfDWJ07FA7k6kW9EDW0nzQsqZKDQbWT?= =?iso-8859-1?Q?jnWx6QGYZXFYdkJxCiEPiBKMv0AQb8v99zXHCBDl1QhpA6G+v+mONZhCtZ?= =?iso-8859-1?Q?72a37ogeuh6wpa/JqVH88eEaFAXA6JWgIa853tScOy3IgzVxal750QrOWR?= =?iso-8859-1?Q?6nSXI8gGWYgNQSaxMQoK+4ID/zg21tB7H48SBOgHAPdJlEhkQRTmtdpD9f?= =?iso-8859-1?Q?5wQxVY6UUItsxVdgaDIwzt6NzF3Igdl3Atxd8l229Jre2G+xPNReBY6rUj?= =?iso-8859-1?Q?XR93uLi/rA?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR02MB6686.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97ba1304-1c7d-409d-ddfd-08d98f1c692f X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2021 14:10:43.5151 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 33440fc6-b7c7-412c-bb73-0e70b0198d5a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9UEoX/L2d1EPQ4rX0aZigvRrJJxDirnzsPy7cJhpkbZLVllEWfRy7u7IiQfOG0Mg+Om6EYKmHcQlNdvFbXaU6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR02MB6542 X-OriginatorOrg: atos.net X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, HTML_MESSAGE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2021 14:10:49 -0000 Hi David, The fact that csect .data is referencing csect .text doesn't mean that if .text is kept, .data is kept too. It means the opposite. if .data is kep= t then .text must be kept. That's actually what is being done by the linker with the TLS support test in configure. $ cat test.c __thread int a; int b; int main() { return a =3D b; } With ".ref __tls_get_addr" in .data: $ gcc -maix64 test.c -S -o test.s $ cat test.s ... _section_.text: .csect .data[RW],4 .llong _section_.text .extern __tls_get_addr .ref __tls_get_addr $ gcc -maix64 test.s -o test $ dump -X64 -tv test ... [142] m 0x00000097 debug 0 FILE C:PPC64 test.c [143] m 0x100006c0 .text 1 unamex .text [144] a4 0x0000005c 0 0 SD PR - - [147] m 0x20001298 .bss 1 extern b [148] a4 0x00000004 0 0 CM BS - - [149] m 0xffffffffffff8800 .tbss 1 extern a [150] a4 0x00000004 0 0 CM UL - - ... Csect .data is garbage-collected by the linker. Thus the .ref doesn't matte= r. With ".ref __tls_get_addr" in .text: $ cat test.s _section_.text: .csect .data[RW],4 .llong _section_.text .csect .text[PR],5 .extern __tls_get_addr .ref __tls_get_addr $ gcc -maix64 test.s -o test ld: 0711-317 ERROR: Undefined symbol: __tls_get_addr ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more informati= on. collect2: error: ld returned 8 exit status As csect .text is kept (because of main function), the .ref is still there = and the error is raise correctly. As "-pthread" isn't passed, __tls_get_addr is not avail= able. However, writing this mail, I'm wondering if we don't want to always keep b= oth csects. If .data is kept, then .text is and if .text is kept, then .data is= . Or always keeping .data would have too much side effects ? Thanks, Cl=E9ment ________________________________ From: David Edelsohn Sent: Thursday, October 14, 2021 3:42 PM To: CHIGOT, CLEMENT Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] aix: ensure reference to __tls_get_addr is in text sec= tion. Caution! External email. Do not open attachments or click links, unless thi= s email comes from a known sender and you know the content is safe. The reference to __tls_get_addr is in the data section. And the code just above creates a symbol in the text section referenced from the data section to ensure the text section is retained. So this change doesn't make sense. You're essentially saying that the data section is not used, which makes the other code useless to ensure that the text section is referenced. Thanks, David On Thu, Oct 14, 2021 at 3:06 AM CHIGOT, CLEMENT w= rote: > > The garbage collector of AIX linker might remove the reference to > __tls_get_addr if it's added inside an unused csect. > > > Cl=E9ment Chigot > ATOS Bull SAS > 1 rue de Provence - 38432 =C9chirolles - France >