From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40124.outbound.protection.outlook.com [40.107.4.124]) by sourceware.org (Postfix) with ESMTPS id 161643858400 for ; Sat, 11 Sep 2021 21:08:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 161643858400 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dreambigsemi.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dreambigsemi.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H5HwvSUvL3f95kRtr2vztphjXODESPlyOEq0kmFUcdmwGmvNtgQuxRmNdIUIwGD3j2hzbEcTdAhJpca/lWRKt9gUnI0gyUEWUfiipTu5qd9N1O9/dqXxQT3bmj6UtUJNooHURL35lVmxg/jGk2M/pTJIxIFeVT3/JmJ8n60MEAdZTxIyGsGiT0s2Gb1HGHwlbI/O5QQR88+lR6Ti/d+n39BJvJbSItJgY7xCqR/yDc2LXFsCwDWnsGpIg3AcGCMm+FJDxTZn4LfkA7OzuuTMx4yn9RSLt2O3PuIftzbvRb0KkDDTxZH07c0ZnRrn+3UYPKZCk2W0pZhBRGo1fGV/xQ== 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; bh=o1Qju0hvESxLzz5TzUwLyAUgDyvReSQyPKFiMVZA4Xg=; b=Ngqhjv3L7OaYdrLsgNavXbb5j/4clljU4Yht48KgmMFxaRlmW+SzS2Q95tubx/iIOx6v1SDHP8sYS8e8IAEYcQ0cpTbpR1Hij7JZqpKZDkf8jraFBTG03PFBbGSc2HtDSwtcqP5BZlL/A5MPUkp5lllRJecrC7krjsj8bUCusjetYrFvZULSBA1WC3beJoXlPsjuW2hOa7JdQ2fpYzF8S+bc1plPd7/XIiMrnw9C4FPJS31BqSoT12iAm6L2/kUYezm1OydOVhrIobwMCrZEOA0Hw9FmPlK8CXEyaC/VRP5Ma3rVbi7sFupplMn4v7v2FHX5YZwA2pOO4EB2csGHtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=dreambigsemi.com; dmarc=pass action=none header.from=dreambigsemi.com; dkim=pass header.d=dreambigsemi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sahilsemi.onmicrosoft.com; s=selector1-sahilsemi-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o1Qju0hvESxLzz5TzUwLyAUgDyvReSQyPKFiMVZA4Xg=; b=kkHlzjkftuzoSqEru3iOkx6ZSBRhLDQ1JMnQbmP5l4LT2+Nf1KlXgtlO/mVbCqVvAtPo5+tZOi59BTPOLeBudPBfCOKZoSfbPnWfxg0nzzKERvdQRXJEO1pfKq+xU1N5cyvd5Qu50Gyihr9nshx/kKlr6SeOUW7ua1TtVpxXa2E= Received: from DB6PR02MB3111.eurprd02.prod.outlook.com (2603:10a6:6:18::20) by DB9PR02MB7132.eurprd02.prod.outlook.com (2603:10a6:10:228::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Sat, 11 Sep 2021 21:08:07 +0000 Received: from DB6PR02MB3111.eurprd02.prod.outlook.com ([fe80::30de:dcce:56fb:4324]) by DB6PR02MB3111.eurprd02.prod.outlook.com ([fe80::30de:dcce:56fb:4324%7]) with mapi id 15.20.4500.018; Sat, 11 Sep 2021 21:08:07 +0000 From: "HON LUU" To: Segher Boessenkool CC: "gcc-help@gcc.gnu.org" Subject: RE: gcc question Thread-Topic: gcc question Thread-Index: AdekvJPggO4q8358SWurPIiN0onjcQAENoKAAAFQoQAADQUpsABZoDEwAAFcx4AAN0oCMA== Date: Sat, 11 Sep 2021 21:08:06 +0000 Message-ID: References: <20210908162025.GO1583@gate.crashing.org> <20210910183609.GA1583@gate.crashing.org> In-Reply-To: <20210910183609.GA1583@gate.crashing.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: kernel.crashing.org; dkim=none (message not signed) header.d=none;kernel.crashing.org; dmarc=none action=none header.from=dreambigsemi.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c6e70310-3c66-42aa-ba79-08d975684099 x-ms-traffictypediagnostic: DB9PR02MB7132: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UqqLO5QMtkAyWD08CGbuw8x4pXFSjQwKWkrl6huB0lYksE/AjMyy1tPLoWAt1Kr6U2aNVAGqMFf2KmutaC63mfpuFhxCE40qBocm4X4/jh0iUCzAAlTDLefWsV9hcgPgilu2Nd33wS6KNvf+L4EWAYPPUvfoUKSOij0quZ/FDWCVcCu2qpIqv7Ydd0/drAYvNu0xRsQHpi9BP6RHEgLkNY8VN4FEtUIQnl6rHfC6tDUuiZCsswe+1T0/Nzdwj7mee4PfjSnPdTez682LjYdw/0Hm7tB8A0xFs6f1GNULRvHGffQYCgVuR93XB82wKFPO9f6R6LGYhvdjWE6D++PAVSBl+L0oqrgNHgmJ74upnBmqA+qRIg41u0d9lke5p6v4MS+fFIkD2dPZvp+qZyuIKXK1JH0+mP5hNNOzJSe85s2B98jvVBgtd+gOewAPlLu/W3Ye4eYtE4765IvR6Nt3ygrsa7sEQyBEbudyxhUzjHyD+73pQ075o0ya6WwTvv3/ipFzskyZjVU7cbjMurGFMc86TMAxT7Y0yjQtqdUAE9/GfpCWsmGx0RLVG4CIDcWESVggsUegfIMTuyGlBrbfEyJeL8YFflxwDhdJqkk5c+fI8PSbl5HjH6iRWJmZz2og51yQvSLsBX/ILoxSXxpkaTziDOZ0zPE5cdLo5Z0nONnZymqYzcuP9h53KBIWtBrdTYLKJbXFX6TmYNAKQpPhkw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR02MB3111.eurprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(39830400003)(366004)(376002)(346002)(136003)(8676002)(86362001)(6916009)(7696005)(316002)(9686003)(71200400001)(7116003)(53546011)(38070700005)(76116006)(6506007)(66556008)(55016002)(66446008)(64756008)(52536014)(186003)(83380400001)(66946007)(8936002)(66476007)(38100700002)(2906002)(3480700007)(4326008)(33656002)(478600001)(122000001)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Zuv6knWD+/MYa6IHdtDfGj6TMV7UH0DocNGA/XQg8IS2JKLsVihbcemd3zig?= =?us-ascii?Q?ErDxza5cexTKDw5CDw/RlUkE5FBwxv01iWsMkVne4+89gwzlaP84QFBcsihs?= =?us-ascii?Q?tLctsGragpdlSfyBlmcc1+6a+2p7LspVGsdFA/3X3r34iarrrUpcTw6zNOLa?= =?us-ascii?Q?LmsRDr/M/a7oYsu4aERGSS+eB1KpYCVExVNDg1m9wAo+Be0gYT5fBjsLxjvk?= =?us-ascii?Q?cW6RJNr4leKWmwQV7yy/wql5SgEGHZXIbwqp9L1+yymUScgvJiTZBsbeRoSt?= =?us-ascii?Q?p8Pp/qeo8s6gpSpqpUjBdTER0/akwr4Sx/2M6kIC39HfQF47tUARUV+QoDCw?= =?us-ascii?Q?4m9okHMDA4T+XKogdTmbVKeQQMtsxM5bNFaq+sCEf8T0RUqjXsJ0QDGi9yI3?= =?us-ascii?Q?qCAMgW6Upquf/cYO7blYyUqpRtbJAew+A+0aMGUIFnKOXCsl9Qey/5iH6cX6?= =?us-ascii?Q?UG6hFpXX/pRqio+NBf40Np6HIbI92Rx4RssldSb6+wjPzwlVlm3s5fm2WvHv?= =?us-ascii?Q?HVBSURNFgniOCAkYdpPZlRwOyiuqviFSgZXTxqm8Sv3nMRGMxxfJH5qNqWNM?= =?us-ascii?Q?/yjLnq3j5jTzUL1YsK1h/MxsQjf4m5CSZ6MQY7qshkpWFoA5BcaPZjFicSxS?= =?us-ascii?Q?EdGVZDqjTCSjNRz7tAjx9PaAARJEbZUoVYGvSj9OKUuQ4GSsxgn6c21DYvPk?= =?us-ascii?Q?4MxK25L7Em8oovUYdiIKGI3C2VrF8b8/erUySF+7b0xMy7/NTClsgdxZbEZ/?= =?us-ascii?Q?MHM6OsmaaI8iwACr6tQ6nIz60+i17h9+pbgV8Q8PnkgpGazw2Sh3JPsCv6WL?= =?us-ascii?Q?R0btkXMUyKnBv4t18roPWSI5h4PfS5UpgpX5OpfbEQa8Oqp3YNzWIg0zK+BK?= =?us-ascii?Q?ht2of1NHiaawMvQV6Ae/oXuSvAR3ixs83bevaeevRvE4+TyCGkyxFm2SGb3j?= =?us-ascii?Q?Sc3CU7viPG+vapnkwhKQIyRgwNT4UxT1M1fQnMMNfsTGuATLA8eFnV1eHqar?= =?us-ascii?Q?FaBNTDhvjvYdO0Y90gXJiQXoK8zTvPQ3lbJaiMRt7hzV1NOuxvnq+Q0bXk7F?= =?us-ascii?Q?XpRymqNRrPIeMCf9X1xP8sAL34CWwqXvuz/KJS1kOPukoZT/flSi0kljk+pI?= =?us-ascii?Q?fEEtGBPKkqKPIbPldOy7QE8rxGgIq35oil95ALEeejMMjuv5+53Gb+P4e80X?= =?us-ascii?Q?up2HnCzbHxOAZ3DXVIajgdror2eAK4O0Hb2dUAAMnFViErD0TRDJJM3nTslB?= =?us-ascii?Q?i5+vi/TghTou4XBzH0RgMv8oXrnFx75RO1cMieIronhpze53nQwSvDLy4UL5?= =?us-ascii?Q?TNx9+cKOJi9J5+17hFF0a5vRCtOkU6ISI7iC62E/pCfAUghFyh5OwyfH9emk?= =?us-ascii?Q?yOWhqixwtrE+gkNqWW6U6AlLIgEF?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: dreambigsemi.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DB6PR02MB3111.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6e70310-3c66-42aa-ba79-08d975684099 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2021 21:08:06.5693 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3aed37f4-94df-4e5b-ad12-1836f1e11430 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QwWrSUGePJ//E2cqljJ9XJwaGdVVgSYNm1HM2DRa44fYGCPu6Nwk2AEZG42/OsmDJe9SYNYZ9WMbSqlZHpqY4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR02MB7132 X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, 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 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 21:08:13 -0000 Hi Segher, Following is more information that I can collect. Please let me know if you= need anything else. Thank you very much for your help. Regards, Hon =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + this is part of the content of cdev.c, from which the error happened ... ... struct static_key_false test; int qdma_cdev_init(void) { =20 if (static_branch_unlikely(&test)) { printk("test...\n"); } return 0; } void qdma_cdev_cleanup(void) { } ... + static_branch_unlikely is defined as followed from /lib/modules/`uname -r= `/build/include/linux/jump_label.h : #define static_branch_unlikely(x) \ ({ \ bool branch; \ if (__builtin_types_compatible_p(typeof(*x), struct static_key_true)) \ branch =3D arch_static_branch_jump(&(x)->key, false); \ else if (__builtin_types_compatible_p(typeof(*x), struct static_key_false)= ) \ branch =3D arch_static_branch(&(x)->key, false); \ else \ branch =3D ____wrong_branch_error(); \ unlikely(branch); \ }) + the error is related to arch_static_branch_jump() which is defined from /= lib/modules/`uname -r`/build/arch/x86/include/asm/jump_label.h as followed: static __always_inline bool arch_static_branch(struct static_key *key, bool= branch) { asm_volatile_goto("1:" ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" ".pushsection __jump_table, \"aw\" \n\t" _ASM_ALIGN "\n\t" _ASM_PTR "1b, %l[l_yes], %c0 + %c1 \n\t" ".popsection \n\t" : : "i" (key), "i" (branch) : : l_yes); return false; l_yes: return true; } + The code compiled successfully in kernel mode with followed command: + make V=3D1 clean + make V=3D1 + The code failed to compile when I try to compile into user space mode wit= h the followed command: + make -f Makefile.user clean + make -f Makefile.user + Note that the difference between gcc command line between the 2 modes are= : + kernel: .... -fno-PIE ... -mcmodel=3Dkernel ... + user space: .... -fPIC ... < removed > ... + Another interesting note is: + if I remove -fPIC from user space gcc command, then the code compile = successfully. However -fPIC is the must for my project. -----Original Message----- From: Segher Boessenkool =20 Sent: Friday, September 10, 2021 11:36 AM To: HON LUU Cc: gcc-help@gcc.gnu.org Subject: Re: gcc question On Fri, Sep 10, 2021 at 05:58:07PM +0000, HON LUU wrote: > Hi Segher, >=20 > I wonder if you have any issues to reproduce the problem. > Attached is the tar ball of stand alone module, which duplicate the issue= . > There is a README file, should be straightforward to duplicate the issue. > You need to show the full code of the asm_volatile_goto, and the declarat= ions of everything used in its operands, for us to get a handle on what is = going on here. Bonus points if you manage to make a stand- alone compilabl= e testcase that shows the problem. If you write up a good email with all the necessary info, you will get an a= nswer (and a good answer!) much quicker. I do not particularly feel like d= oing all the work here. Sorry. Segher