From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140082.outbound.protection.outlook.com [40.107.14.82]) by sourceware.org (Postfix) with ESMTPS id DA2023857C50 for ; Wed, 20 Apr 2022 14:36:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA2023857C50 Received: from AS9PR06CA0500.eurprd06.prod.outlook.com (2603:10a6:20b:49b::25) by AM0PR08MB3395.eurprd08.prod.outlook.com (2603:10a6:208:dc::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Wed, 20 Apr 2022 14:36:34 +0000 Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49b:cafe::eb) by AS9PR06CA0500.outlook.office365.com (2603:10a6:20b:49b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13 via Frontend Transport; Wed, 20 Apr 2022 14:36:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT036.mail.protection.outlook.com (10.152.19.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14 via Frontend Transport; Wed, 20 Apr 2022 14:36:33 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Wed, 20 Apr 2022 14:36:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 19dfa104dd9951d3 X-CR-MTA-TID: 64aa7808 Received: from 1beb429d1413.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 67EFCDD1-3CBB-4D2F-B988-0F3113B11735.1; Wed, 20 Apr 2022 14:36:26 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1beb429d1413.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 20 Apr 2022 14:36:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kkJE1UChQQuZHgBNi+IDkc5Dq9Yv00NZP/RipkvETLh6mnl2vOtPhA5no1eMTfoT0OilJs1Xfz/3JVqnc2CF/5QVrp/zsrQymU3QFUl5gKAhU0VLt/3631VJcj7FiEjr4WtDSc0Usre9413ZGlyaWkE+S99C84TCM/YVYQintl8C1dPvRS/5y2vXarLUjdrCivu+qfigYYgAGDelVJvWtEHY5k5LNYKgPuoIPt0x8aXJIPYAzBP6U/tetvYbQ7NfJmGahtsN6Z4/zc7Q5iAD5cmlJSga8tj8KSU3iKzJ6+vInA+F0WuIepjwzvbyblFv8fq6yCvjXJHFenXqjXvY7Q== 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=IPACkieBvwYIm3VEgd3iPUwQ2gIuYHKDexp2L0EdxJU=; b=dY6urmZ/SXx0dZW3Bxi5htvc+8dNjT8O9Y2XKv/o694M4ECQIxTiVy10dHiXZzsKhYA5kkX+5CATHA1W3/YuPgdKN4F5f6b83nXTcoYA19cLLD3F1mQs9ToraPg4IsgxdDRc4OLZKpN7vPOsuibnF71bYKNuXjV1uDQUISsqYAxFQIZevjtGCn3y68c6xFEJQj1T82jl3QXM0P7oauGOsDok0+Wr/cLh+0gZemj3GTy/b0mvxCVy8uNVYgK+H1BOnd9gFaDbDk0X4fRoS245Vbi3z2IrY3ALxb2DnGIOybeJEtLkNM3i9mhhPbbscQvNdVARwrMbpNQlBAAWhRQCqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AM4PR0802MB2147.eurprd08.prod.outlook.com (2603:10a6:200:61::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Wed, 20 Apr 2022 14:36:15 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::1d77:d9e:16a8:75d5]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::1d77:d9e:16a8:75d5%7]) with mapi id 15.20.5164.025; Wed, 20 Apr 2022 14:36:15 +0000 Message-ID: <09631752-1d2f-5e17-ecb8-ecd35f68abff@arm.com> Date: Wed, 20 Apr 2022 15:36:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 2/2] xcoff: implement linker relaxation Content-Language: en-US To: Alan Modra , Nick Clifton Cc: "pro@helflym.eu" , "binutils@sourceware.org" , Kavana N Bhat , Ayappan P2 , "CHIGOT, CLEMENT" References: <5149-625fd800-1df-4c0aa900@128699948> From: Luis Machado In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LNXP265CA0078.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::18) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 35150a51-8e15-4659-db3d-08da22db2b03 X-MS-TrafficTypeDiagnostic: AM4PR0802MB2147:EE_|VE1EUR03FT036:EE_|AM0PR08MB3395:EE_ X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: hiIF+yl77cqB4Tc2LVJv1gkz/9i7ZqYnZylSsFU2qtQbU9HRGcvnSuwxYqwwDu3eKFpuj+7U3f9uvIiYxjwGki60LbC7hbAyxCU/7wzxPDWDo3kGdl5wy9/HxIjtM0bUPXD5UUDDO0v1Rmu4jLW+QIQ0id7Z1PtxoMhNh5jIGkfBl+37SSCVbQFiEhCi0FHUcNC9Kawfk+WBdgGA7WH2cEcuheBhuOXnZQKc8DsH49yxB39lVhZBm5knnsRCTG21twDdyMRA0idfeO/2SJRwi8q85ieq5zqLJkOSjXY5brNLBkTGupBiSaMEQi5qzVxDclWUQslwFQZg9gS6+ixPetOruAROJtdMNR7eCByORqQ0vHy5d/wreqrE0s5VJ08iDgXy03QiUsGYqbjyv/Dnv3A3mAa4JTTSRqCkYQ1y6PVBEVODRCBlfTiNQmnQPFSWW+LZmEVZ3+MVxvQEsjrfsn2K/6Ml/4x0iXvRYISyUYa/SgCm+uOdko9rEBn7MxrqQ3TKhDpWKoQEZPhE+zk1XgfbvQ0giIEmeAhIaHXeROjNLnuf+iWXocF3Sq2b0rsLGrfDNHqFGV8LajHvMSIb93xWPhA5cnfj2tYz51myx/uA+WtPC9aWiQtBlqfKaUwgsD60FnOe3BVjxK7oKVEtWP3seKFYAzkEagWDsEhYwPLkvc526KZgBlrbayi8xcYBN6yzUu8CGVqJFrC+nKa0+LAuNVr1AKMabfbYJPoJQCc= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(44832011)(53546011)(26005)(31686004)(66556008)(36756003)(66476007)(2616005)(8676002)(6666004)(6512007)(2906002)(66946007)(6506007)(5660300002)(186003)(4326008)(8936002)(508600001)(6486002)(38100700002)(316002)(31696002)(110136005)(54906003)(86362001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2147 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 95c6df77-0687-4e7d-2f94-08da22db1f7b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2CsBR28k8xx5DKm17G3J/d8xzQVoFFrS8P3XwwCC9jlVF/OuzNx+mscPDgNz12yK/5q9piBfR4oup2vC8ckbfFQn1RP6Fv0jIVnjPHw1Ph0/KXhNI2Ol31jwg3H2osrxRuVkCKamN8AnAhJ4A68gN/sGsHYGuBF+cCiQjHHL1+EKWW3bM71Hnu+BfwHund0XUHgu2AvCkDFHVDp1wvSla7C6BWCF9s9rGA3lXIOcvT2QL7kGuaiIOgGPEg/liKaTEWCXnKsemLIQkejquiTxHzmdiGV3Sih8nXFOYrenFcv+ICmwRZqN7NxTD6uOHuYUKFxGD69ef2vjkbU9BAwWKxT2/QGtuKmIQeRfUpTPxpSWCfpqlW/2vSFmBEOPfrCo2QqAUuYHzIMDCA9QjQQmIVCTlga/JOxbYyfZuZWhBqrE21mJrVVFFB5j5rRrk6S78DVO20iHqNnkYAAuhT6ZWhpuoMKzUgXLjoNmd60TAYlPPQrtSMj26/GCTERuSJoYVsUT1R9LQCdA1aokDnNbX/lFDTjqDTx9HuZRMaNqzy21uggLJ+OemVxMXLPw+nRGwBnDb4wTLSDZ7SRBuzbmOM0SH3SnWu/uvyoOgAoodP+8KFQPsTn6TR4Fj+pf0s7UzTFoKtMqyohUAj5llTSoSXggq5TA+KTRp765rcL2v2ti2z1Te4d3LcPAVT04F6irS85pO+rNigTe+WWOzz8nLg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(508600001)(70586007)(4326008)(6666004)(31696002)(40460700003)(6506007)(8676002)(26005)(6512007)(70206006)(316002)(53546011)(86362001)(82310400005)(54906003)(110136005)(6486002)(356005)(2616005)(107886003)(31686004)(336012)(186003)(47076005)(8936002)(44832011)(2906002)(36860700001)(81166007)(5660300002)(36756003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2022 14:36:33.9795 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35150a51-8e15-4659-db3d-08da22db2b03 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3395 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2022 14:36:40 -0000 On 4/20/22 15:32, Alan Modra via Binutils wrote: > On Wed, Apr 20, 2022 at 03:13:25PM +0100, Nick Clifton via Binutils wrote: >> Hi Cl�ment, >> >>> As I said to the previous patch, I can't do it right now. Thus, if you find a bit of time I woudl be grateful if you can make these changes yourself and apply the patch for me. >> >> Patch applied. > > And a few fixes. > > * xcofflink.c (xcoff_stub_csect_name): Increase buffer size. > (xcoff_stub_get_csect_in_range, xcoff_build_one_stub): Whitespace. > (bfd_xcoff_size_stubs): Cast PRIx64 arg to required type. > Don't use freed stub_name. > > diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c > index 6dbcd299b88..83469775208 100644 > --- a/bfd/xcofflink.c > +++ b/bfd/xcofflink.c > @@ -4316,9 +4316,10 @@ bfd_xcoff_link_generate_rtinit (bfd *abfd, > > /* Get the name of a csect which will contain stubs. > It has the same pattern as AIX linker: @FIX"number". */ > -static char * xcoff_stub_csect_name (unsigned int n) > +static char * > +xcoff_stub_csect_name (unsigned int n) > { > - char buf[6]; > + char buf[8]; > size_t len; > char *csect_name; > > @@ -4360,30 +4361,30 @@ xcoff_stub_get_csect_in_range (asection *section, > csect = csect->next, it++) > { > /* A csect is in range if everything instructions in SECTION > - can branch to every stubs in the stub csect. This can > + can branch to every stubs in the stub csect. This can > be simplify by saying that the first entry of each sections > (ie the vma of this section) can reach the last entry of the > stub csect (ie the vma of the csect + its size). > - However, as the stub csect might be growing its size isn't > - fixed. Thus, the last entry of SECTION might not be able > - to reach the first entry of the stub csect anymore. > - If this case happens, the following condition will be > - false during the next pass of bfd_xcoff_size_stubs and > - another csect will be used. > - This means we might create more stubs than needed. */ > + However, as the stub csect might be growing its size isn't > + fixed. Thus, the last entry of SECTION might not be able > + to reach the first entry of the stub csect anymore. > + If this case happens, the following condition will be > + false during the next pass of bfd_xcoff_size_stubs and > + another csect will be used. > + This means we might create more stubs than needed. */ > bfd_vma csect_vma, section_vma; > bfd_vma csect_last_vma, section_last_vma; > > csect_vma = (csect->output_section->vma > - + csect->output_offset); > + + csect->output_offset); > csect_last_vma = (csect->output_section->vma > + csect->output_offset > + csect->size); > section_vma = (section->output_section->vma > + section->output_offset); > section_last_vma = (section->output_section->vma > - + section->output_offset > - + section->size); > + + section->output_offset > + + section->size); > > if (csect_last_vma - section_vma + (1 << 25) < 2 * (1 << 25) > && section_last_vma - csect_vma + (1 << 25) < 2 * (1 << 25)) > @@ -4703,7 +4704,7 @@ xcoff_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) > BFD_ASSERT (hstub->htarget->toc_section != NULL); > /* The first instruction in the stub code needs to be > cooked to hold the correct offset in the toc. It will > - be filled by xcoff_stub_create_relocations. */ > + be filled by xcoff_stub_create_relocations. */ > for (i = 0; i < bfd_xcoff_stub_indirect_call_size(output_bfd) / 4; i++) > bfd_put_32 (stub_bfd, > (bfd_vma) bfd_xcoff_stub_indirect_call_code(output_bfd, i), > @@ -4714,7 +4715,7 @@ xcoff_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) > BFD_ASSERT (hstub->htarget->toc_section != NULL); > /* The first instruction in the glink code needs to be > cooked to hold the correct offset in the toc. It will > - be filled by xcoff_stub_create_relocations. */ > + be filled by xcoff_stub_create_relocations. */ > for (i = 0; i < bfd_xcoff_stub_shared_call_size(output_bfd) / 4; i++) > bfd_put_32 (stub_bfd, > (bfd_vma) bfd_xcoff_stub_shared_call_code(output_bfd, i), > @@ -4871,7 +4872,7 @@ bfd_xcoff_size_stubs (struct bfd_link_info *info) > _bfd_error_handler (_("%pB: Unable to find a stub csect in range" > "of relocation at %#" PRIx64 " targeting" > "'%s'"), > - section->owner, irel->r_vaddr, > + section->owner, (uint64_t) irel->r_vaddr, > hsym->root.root.string); > goto error_ret; > } > @@ -4896,10 +4897,10 @@ bfd_xcoff_size_stubs (struct bfd_link_info *info) > hstub = xcoff_add_stub (stub_name, hstub_csect, hsym, info, stub_type); > if (hstub == NULL) > { > - free (stub_name); > /* xgettext:c-format */ > _bfd_error_handler (_("%pB: Cannot create stub entry '%s'"), > section->owner, stub_name); > + free (stub_name); > goto error_ret; > } > > @@ -4999,7 +5000,7 @@ xcoff_stub_create_relocations (struct bfd_hash_entry *bh, void * inf) > return false; > > /* The first instruction of this stub code need > - a R_TOC relocation. */ > + a R_TOC relocation. */ > case xcoff_stub_indirect_call: > case xcoff_stub_shared_call: > irel->r_size = 0xf; > > Thanks Alan.