From patchwork Wed Jan 1 23:13:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 1217011 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-516567-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bell.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ojTDGPmk"; 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 47p6R92w0zz9sPK for ; Thu, 2 Jan 2020 10:13:23 +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:to :from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=bS/bGH9VZ9jf8d8q ot8sl2GH1DCzyzACiGuzkWdmUV5C0pk2IJM2BIOrNIzAYx0sglPDa8JtobKESIvm sJxWT6J2lO6OhNJdzl7r7k3nmRoMwAmRFAH/IoUbHLvbk2hhbsk6a+gm7kQv34vu F1saxocWSD8RUp2z+5ScBsq0Xgo= 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:to :from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=NgqMHoZe+LScoVedxTRvJE ceK6U=; b=ojTDGPmkDUGothdVvm2pdYN/iRdDfp+pIu1pzlhIujFvOEyik0aYJa HgDjq+VpBpvjHd0ql5wpztyijWNmCIlnnFE+L53qa9i17iUF2Zeq4kgKNIk6Tpz1 QGbo+ufalnOpYnbKaCeT9ncxxn7WbhajOky8UWulV0+Zi3Io8tJc8= Received: (qmail 19374 invoked by alias); 1 Jan 2020 23:13:14 -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 19364 invoked by uid 89); 1 Jan 2020 23:13:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy= X-HELO: torfep02.bell.net Received: from simcoe208srvr.owm.bell.net (HELO torfep02.bell.net) (184.150.200.208) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Jan 2020 23:13:12 +0000 Received: from bell.net torfep02 184.150.200.158 by torfep02.bell.net with ESMTP id <20200101231310.QUZM16761.torfep02.bell.net@torspm01.bell.net> for ; Wed, 1 Jan 2020 18:13:10 -0500 Received: from [192.168.2.49] (really [70.53.53.104]) by torspm01.bell.net with ESMTP id <20200101231310.RMTH29322.torspm01.bell.net@[192.168.2.49]>; Wed, 1 Jan 2020 18:13:10 -0500 To: GCC Patches From: John David Anglin Subject: [committed] Fix placement of references to functions in COMDAT groups on hppa-linux Openpgp: preference=signencrypt Message-ID: <3b730c1c-9ca6-f788-aa47-b832599e62af@bell.net> Date: Wed, 1 Jan 2020 18:13:10 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 X-CM-Analysis: v=2.3 cv=KfusTjQD c=1 sm=1 tr=0 a=htCe9XT+XAlGhzqgweArVg==:117 a=htCe9XT+XAlGhzqgweArVg==:17 a=IkcTkHD0fZMA:10 a=Jdjhy38mL1oA:10 a=mDV3o1hIAAAA:8 a=EY90uka19CsI6hOA30cA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=QEXdDO2ut3YA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-CM-Envelope: MS4wfD3fY0QknejUoxsBPH/RWjXvaVCBuUDFn6D8rtCEIMZZXXKE9vtXeecr71NGlNRSvd+ulxG5IqDXYpHZHiJ6h1wMhSApzH9qXMb6irwuPcSOKFRrqhkU 0de2+RHnSOPdbZcRR18v7CUmZAIQZY+Tzg46w08NDJEW+sjFdIgCTP/Y26QdqhxpZqFLZVwV0HYWQg== When I changed pa_reloc_rw_mask() to allow references to function labels to be placed in .rodata*, I broke the handling of references to function labels in COMDAT groups. The linker only allows references in .data.rel.ro.local to be ignored. This change puts function label references back in .data.rel.ro.local when they refer to a function in a COMDAT group. Tested on hppa-unknown-linux-gnu. The change fixes the build of the Debian voronota package. Committed to trunk and gcc-9 branch. Dave 2020-01-01 John David Anglin PR target/67834 * config/pa/pa.c (pa_elf_select_rtx_section): New. Put references to COMDAT group function labels in .data.rel.ro.local section. * config/pa/pa32-linux.h (TARGET_ASM_SELECT_RTX_SECTION): Define. Index: config/pa/pa.c =================================================================== --- config/pa/pa.c (revision 279798) +++ config/pa/pa.c (working copy) @@ -203,6 +203,7 @@ static bool pa_modes_tieable_p (machine_mode, machine_mode); static bool pa_can_change_mode_class (machine_mode, machine_mode, reg_class_t); static HOST_WIDE_INT pa_starting_frame_offset (void); +static section* pa_elf_select_rtx_section(machine_mode, rtx, unsigned HOST_WIDE_INT) ATTRIBUTE_UNUSED; /* The following extra sections are only used for SOM. */ static GTY(()) section *som_readonly_data_section; @@ -9838,6 +9839,26 @@ return data_section; } +/* Implement pa_elf_select_rtx_section. If X is a function label operand + and the function is in a COMDAT group, place the plabel reference in the + .data.rel.ro.local section. The linker ignores references to symbols in + discarded sections from this section. */ + +static section * +pa_elf_select_rtx_section (machine_mode mode, rtx x, + unsigned HOST_WIDE_INT align) +{ + if (function_label_operand (x, VOIDmode)) + { + tree decl = SYMBOL_REF_DECL (x); + + if (DECL_P (decl) && DECL_COMDAT_GROUP (decl)) + return get_named_section (NULL, ".data.rel.ro.local", 1); + } + + return default_elf_select_rtx_section (mode, x, align); +} + /* Implement pa_reloc_rw_mask. */ static int Index: config/pa/pa32-linux.h =================================================================== --- config/pa/pa32-linux.h (revision 279798) +++ config/pa/pa32-linux.h (working copy) @@ -76,3 +76,8 @@ rodata when generating non-PIC code. */ #undef JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) + +/* We need to override default selection to put references to functions + in COMDAT groups in .data.rel.ro.local. */ +#undef TARGET_ASM_SELECT_RTX_SECTION +#define TARGET_ASM_SELECT_RTX_SECTION pa_elf_select_rtx_section