From patchwork Thu Jul 20 10:13:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 123159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3012807vqt; Thu, 20 Jul 2023 03:14:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlGrfgflOa+UilaSfIcDkRslniTZpyOzLVejtKBWFUF3v3Xjde3Ossfop6hTFDgB6SZcxrYK X-Received: by 2002:a17:906:6a03:b0:994:34a2:8727 with SMTP id qw3-20020a1709066a0300b0099434a28727mr6170141ejc.41.1689848071452; Thu, 20 Jul 2023 03:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689848071; cv=none; d=google.com; s=arc-20160816; b=yXYz4OidZDsElj6qZD+HLH6gN6O+1tN1oQZtvhNTsdd7VQURYINq/SvQU6DqPmGLAY RIlQhpFj33GxcYM86rq0Kw6aHafiqxGrSw1EZB/jYt4tYM8JXhoa1IF2/WJ/0D+DhSyA xpkuM8A9ihyfBz4TGgRNLPdfBBdDUB5Z8u4ctmNVP7uTmCrr+yVhZdRQuI23zIo3Kq2F zH4jmS/eUIkEQUJxFhoO2wzlvndiPPRxpqc/ClSlLuLsIEQr6qNnaMJYvWAvXSj80V1s eQThcVeBarSkz4G1eORQXpkh1SNq6AZRg9SG2fCQ+gVtNhhqcy48jbYYK6Qigtaz/3Sj k2bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:subject:cc:to:content-language:user-agent :date:message-id:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=WBW1eOM1q8Ohnp8uIgILqJYr57ZUN7ze/QB1cvvu1r0=; fh=MY7ogiIQLKpQA9OUqsvtQmPDwqgVY3qbISFfxYMP0iI=; b=rlYplLVkxaRDLXnPRIEaeIvhLxAno2mlY9gIbkdRHkAkLZABcGbVcgCwCmvS5+bluv zr5x0/naGEJcZDtU4zMA0a+6m503bUn6hMhgg0Wl6DMzhW6QuO/7cX8g11cWAyHhaMSu 2zmWa9L2VHWVOmUm0Lr6TMpfnXR216NCnlYyTkh0dIfZSw1mbkAm8r44Zd/O7OGu2d1y Qthos3R3Gs9O8LkOqgAFm6rpf0FhZGYHPmcqXHV10oPfSE9GGmS9Hu9fayG7P3DfPlro JG01L3bXOZ/B4tCAxpyw1EmObZDjnSdDM8sJjx98SZVTMBqpM4D2oNfrTav1Oz19SESF mUnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=bPdaa6XE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id jt5-20020a170906dfc500b00992ae4cf3basi454040ejc.996.2023.07.20.03.14.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 03:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=bPdaa6XE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 507F7385AF9B for ; Thu, 20 Jul 2023 10:14:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 507F7385AF9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689848070; bh=WBW1eOM1q8Ohnp8uIgILqJYr57ZUN7ze/QB1cvvu1r0=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=bPdaa6XEbSfxwwamf3cxQhNeSsK5pxMgEG3vVVtQKHPjphxlk3W5Vo87SHuBOfoVT wjqtF0YIf/pQJEkCZkNoQSeo8IZNSwB2RXzqpFIQd6z3ZnCRG7DwStHv60FroeWtle jnxPCG6kjIJ3oEFwLuRg5BSk+bAhL+g/ANPNk+P0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 4F4573858CDB for ; Thu, 20 Jul 2023 10:13:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F4573858CDB Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36K9d8jf001748; Thu, 20 Jul 2023 10:13:42 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ry018491b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jul 2023 10:13:42 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36KA8W5i011708; Thu, 20 Jul 2023 10:13:42 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ry018490v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jul 2023 10:13:41 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36K9t5kf003352; Thu, 20 Jul 2023 10:13:41 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3rv65xp49s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jul 2023 10:13:41 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36KADdAH41091628 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Jul 2023 10:13:39 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3DFA920043; Thu, 20 Jul 2023 10:13:39 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8558120040; Thu, 20 Jul 2023 10:13:37 +0000 (GMT) Received: from [9.177.28.8] (unknown [9.177.28.8]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 20 Jul 2023 10:13:37 +0000 (GMT) Message-ID: Date: Thu, 20 Jul 2023 18:13:25 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches Cc: Fangrui Song , Richard Biener , Richard Sandiford Subject: [PATCH] testsuite: Add a test case for PR110729 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 9DNP6HtBYfVKPCQqkMdLiFjdZdird9aW X-Proofpoint-ORIG-GUID: -KQUY1EpmLyfbItcmLwrynLz679rYwBP X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-20_04,2023-07-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 suspectscore=0 adultscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307200084 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771934131181632144 X-GMAIL-MSGID: 1771934131181632144 Hi, As PR110729 reported, there was one issue for .section __patchable_function_entries with -ffunction-sections, that is we put the same symbol as link_to section symbol for all functions wrongly. The commit r13-4294 for PR99889 has fixed this with the corresponding label LPFE* which sits in the function_section. As Fangrui suggested[1], this patch is to add a bit more test coverage. I didn't find a good way to check all linked_to symbols are different, so I checked for LPFE[012] here. [1] https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624866.html Tested well on x86_64-redhat-linux, powerpc64-linux-gnu P7/P8/P9 and powerpc64le-linux-gnu P9/P10. Is it ok for trunk? BR, Kewen ----- PR testsuite/110729 gcc/testsuite/ChangeLog: * gcc.dg/pr110729.c: New test. --- gcc/testsuite/gcc.dg/pr110729.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr110729.c -- 2.39.3 diff --git a/gcc/testsuite/gcc.dg/pr110729.c b/gcc/testsuite/gcc.dg/pr110729.c new file mode 100644 index 00000000000..92dfd8ae000 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr110729.c @@ -0,0 +1,29 @@ +/* { dg-do compile { target { ! { nvptx*-*-* visium-*-* } } } } */ +/* { dg-require-effective-target o_flag_in_section } */ +/* { dg-options "-ffunction-sections -fpatchable-function-entry=2" } */ +/* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */ + +/* Verify there are three different link_to symbols for three + .section __patchable_function_entries respectively. */ + +int +f () +{ + return 1; +} + +int +g () +{ + return 2; +} + +int +h () +{ + return 3; +} + +/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE0} 1 } } */ +/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE1} 1 } } */ +/* { dg-final { scan-assembler-times {.section[\t ]*__patchable_function_entries,.*,\.LPFE2} 1 } } */