From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D01981F8C6 for ; Fri, 9 Jul 2021 15:05:59 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0826A398CC16 for ; Fri, 9 Jul 2021 15:05:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0826A398CC16 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625843157; bh=r3pe+HH2P8+NBK9V8FLq8qenS4bc+3OxALuxJsnzH7Y=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=U21X3JAwLOozVQy8dAT/W75E690akacXZH6+PfwcbBjo7OxuI2ntpaEqzUZwMljjl RfQQ+zfLMTY+Q+iIYvbq2TQtZlagvn6mPdtlvb/vSEh4L8zLAR122CHocbhfF9O5Jo zQInj220eY3xcEvPFi6DciOpYh5HZcFZ3UuRcABI= Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20618.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::618]) by sourceware.org (Postfix) with ESMTPS id 593A13857831 for ; Fri, 9 Jul 2021 15:05:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 593A13857831 Received: from AS8PR04CA0184.eurprd04.prod.outlook.com (2603:10a6:20b:2f3::9) by VI1PR08MB4045.eurprd08.prod.outlook.com (2603:10a6:803:dd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19; Fri, 9 Jul 2021 15:05:29 +0000 Received: from AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f3:cafe::58) by AS8PR04CA0184.outlook.office365.com (2603:10a6:20b:2f3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.21 via Frontend Transport; Fri, 9 Jul 2021 15:05:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; 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 AM5EUR03FT050.mail.protection.outlook.com (10.152.17.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Fri, 9 Jul 2021 15:05:29 +0000 Received: ("Tessian outbound 4c0db4752fcb:v98"); Fri, 09 Jul 2021 15:05:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 56af476e755c48b5 X-CR-MTA-TID: 64aa7808 Received: from fd3243a2e696.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 75FEF4E8-F9C7-4AF4-A7CA-5962D8394507.1; Fri, 09 Jul 2021 15:05:16 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fd3243a2e696.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 09 Jul 2021 15:05:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Myoo+/68cbozThgmy0rOMiUOXq6TMqEADsou4Nm25G1li1XOy3+zFf2j+THIu89bjo7gSGTRjKpQkZev+rWwKe/4vMw+zrKwU9eMUsWOvt3Ic7rw04lILP/OlVVgC25V/DRCLL51geGd1innSDq1ND8NjRVe3uXVeBAtGaEV47BYZlaShf1xHUySjX4eYhrMhiuVf91r1oXoVHWTsSt2Kbv0LGEBf5TcvWBzBFlH3Bo1KI2lp8X4PKvH+o2hkKd4PbV6GZTxa3D2Ehjw/mnbiJs0bdaT8txTkqR/C5WNngBEe6AdeKSx9y1HFi7RSkv2nawZoLR814DkR0jqcUt5EQ== 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-SenderADCheck; bh=r3pe+HH2P8+NBK9V8FLq8qenS4bc+3OxALuxJsnzH7Y=; b=JaYN3l5sh41h9HetoLNNQjRW83LGVbR2028K/yrmEx3nVGqC+rswOZgsFoZkc3yNqHD9CkQtar30HZt9pML1casULOl8HZc7gzPgPGUwJjHsClKswy85z6L77PlV+ppN0xvDsBoJeePs7xBclxu72AkzBEt8YnBL05wly2ZtQE86qSjLLIJ3K/2nEmvLKbpzF+sr1N2nmx6C8YFGI72VXGH2oEGXFzwv8JfyRpgY69Up8DRfJdbFmfGKv4bjTfjA+rkVV4kdlCpPlKFhDUGDzb3DFkq7eMPogMB2Es+IRBsldmbyJMsWybbVvRkAM9bCrzwfxO6O/qqB8Qwh0loBfw== 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: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PA4PR08MB6031.eurprd08.prod.outlook.com (2603:10a6:102:f1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.23; Fri, 9 Jul 2021 15:05:15 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::ac83:9f8b:1a5:2c33]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::ac83:9f8b:1a5:2c33%5]) with mapi id 15.20.4287.027; Fri, 9 Jul 2021 15:05:15 +0000 Date: Fri, 9 Jul 2021 16:05:13 +0100 To: Adhemerval Zanella Subject: Re: [PATCH v3] elf: Fix DTV gap reuse logic (BZ #27135) Message-ID: <20210709150512.GT14854@arm.com> References: <20210709135001.505521-1-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210709135001.505521-1-adhemerval.zanella@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LO4P123CA0042.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::11) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by LO4P123CA0042.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.21 via Frontend Transport; Fri, 9 Jul 2021 15:05:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 187deecf-c867-4f24-88ca-08d942eafdc6 X-MS-TrafficTypeDiagnostic: PA4PR08MB6031:|VI1PR08MB4045: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 9ZFwSZ9qovJbuKBUhO/oddP03Ab07/B/jU5s6Obbe6gpnH1n8TUNDp+3DVMeVI505Ed7DQKJXekUL5fRrV7sPh8ynXaf5mcvQxfNZNMUb86h9LYbfxCbE5ip9OISkb4tCC5n8bxsJsF25CNBCK9NtOMnYiLnmY9nOrnFP1XIfN8WtMdFIAikodSvVBObX9lqXRIOCi2QUeWUFVju+HK3i0X9CnXCB+bpScK+yl5cm5CxJQ/s9QEWyEA0ZNwOYHPvbUN5nrLnlMyS63aLqY+7J5LPwgBiQ7cPYcuGHrAdIAdurqnuB//5GrXiOTQCBL6XvHRmjOKjuMkP6/Ai1deaJyJYPQsCm70eZkGhHkp65j1E22ILbX+/qtlljt4sHYnKFcZLJQQiQX/o/he/MbZoFE3s+v03Etjp+iejEaJDwVrs84AvIsOFh9WU+T2wFU0KBeESiVy6YPI9ABz1MAxxVqzG8+u2CLTbw/w8UlMMuuNWJiF3fN7494qu7Pktsy3xZVgMKv0WDOThFUwxNnh4gqLaGtuCCCspMVw3GQ1O+Nt/fYpNrIJMwwsZyBDwSbmZNROiYCTTVn1jclir2GQY/1StEiVoVY2lEbC0DdCZEVZa+FNbcTEHFn/xVfzC0M3s/BaYihsAa/oD8rkEgy5r7xDP1Wza+xmD28mf+kw1rq6uBKyx0NFgXcD4gfr/IrSyBQntGhnRVY7b+5dPsHNRvg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39850400004)(376002)(396003)(346002)(366004)(52116002)(7696005)(1076003)(66556008)(66946007)(4326008)(83380400001)(66476007)(8676002)(316002)(44832011)(55016002)(2616005)(956004)(186003)(5660300002)(478600001)(38350700002)(26005)(38100700002)(36756003)(8886007)(33656002)(6916009)(86362001)(8936002)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aFNxRW1VWDREemY3RmtkdmZ2Tllxam9mU29hY1JxWTYvcFFSb1VtQWFPY2ZS?= =?utf-8?B?UzZVM3ZIaHZwSzZsb1c3dHB4N0c0Y1V2cEpDS2RpZmhFZ3B2MUEwa2xuWDdM?= =?utf-8?B?WnlJRnFHVmNrK3BoenZVWVdzOW12UFpKMzREa3JHTEFudTJzZFZEV0htSCt5?= =?utf-8?B?RDVTaWFYNDk4NzR0RjlURlpQck1KMUpZZ0dxMVV2aityaUIwR1NWVGpOZWtP?= =?utf-8?B?K3A1QTVHdDdaMmNseUJoTWhrZTdBNzJsM0tLQzc2anVnRnhIcGNQUXRRKzh1?= =?utf-8?B?QVMyVFVQbWozNDB5SmwzUUhqTEwyS0RCK1AzQzNxNVdndlA3TnhiVjUyZG41?= =?utf-8?B?cEFyMjFJUnpHWGdFMWVTbUI4Z1BVc0RCVm16Tkd5aFk0UDB4MWNrOTcyNFZW?= =?utf-8?B?MVB1N1ozWklLTlRXeVZ3bEJIU3l0VDMzWVVXTVo5M3FXQTl2ZndiWFJ1Y1FO?= =?utf-8?B?MEpqTEdsaEgzZSs3emQ4cllSbjdlL3BTT0Y5NzB2U1ZtNzgrT1lxQTJud0Zh?= =?utf-8?B?S0pWOFVYbjhaaG1uNXI5M1dzRGpraWhYanh2a0dzMnpRUUFyT2dlNFhKY1p3?= =?utf-8?B?ZE03TFhqbmF4bUdQbytVeXBYYzZYNElYYXZmemZWUEt3ODV2TlA1K01HS2Yy?= =?utf-8?B?VUMrdzE2NkwwbDA1c2wxK1U3RVpCUDgwWE5aalYwUzlzVGU1ZXRaQlZ1cStR?= =?utf-8?B?cS9EVFRHeFp6cDVSbWhkYnJSSFc4VWFBZjY3VWtzbzBGUkJoN2llL21oVjM5?= =?utf-8?B?M1ZBZkFTOEdYN0FWZTBlVmY4Znp0SCtOUjBQdDVSUWF4MWdNejBrU2tGblJE?= =?utf-8?B?c1k5VUJRMWZJZlNWVzZncVZDdU03ZDNYSVdmOFdnTitrN2Nob1k0LzNFQTND?= =?utf-8?B?bHRwS0FQUGlZUG9OMkIwR1hmdTREcVFzb3h2WnFlNlBDZ2lkS3F4eE5QQzJC?= =?utf-8?B?dVhzM2s5NU90dXJESWhlNkprRnVibWxvbVhUcEZJSzVWbFVjNS94d2RzYmFB?= =?utf-8?B?L1V2UUowSnUxNzlKTDVPamJ1Z01iVCtzaWhiRlJnRzduTWJJYzR6eEcrVmY1?= =?utf-8?B?UG1xMGMzUHpZdlNVM0loZy9vL1lOUEh5RDRrNDU1dlIvSmxlVGkxelFXQjF4?= =?utf-8?B?SjdNSkZGUjdDbEhRb3RxUGFvYThjUDdXWExCaXJraFRtSDdzVHhnYkFxRlJZ?= =?utf-8?B?cllHZUZKeEppQ0cwTmNuMEpBWW1Sb0pmZmZoeGo4MG1JWFpiV2lsRGpzQUVM?= =?utf-8?B?MXZZUFBBRXBnamhjbHN4WWtieFRJOC85KzJPeTlUVjRNU2tNWGtyWVZpVGw0?= =?utf-8?B?c0JCK3JqQTVKdVRud1NUd0M4RDl0MEdMQndHdXI0TkVXNm5sUS9leGlLaEhD?= =?utf-8?B?cTgwUE02RTJqMVlIUFpvaStxL3EwOGx0VnBkN0d1d200RTZTNHpwNDFGbHlB?= =?utf-8?B?dEszcEVCR1Zyd1BwYmEwY2VBd2lzOE85cDk5LzJHVnFBOUZJdENPbnJUdjRO?= =?utf-8?B?L0xIU0xJMXpXSkN6QXVid2doR015LzJYbW4vb0QyRFFrekpOVkFqa3RyRm9O?= =?utf-8?B?QjJNQUYrZ0c5Ylphb3B5MzhJaEFmTEc3YXliMy9pTXFsMmhmU0tNTnVVWkFZ?= =?utf-8?B?T1NRRUR4dmlVU3RVVGpGUFRWcExSdXpib2M2OFBWRVZGdEdHV0RqWUpXSmNh?= =?utf-8?B?bng5ZmtyT1lobm81NWlIL3huRmQ3UjIveXAyb21MY0NBRjhTWGZUajJtVGRD?= =?utf-8?Q?JP1ZbGKkNBMSyFbhHvpE5YIkqs1ufgJtyE+YvP9?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6031 Original-Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3a6718eb-f9d4-47be-9b37-08d942eaf4fc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8BPqrt6PMphg/w9PLLSD0v9qWoEGYVvBleUl1ZyJMvOPicZcz6xEfH2aMXKBsjcABNm4bJ9T281IOAjGnjYDrqyIP11Syael8KuMqx+kM7QOETk0zEpsib4C/v21eG3HILoeezTnnVAM/TTxwoYXG03cDZdt4+VrI+Bjy3xTPhsxS05hJ6zexwwruTr99/rmRIX7j9taxrSCc3ffDbg3AQ5CQoFrmFkydIDAaMiB86aiKQ15v0GitsR+rHIWBMtYTyYuSmjY8GTsjveSCZFtrTjVFuQ4cIe/59iZxX8cwwg74LCp7SfqPfl1OHLokXMRuSZdzM7ddLQLgXp7UP4SHcGP/U2ZpKK30pPaD0IiVX8EbLBtcOZsDF2yR81o3ivSTDOaqZ0IU23Rf4gS4Qd1pN0bJehHyaRj8OR86IsSUPV0juFM6mM9im72NOCRVfu1JWDNwncPtDZy4mFCgwF1uEECxCsVkun4YO48atYerzujLnjbRYln2kKPkNPcY/T2tIqk0hCoN3hTQz6l5UUsttEaphOWLl4elPcwXQc8uh4SIjtBLI2/3fENByFlZFiI9IzeKgJRCCw9pnFl0JSN4CmZ25GItOUfFPh2yG4ph46IlwtK26MXCxjyjnIecDQcJ9fT22wE2drD6bTHQgnrCWxbW/UraFCY0Cvlvad33Dbswf1s27jAqjvkJ4PJ1QjyQffpxr6q7ET833Wz+5nXUQ== 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:(4636009)(396003)(376002)(346002)(136003)(39850400004)(46966006)(36840700001)(1076003)(6862004)(356005)(956004)(2616005)(8936002)(44832011)(186003)(82310400003)(5660300002)(47076005)(36860700001)(8676002)(82740400003)(4326008)(7696005)(83380400001)(86362001)(336012)(81166007)(478600001)(316002)(55016002)(70206006)(70586007)(33656002)(36756003)(26005)(2906002)(8886007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2021 15:05:29.6543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 187deecf-c867-4f24-88ca-08d942eafdc6 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: AM5EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4045 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Szabolcs Nagy via Libc-alpha Reply-To: Szabolcs Nagy Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" The 07/09/2021 10:50, Adhemerval Zanella wrote: > Changes from previous version: > > - Fix commit message and add a line about the bug fixes. > - Use atomic operation while setting the slotinfo. > - Use test_verbose on tst-tls20.c. > > --- > > This is updated version of the 572bd547d57a (reverted by 40ebfd016ad2) > that fixes the _dl_next_tls_modid issues. > > This issue with 572bd547d57a patch is the DTV entry will be only > update on dl_open_worker() with the update_tls_slotinfo() call after > all dependencies are being processed by _dl_map_object_deps(). However > _dl_map_object_deps() itself might call _dl_next_tls_modid(), and since > the _dl_tls_dtv_slotinfo_list::map is not yet set the entry will be > wrongly reused. > > This patch fixes by renaming the _dl_next_tls_modid() function to > _dl_assign_tls_modid() and by passing the link_map so it can set > the slotinfo value so a so subsequente _dl_next_tls_modid() call will > see the entry as allocated. this paragraph still has 'so a so subsequente' and i would add the bug number into the first sentence. > > The intermediary value is cleared up on remove_slotinfo() for the case > a library fails to load with RTLD_NOW. > > This patch fixes BZ #27135. > > Checked on x86_64-linux-gnu. the patch looks ok to me, with the commit message and the comment issue below fixed. Reviewed-by: Szabolcs Nagy > + > +/* The following test check DTV gaps handling with shared libraries that has > + dependencies. It defines 5 different sets: > + > + 1. Single dependency: > + mod0 -> mod1 > + 2. Double dependency: > + mod2 -> [mod3,mod4] > + 3. Double dependency with each dependency depent of another module: > + mod5 -> [mod6,mod7] -> mod8 > + 4. Long chain with one double dependency in the middle: > + mod9 -> [mod10, mod11] -> mod12 -> mod13 > + 5. Long chain with two double depedencies in the middle: > + mod15 -> mod15 -> [mod16, mod17] > + mod15 -> [mod18, mod19] mod14 -> ... > + > + This does not cover all the possible gaps and configuration, but it > + should check if different dynamic shared sets are placed correctly in > + different gaps configurations. */ > + > +static int > +nmodules (uint32_t v) > +{ > + unsigned int r = 0; > + while (v >>= 1) > + r++; > + return r + 1; > +} > + > +static inline bool > +is_mod_set (uint32_t g, uint32_t n) > +{ > + return (1U << (n - 1)) & g; > +} > + > +static void > +print_gap (uint32_t g) > +{ > + if (!test_verbose) > + return; > + printf ("gap: "); > + int nmods = nmodules (g); > + for (int n = 1; n <= nmods; n++) > + printf ("%c", ((1 << (n - 1)) & g) == 0 ? 'G' : 'M'); > + printf ("\n"); > +} > + > +static void > +do_test_dependency (void) > +{ > + /* Maps the module and its dependencies, use thread to access the TLS on > + each loaded module. */ > + static const int tlsmanydeps0[] = { 1 }; > + static const int tlsmanydeps1[] = { 3, 4 }; > + static const int tlsmanydeps2[] = { 6, 7, 8 }; > + static const int tlsmanydeps3[] = { 10, 11, 12 }; > + static const int tlsmanydeps4[] = { 15, 16, 17, 18, 19 }; > + static const struct tlsmanydeps_t > + { > + int modi; > + int ndeps; > + const int *deps; > + } tlsmanydeps[] = > + { > + { 0, array_length (tlsmanydeps0), tlsmanydeps0 }, > + { 2, array_length (tlsmanydeps1), tlsmanydeps1 }, > + { 5, array_length (tlsmanydeps2), tlsmanydeps2 }, > + { 9, array_length (tlsmanydeps3), tlsmanydeps3 }, > + { 14, array_length (tlsmanydeps4), tlsmanydeps4 }, > + };