From patchwork Fri Nov 15 10:00:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1195508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513553-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="sfMH4gbl"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="CbKMxuvU"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="CbKMxuvU"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Dv4V5rycz9sP6 for ; Fri, 15 Nov 2019 21:00:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=fldYqmSTZB0uHC0J3Q+US+aCSjXjVcYiFq0/N8EHyl0z4hW/fi XE/ABT4Wewrkg2207jKfLqPgsJ3onG2KyxZg5+xpNUl4XGLBtmZgIGjr3Qa9bz/d DczgACSFuJpsrUHUtXwkoy+in1MMj9w27SyPIp9B2huxrq/ONlK7y93aY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; s= default; bh=itaSzeXI1PcMB3Osisvb+hsTWIU=; b=sfMH4gblw/nfPhDSHa4f S23FeBAdf5h0h/del60Szb4c7BLUoU/dAXG8AKMBp6luXePc8NRo4sTPE6YqlT87 zL2PSM+U3Kfrlrl17mMbzoHhkJ8NWOyniucw5IUbi/KoMJlJbNxZxiCb3vyOyrxh eV6LIgigXb4Tk7dor/VrH1E= Received: (qmail 68168 invoked by alias); 15 Nov 2019 10:00:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 68044 invoked by uid 89); 15 Nov 2019 10:00:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-eopbgr150055.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (40.107.15.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Nov 2019 10:00:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bpGn2WIrr9sSAXNw9rIeKIjq2dc/WVRQCSIG/r2okrw=; b=CbKMxuvU3fRGzEWB623E0si2ayiL2y6CatfMKEixUXJ53IzRujbB9d0sWtA5p2Sranv/5oTS3YgUunWj2Wa9/pli3EGwJ2WJbn1bvJbmTeuf96ocoR0pW+FlIlDfwu5/ElBjoA1BZQyQyhwJGv4utGGzfn7+9Joyf3nQd6LZT3o= Received: from AM6PR08CA0030.eurprd08.prod.outlook.com (2603:10a6:20b:c0::18) by AM6PR08MB3557.eurprd08.prod.outlook.com (2603:10a6:20b:4f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Fri, 15 Nov 2019 10:00:39 +0000 Received: from DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::201) by AM6PR08CA0030.outlook.office365.com (2603:10a6:20b:c0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.22 via Frontend Transport; Fri, 15 Nov 2019 10:00:39 +0000 Authentication-Results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 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 DB5EUR03FT013.mail.protection.outlook.com (10.152.20.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23 via Frontend Transport; Fri, 15 Nov 2019 10:00:39 +0000 Received: ("Tessian outbound 3fba803f6da3:v33"); Fri, 15 Nov 2019 10:00:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6223a0d8de37afed X-CR-MTA-TID: 64aa7808 Received: from f81fb09625b9.1 (cr-mta-lb-1.cr-mta-net [104.47.2.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3BC75E55-6C24-40B3-850A-352FD2FECA81.1; Fri, 15 Nov 2019 10:00:33 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01lp2057.outbound.protection.outlook.com [104.47.2.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f81fb09625b9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 Nov 2019 10:00:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KE1CMyNTmZGhC8Lalcu6biUJaPmr5HRWhZLWUPiviDy1jQVyMTeSaEPhDKaCAq+uOxP6+ns5d529a/k19kXJKUcMNsPIvXekyoiFMvZle4ugGah20d0rOqdzPrOE+Fgtk370zX6crLfQsmVRP6ef0ZgpRMLkl7xjBvnASWuGLrCgXfglzI75Zge8Hg7TQDOdlo7Apb/tYgrSkKlSL1fCoxXhLQHPkvtrPKE9x7cJoK2jIYW8b/AHZZ1fG8XJ4i1fZFl8dSQliNowfUy24Nvv+5KekMM1BcNCjVSsTyS3V4y776tgpeDzftHDcCOOtL+UV92RH0A1TDhnpR/FXGgRLQ== 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=bpGn2WIrr9sSAXNw9rIeKIjq2dc/WVRQCSIG/r2okrw=; b=LPArxwyNs5/u891694DqmkYibz7sCZEB0w4nGYrwAN3GPq+PIApYP0Eoi85cjzrMv4IMT2+mby4Jkb7luWXG9q0V3h5m6awLQhlzWKWlKbZwwZPKYO7pM3ELltqpuAenUeWJqXCDn/bqyFfEjKUcLYfvUQDarOsOVRyD3Fz+L8UtZI8vebofSI2Io+TaRCO7c0wvJF2UYJkTm3DZNFwlkLZ3MOwAH9YF4crGt8/cxmzfAJTF6gaOyfE7n2WC+/SEgWeJ89xSbhrDPifcshWLjGGzkrZtaeVRR7GwkzNnKJ36LUJaNWzk/gFS3gM0HzhhDh99MsDRMlaoOTc3z2se7A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bpGn2WIrr9sSAXNw9rIeKIjq2dc/WVRQCSIG/r2okrw=; b=CbKMxuvU3fRGzEWB623E0si2ayiL2y6CatfMKEixUXJ53IzRujbB9d0sWtA5p2Sranv/5oTS3YgUunWj2Wa9/pli3EGwJ2WJbn1bvJbmTeuf96ocoR0pW+FlIlDfwu5/ElBjoA1BZQyQyhwJGv4utGGzfn7+9Joyf3nQd6LZT3o= Received: from DB7PR08MB3292.eurprd08.prod.outlook.com (52.134.111.30) by DB7PR08MB3660.eurprd08.prod.outlook.com (20.176.239.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.27; Fri, 15 Nov 2019 10:00:32 +0000 Received: from DB7PR08MB3292.eurprd08.prod.outlook.com ([fe80::21ec:f698:b78e:d4b8]) by DB7PR08MB3292.eurprd08.prod.outlook.com ([fe80::21ec:f698:b78e:d4b8%7]) with mapi id 15.20.2451.029; Fri, 15 Nov 2019 10:00:32 +0000 From: Szabolcs Nagy To: GCC Patches , Rich Felker CC: nd Subject: [PATCH] musl: Don't use gthr weak refs in libgcc PR91737 Date: Fri, 15 Nov 2019 10:00:31 +0000 Message-ID: <64b3ba1c-185a-73a5-1669-a23fa04ddeab@arm.com> user-agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(979002)(4636009)(39860400002)(136003)(396003)(346002)(376002)(366004)(189003)(199004)(54534003)(486006)(4326008)(110136005)(58126008)(476003)(31686004)(7736002)(256004)(86362001)(2906002)(65806001)(65956001)(66066001)(31696002)(3846002)(99286004)(8676002)(4001150100001)(71200400001)(71190400001)(6116002)(5660300002)(36756003)(8936002)(478600001)(316002)(305945005)(44832011)(2616005)(66616009)(25786009)(6512007)(66476007)(66556008)(64756008)(66446008)(66946007)(52116002)(81156014)(81166006)(186003)(4744005)(102836004)(14454004)(26005)(6436002)(6506007)(386003)(6486002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR08MB3660; H:DB7PR08MB3292.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: lsfr7384HkPLCHKkwHaJja7/EEFv4z71ii2xDzHtr465PqQeK9PiM+Krw0qBS5G7aozTevVbefVgOmEmHxwCTKXxwqdMa2teQhQeLtxLcfnIu8gYBS5N0i6uaLoQQgD80cANWnrlRt7WWhobWuVrLc+vNfazVV+/YqVVHfJ6w3dQ1bOJuE07QdxjX2gZ5zXgPumI7h4V17KiuFcjtKFKx9EM4vB0yPoUHl4FZzDwDJadBYC/u+eo2JEHiHYoky2aJOkG31u//ANncqvmvFp41MhrC9THJqIFzg0YVsehhdEO+98GEYQjuf9fXaP9Cx3nYJfGZgUFnXi9N4gLhz9VHKX0XDkaYnqVerSls5tZfWAQGqJTl34lXii/mALorFio9vHAi/FCc8gbEwDgpJVPsti2dSe8eE1uGP8TaRffj4sQDc0MsLuMwPXo+KsuzLGF x-ms-exchange-transport-forked: True MIME-Version: 1.0 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 950c0a79-7f4b-4c00-558a-08d769b2a6b7 X-IsSubscribed: yes The gthr weak reference based single thread detection is unsafe with static linking and in case of dynamic linking it's ineffective on musl since pthread symbols are defined in libc.so. Ideally this should be fixed for all targets, since glibc plans to move libpthread.so into libc.so too and users want to static link to pthread without --whole-archive: PR87189. For now we have to explicitly opt out from the broken behaviour in the config machinery of each target lib and libgcc was previously missed. libgcc/ChangeLog: 2019-11-15 Szabolcs Nagy * config.host: Add t-gthr-noweak on *-*-musl*. * config/t-gthr-noweak: New file. diff --git a/libgcc/config.host b/libgcc/config.host index 122113fc519..fe1b9ab93d5 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1500,3 +1500,10 @@ aarch64*-*-*) tm_file="${tm_file} aarch64/value-unwind.h" ;; esac + +case ${host} in +*-*-musl*) + # The gthr weak references are unsafe with static linking + tmake_file="$tmake_file t-gthr-noweak" + ;; +esac diff --git a/libgcc/config/t-gthr-noweak b/libgcc/config/t-gthr-noweak new file mode 100644 index 00000000000..45a21e9361d --- /dev/null +++ b/libgcc/config/t-gthr-noweak @@ -0,0 +1,2 @@ +# Don't use weak references for single-thread detection +HOST_LIBGCC2_CFLAGS += -DGTHREAD_USE_WEAK=0