From patchwork Wed Feb 16 08:42:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HAO CHEN GUI X-Patchwork-Id: 51150 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA5FC3858437 for ; Wed, 16 Feb 2022 08:42:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA5FC3858437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1645000965; bh=4y7tqYyMMh4gBtzhCQZxjQV3/XRFjWYOt2vY06QbgXc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=o7JDq6yr6pXVPe6LUjLErU1x0btzjYW3peDpqNaO+qrgdgTvjD7iqqEOZ/xAzOrBa LqmzFYDt1/W2x78R7Y8FxETDWJHjZAdJPxkX1yJ/Mq3qMh02jSPCXGp4zZW88fiyOy 9k86roP31j/aL0qrIKtERaH/ui8JQyYGwNKW3upU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 972903858D3C for ; Wed, 16 Feb 2022 08:42:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 972903858D3C Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21G798Sv005977; Wed, 16 Feb 2022 08:42:15 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8utetk51-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 08:42:15 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21G8gEeq019717; Wed, 16 Feb 2022 08:42:14 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8utetk4b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 08:42:14 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21G8c6KF029228; Wed, 16 Feb 2022 08:42:12 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma01fra.de.ibm.com with ESMTP id 3e64h9mmu4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 08:42:12 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21G8VlrO49742118 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Feb 2022 08:31:47 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27A2D11C05E; Wed, 16 Feb 2022 08:42:10 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2A7411C058; Wed, 16 Feb 2022 08:42:08 +0000 (GMT) Received: from [9.200.101.176] (unknown [9.200.101.176]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 16 Feb 2022 08:42:08 +0000 (GMT) Message-ID: Date: Wed, 16 Feb 2022 16:42:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Content-Language: en-US To: gcc-patches Subject: [PATCH v2, rs6000] Enable absolute jump table for PPC AIX and Linux X-TM-AS-GCONF: 00 X-Proofpoint-GUID: DwapgI5V_dwMkPKP8yCgdhctQnkfsooJ X-Proofpoint-ORIG-GUID: wcepSSqfJ_1yLCFXgtcBrlaN6NJgV10n X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-16_04,2022-02-14_04,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 adultscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160047 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: HAO CHEN GUI via Gcc-patches From: HAO CHEN GUI Reply-To: HAO CHEN GUI Cc: Bill Schmidt , David , Segher Boessenkool Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch enables absolute jump tables on PPC AIX and Linux. For AIX, the jump table is placed in data section. For Linux, it is placed in RELRO section when relocation is needed. Bootstrapped and tested on AIX,Linux BE and LE with no regressions. Is this okay for trunk? Any recommendations? Thanks a lot. ChangeLog 2022-02-16 Haochen Gui gcc/ * config/rs6000/aix.h (JUMP_TABLES_IN_TEXT_SECTION): Define. * config/rs6000/linux64.h (JUMP_TABLES_IN_TEXT_SECTION): Likewise. * config/rs6000/rs6000.cc (rs6000_option_override_internal): Enable absolute jump tables for AIX and Linux. (rs6000_xcoff_function_rodata_section): Implement. * config/rs6000/xcoff.h (TARGET_ASM_FUNCTION_RODATA_SECTION): Define. patch.diff diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index ad3238bf09a..b52208c2ee7 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -253,7 +253,7 @@ /* Indicate that jump tables go in the text section. */ -#define JUMP_TABLES_IN_TEXT_SECTION 1 +#define JUMP_TABLES_IN_TEXT_SECTION 0 /* Define any extra SPECS that the compiler needs to generate. */ #undef SUBTARGET_EXTRA_SPECS diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index b2a7afabc73..16df9ef167f 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -239,7 +239,7 @@ extern int dot_symbols; /* Indicate that jump tables go in the text section. */ #undef JUMP_TABLES_IN_TEXT_SECTION -#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT +#define JUMP_TABLES_IN_TEXT_SECTION 0 /* The linux ppc64 ABI isn't explicit on whether aggregates smaller than a doubleword should be padded upward or downward. You could diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index bc3ef0721a4..e9c5552c082 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -4954,6 +4954,10 @@ rs6000_option_override_internal (bool global_init_p) warning (0, "%qs is deprecated and not recommended in any circumstances", "-mno-speculate-indirect-jumps"); + /* Enable absolute jump tables for AIX and Linux. */ + if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) + rs6000_relative_jumptables = 0; + return ret; } @@ -28751,6 +28755,15 @@ constant_generates_xxspltidp (vec_const_128bit_type *vsx_const) return sf_value; } +section * rs6000_xcoff_function_rodata_section (tree decl ATTRIBUTE_UNUSED, + bool relocatable) +{ + if (relocatable) + return data_section; + else + return readonly_data_section; +} + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index cd0f99cb9c6..0dacd86eed9 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -98,7 +98,7 @@ #define TARGET_ASM_SELECT_SECTION rs6000_xcoff_select_section #define TARGET_ASM_SELECT_RTX_SECTION rs6000_xcoff_select_rtx_section #define TARGET_ASM_UNIQUE_SECTION rs6000_xcoff_unique_section -#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section +#define TARGET_ASM_FUNCTION_RODATA_SECTION rs6000_xcoff_function_rodata_section #define TARGET_STRIP_NAME_ENCODING rs6000_xcoff_strip_name_encoding #define TARGET_SECTION_TYPE_FLAGS rs6000_xcoff_section_type_flags #ifdef HAVE_AS_TLS