From patchwork Wed Feb 8 19:52:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64499 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 BAF583858C39 for ; Wed, 8 Feb 2023 19:53:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAF583858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675885985; bh=89Ksc3Ymztn9aIYfd8kNEeHwkZnewrCCc9MnyAzi7Ak=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=TOr1QsURs6rG3P+ff6U+j4V4o0ejed7BXCLg7gyF+djZYr2rOzJ+1KeS02a1aE9of hjG/1ee0Ifm+ud/vtdwxOShXjXZuw0BosQbc4IdOB5UPiXDJOAqK03aYr10KrxxGct QB9wbjyLqgNiSULeV7LbsQWii7ZJsZ5oYPIghnZQ= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 998533858C53 for ; Wed, 8 Feb 2023 19:52:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 998533858C53 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318J8vQm005444; Wed, 8 Feb 2023 19:52:36 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmhdch8rn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:36 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3186Ivj8023711; Wed, 8 Feb 2023 19:52:33 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3nhf06wakw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:33 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqUtH46989746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:30 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D94E2004B; Wed, 8 Feb 2023 19:52:30 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB47220043; Wed, 8 Feb 2023 19:52:29 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:29 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 1/7] libasm: Fix xdefault_pattern initialization Date: Wed, 8 Feb 2023 20:52:20 +0100 Message-Id: <20230208195226.144143-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: R5Fh2IUncV56qkIJIxTR02LNykKoXQBy X-Proofpoint-GUID: R5Fh2IUncV56qkIJIxTR02LNykKoXQBy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 impostorscore=0 clxscore=1015 malwarescore=0 mlxscore=0 mlxlogscore=891 spamscore=0 adultscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" clang complains: asm_newscn.c:48:22: error: field 'pattern' with variable sized type 'struct FillPattern' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] struct FillPattern pattern; ^ Fix by using a union instead. Define the second union member to be a char array 1 byte larger than struct FillPattern. This should be legal according to 6.7.9: If an object that has static or thread storage duration is not initialized explicitly, then ... if it is a union, the first named member is initialized (recursively) according to these rules, and any padding is initialized to zero bits. Signed-off-by: Ilya Leoshkevich --- libasm/asm_newscn.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c index d258d969..f28c40f9 100644 --- a/libasm/asm_newscn.c +++ b/libasm/asm_newscn.c @@ -41,19 +41,25 @@ /* Memory for the default pattern. The type uses a flexible array - which does work well with a static initializer. So we play some - dirty tricks here. */ -static const struct + which does work well with a static initializer. Work around this by + wrapping it in a union, whose second member is a char array 1 byte larger + than struct FillPattern. According to 6.7.9, this does what we need: + + If an object that has static or thread storage duration is not + initialized explicitly, then ... if it is a union, the first named + member is initialized (recursively) according to these rules, and + any padding is initialized to zero bits. */ + +static const union { struct FillPattern pattern; - char zero; + char zeroes[sizeof(struct FillPattern) + 1]; } xdefault_pattern = { .pattern = { .len = 1 }, - .zero = '\0' }; const struct FillPattern *__libasm_default_pattern = &xdefault_pattern.pattern; From patchwork Wed Feb 8 19:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64498 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 7D08F3858022 for ; Wed, 8 Feb 2023 19:53:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D08F3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675885983; bh=oXDtSD4zhN/8ks/1ziNkjkENriUOOVOzU2Fcx0os+nM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=n1+KRw+hRjzUeXtVSbQQOTtnyZhlU9diokvIdWFX9OysFghrCJYK60qgw7obF6S1v FlTbRsC0bodCZ2YlUdigvZC/ENGpUemTgbULfA1nBFzMbmnfCMyl+WWPS6/KgAnlKA bjSs97B8qyxF/2gLbg5jIrpHEe0ZJHlzbXpgDU/c= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id C30973858D39 for ; Wed, 8 Feb 2023 19:52:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C30973858D39 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318Jm96V015362; Wed, 8 Feb 2023 19:52:37 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmj7a827b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:36 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3183i5hF022813; Wed, 8 Feb 2023 19:52:35 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3nhemfksma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:35 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqVRU21103146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:31 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B23D20049; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15A7E20043; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:30 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 2/7] printversion: Fix unused variable Date: Wed, 8 Feb 2023 20:52:21 +0100 Message-Id: <20230208195226.144143-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: FCEzTwXxdt2lqY6UL29IaaQnwhEwAD4- X-Proofpoint-ORIG-GUID: FCEzTwXxdt2lqY6UL29IaaQnwhEwAD4- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" clang complains: debuginfod.cxx:354:1: error: unused variable 'apba__' [-Werror,-Wunused-const-variable] ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; ^ ../lib/printversion.h:47:21: note: expanded from macro 'ARGP_PROGRAM_BUG_ADDRESS_DEF' const char *const apba__ __asm ("argp_program_bug_address") ^ This is as expected: it's used by argp via the "argp_program_bug_address" name, which is not visible on the C level. Add __attribute__ ((used)) to make sure that the compiler emits it. While at it, fix debuginfod not printing the bug report address. Signed-off-by: Ilya Leoshkevich --- lib/printversion.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/printversion.h b/lib/printversion.h index a9e059ff..37adff7e 100644 --- a/lib/printversion.h +++ b/lib/printversion.h @@ -39,11 +39,14 @@ void print_version (FILE *stream, struct argp_state *state); argp_program_bug_address, in all programs. argp.h declares these variables as non-const (which is correct in general). But we can do better, it is not going to change. So we want to move them into - the .rodata section. Define macros to do the trick. */ + the .rodata section. Define macros to do the trick. The default + linkage for consts in C++ is internal, so declare them extern. */ #define ARGP_PROGRAM_VERSION_HOOK_DEF \ void (*const apvh) (FILE *, struct argp_state *) \ __asm ("argp_program_version_hook") #define ARGP_PROGRAM_BUG_ADDRESS_DEF \ - const char *const apba__ __asm ("argp_program_bug_address") + extern const char *const apba__; \ + const char *const apba__ __asm ("argp_program_bug_address") \ + __attribute__ ((used)) #endif // PRINTVERSION_H From patchwork Wed Feb 8 19:52:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64500 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 B4EA63858000 for ; Wed, 8 Feb 2023 19:53:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4EA63858000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675885986; bh=IeMwnRzP5TbyJJ/dxG6byLSiVj2UW6M4htDUm8HZnxM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=QPP16m/byjAkNzSLvcQxtLJTVgJK8R9FDutitCh/ChKnDQaPbpzz0bgbYGNj0ezjE 3uB55lHZDBtn+UzztsR4bi8cRT+a3zMtx5gq+GwmNbkCW0Dm9i508JBwNrRQyNWWZf wQ9KlnaV4SHJ+n1+XPlYf1lfDT9BszrTqKP7ihws= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 96CE33858C5E for ; Wed, 8 Feb 2023 19:52:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 96CE33858C5E Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318JncgG023283; Wed, 8 Feb 2023 19:52:38 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmj8302dh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:38 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3182kWG8017256; Wed, 8 Feb 2023 19:52:36 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3nhf06usf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:35 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqWx151511744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:32 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 386CE20043; Wed, 8 Feb 2023 19:52:32 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E52A020040; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 3/7] readelf: Fix set but not used parameter Date: Wed, 8 Feb 2023 20:52:22 +0100 Message-Id: <20230208195226.144143-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: O3Ov_MoXqzszz_jsnUGiWZPTr8XSob6m X-Proofpoint-GUID: O3Ov_MoXqzszz_jsnUGiWZPTr8XSob6m X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 phishscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 malwarescore=0 mlxlogscore=847 adultscore=0 suspectscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" clang complains: readelf.c:12205:72: error: parameter 'desc' set but not used [-Werror,-Wunused-but-set-parameter] handle_bit_registers (const Ebl_Register_Location *regloc, const void *desc, ^ Mark Wielaard says: It is never really used since as far as I can see we don't have any backend with a core register sets where a register doesn't have a number of bits which isn't a multiple of 8 (only ia64 has some 1 bit registers, but those don't seem part of the core register set). If we do accidentally try to handle such a register having an abort is also not very nice. Lets just warn and return/continue. https://sourceware.org/bugzilla/show_bug.cgi?id=30084 Co-developed-by: Mark Wielaard Signed-off-by: Ilya Leoshkevich --- src/readelf.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 0bbd708e..5b3319c2 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -12199,24 +12199,17 @@ handle_core_items (Elf *core, const void *desc, size_t descsz, return colno; } -static unsigned int -handle_bit_registers (const Ebl_Register_Location *regloc, const void *desc, - unsigned int colno) -{ - desc += regloc->offset; - - abort (); /* XXX */ - return colno; -} - - static unsigned int handle_core_register (Ebl *ebl, Elf *core, int maxregname, const Ebl_Register_Location *regloc, const void *desc, unsigned int colno) { if (regloc->bits % 8 != 0) - return handle_bit_registers (regloc, desc, colno); + { + error (0, 0, "Warning: Cannot handle register with %" PRIu8 "bits\n", + regloc->bits); + return colno; + } desc += regloc->offset; From patchwork Wed Feb 8 19:52:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64502 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 EFCD43850401 for ; Wed, 8 Feb 2023 19:53:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EFCD43850401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675886015; bh=Ri02A5Mf+HnwfkNDfbJq9wlenoTh+FjkFeNFRat5C6o=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=tkyyDIzcp6mlnOvXM+Aoh1njD1uhn+4weBcaPHwk5j31QZpCg7x8H2SnWScDMo20B HgpeYxu0Z9y3aUB0tcUy8XWnigMNZ20co6wfW22tQh6KlYdrMsv2so3GON0AVntYOe 1HMauQF8mLUz5ZI40CtHIAGe7eCRyeZD4MZZ8zKw= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 00CC73858C39 for ; Wed, 8 Feb 2023 19:52:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 00CC73858C39 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318J8uQc005413; Wed, 8 Feb 2023 19:52:39 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmhdch8uc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:39 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3185agCr024247; Wed, 8 Feb 2023 19:52:36 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3nhf06wakx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:36 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqXNI47186376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:33 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 069FA20043; Wed, 8 Feb 2023 19:52:33 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AACD620040; Wed, 8 Feb 2023 19:52:32 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:32 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 4/7] x86_64_return_value_location: Support lvalue and rvalue references Date: Wed, 8 Feb 2023 20:52:23 +0100 Message-Id: <20230208195226.144143-5-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: nhDCDI_eVDzioS1YApcEIXgul9-KVz2M X-Proofpoint-GUID: nhDCDI_eVDzioS1YApcEIXgul9-KVz2M X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 impostorscore=0 clxscore=1015 malwarescore=0 mlxscore=0 mlxlogscore=978 spamscore=0 adultscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" On the low level, they are the same as pointers. Signed-off-by: Ilya Leoshkevich --- backends/x86_64_retval.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backends/x86_64_retval.c b/backends/x86_64_retval.c index f9114cb1..e668eacc 100644 --- a/backends/x86_64_retval.c +++ b/backends/x86_64_retval.c @@ -106,6 +106,8 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: + case DW_TAG_reference_type: + case DW_TAG_rvalue_reference_type: { Dwarf_Attribute attr_mem; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, From patchwork Wed Feb 8 19:52:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64501 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 DEB6B3858410 for ; Wed, 8 Feb 2023 19:53:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DEB6B3858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675885997; bh=GC2+TvpkOnSImAMW3MxSj8xwYpHecNKNQtyHB4Qw90I=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=lcPQ4yEJTbBqfdmyXG4izcQbnN0HFWQfP2j0EGNVeFJgmTJa2tFVp3Z44zN4c3PKu QRrmEVOdnTv998kf5yFp1wlrSz2JMpUlqw3zwBd6OeH6SkS/4/JIdpdYgBgoQw4LjE fS5qgQZqv0t1Cr2itEjPL6HaIEMMw+d/zsa+Qt3w= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id F18DF3858C60 for ; Wed, 8 Feb 2023 19:52:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F18DF3858C60 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318Jlvqt014929; Wed, 8 Feb 2023 19:52:39 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmj7a828j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:39 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 318IuZck007292; Wed, 8 Feb 2023 19:52:37 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3nhemfksmb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:37 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqXra49086924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:33 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BA53420043; Wed, 8 Feb 2023 19:52:33 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C0E120040; Wed, 8 Feb 2023 19:52:33 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:33 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 5/7] configure: Use -fno-addrsig if possible Date: Wed, 8 Feb 2023 20:52:24 +0100 Message-Id: <20230208195226.144143-6-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: IRC2zCSuqD1kO9zPoo9tnKZsotDqnmlm X-Proofpoint-ORIG-GUID: IRC2zCSuqD1kO9zPoo9tnKZsotDqnmlm X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" By default, clang produces .llvm_addrsig sections [1]. The GNU toolchain does not know how to handle them yet [2], so just ask clang not to generate them for the time being. [1] https://llvm.org/docs/Extensions.html#sht-llvm-addrsig-section-address-significance-table [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105625 Signed-off-by: Ilya Leoshkevich --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 8fe8baee..7dc9be63 100644 --- a/configure.ac +++ b/configure.ac @@ -588,6 +588,14 @@ CFLAGS="$old_CFLAGS"]) AM_CONDITIONAL(HAVE_NO_PACKED_NOT_ALIGNED_WARNING, [test "x$ac_cv_no_packed_not_aligned" != "xno"]) +AC_CACHE_CHECK([whether the compiler accepts -fno-addrsig], ac_cv_fno_addrsig, [dnl +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fno-addrsig -Werror" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], + ac_cv_fno_addrsig=yes, ac_cv_fno_addrsig=no) +CFLAGS="$old_CFLAGS"]) +AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig") + saved_LIBS="$LIBS" AC_SEARCH_LIBS([argp_parse], [argp]) LIBS="$saved_LIBS" From patchwork Wed Feb 8 19:52:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64504 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 0084B385B522 for ; Wed, 8 Feb 2023 19:54:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0084B385B522 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675886060; bh=VokYeezrCtap3TNQ36aPgRdxJ/3XkNQJOslIhJFcZ8s=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=f7t0KWnz8etwHogb7Y6oe5DLKu+OO6BSwJM3jZ6APY7HCwOBZfJW6ARJXrnhF0Hec bV2Z9kUC86dNbeQRYA6SD/zjd5TNijfX0c3IzqJ/OfMF5f7g+KkTYGF9k1cs5uNAow TYjxDm/09AGvqDVvbMjHs1EFw6LPWjPHoGMJOe1Y= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 0B35A3858423 for ; Wed, 8 Feb 2023 19:52:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B35A3858423 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318JflWh002424; Wed, 8 Feb 2023 19:52:40 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmj47r7xw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:40 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 318JH5sH024301; Wed, 8 Feb 2023 19:52:38 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3nhf06wam0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:37 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqYPL46858654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:34 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 786A920040; Wed, 8 Feb 2023 19:52:34 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28E6220049; Wed, 8 Feb 2023 19:52:34 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:34 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 6/7] configure: Add --disable-demangler Date: Wed, 8 Feb 2023 20:52:25 +0100 Message-Id: <20230208195226.144143-7-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: xsxCjx67LsC53D_rHxVHqx8CM2bCvBhZ X-Proofpoint-ORIG-GUID: xsxCjx67LsC53D_rHxVHqx8CM2bCvBhZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 impostorscore=0 spamscore=0 mlxlogscore=689 adultscore=0 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" __cxa_demangle is normally implemented in the C++ runtime library, instrumenting which for MSan is a hassle. Add a knob for disbling it. Signed-off-by: Ilya Leoshkevich --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7dc9be63..62a4c8a7 100644 --- a/configure.ac +++ b/configure.ac @@ -466,11 +466,17 @@ CFLAGS="$CFLAGS -D_GNU_SOURCE" AC_FUNC_STRERROR_R() CFLAGS="$old_CFLAGS" +AC_ARG_ENABLE([demangler], +AS_HELP_STRING([--disable-demangler], + [Disable libstdc++ demangle support]), + [], [enable_demangler=yes]) +AS_IF([test "x$enable_demangler" == xyes], AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])]) AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes") AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"], - [enable_demangler=yes],[enable_demangler=no]) + [enable_demangler=yes],[enable_demangler=no]), +AM_CONDITIONAL(DEMANGLE, false)) AC_ARG_ENABLE([textrelcheck], AS_HELP_STRING([--disable-textrelcheck], From patchwork Wed Feb 8 19:52:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64503 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 F13D7385480B for ; Wed, 8 Feb 2023 19:54:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F13D7385480B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675886049; bh=Fhoyinr01Lo0w3TjQ56waDU/w6oEML8yxmmXam7lcFc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=wVjcWi5HMP/vMyGaD7msr/6jpKkF9Ek1tHl2jLC6EJxiQ51bT5EQYDln6jq8YbaNj RpOZc6jDtW5o5yXtTME/7sE9RqBxCMigh+MZ3vum4bwia78oVsUMwNgHbcrwjYRz2R t3K3mslrnHW/GpABvbPdaunkYB8PC0C1QDmC/Poo= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 6A6ED3858D39 for ; Wed, 8 Feb 2023 19:52:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A6ED3858D39 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318J0XOw028473; Wed, 8 Feb 2023 19:52:40 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmhby1ghv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:40 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 318DjQnd017584; Wed, 8 Feb 2023 19:52:38 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3nhemfksmc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:38 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqZve46203154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:35 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DAE92004B; Wed, 8 Feb 2023 19:52:35 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D21E920040; Wed, 8 Feb 2023 19:52:34 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:34 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 7/7] configure: Add --enable-sanitize-memory Date: Wed, 8 Feb 2023 20:52:26 +0100 Message-Id: <20230208195226.144143-8-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: BLRJi5jJ97-gDvygUdcx1lPDhDDuizTx X-Proofpoint-ORIG-GUID: BLRJi5jJ97-gDvygUdcx1lPDhDDuizTx X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 adultscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 mlxlogscore=934 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Add support for clang Memory Sanitizer [1], which detects the usage of uninitialized values. While elfutils itself is already checked with valgrind, checking code that depends on elfutils requires elfutils to be built with MSan. MSan is not linked into shared libraries, and is linked into executables statically. Therefore, unlike the other sanitizers, MSan needs to be configured fairly early, since we need to drop -D_FORTIFY_SOURCE [2], -Wl,-z,defs and --no-undefined. Disable a few tests that run for more than 5 minutes due to test files being statically linked with MSan. [1] https://clang.llvm.org/docs/MemorySanitizer.html [2] https://github.com/google/sanitizers/issues/247 Signed-off-by: Ilya Leoshkevich --- configure.ac | 24 ++++++++++++++++++++++++ debuginfod/Makefile.am | 3 ++- libasm/Makefile.am | 3 ++- libdw/Makefile.am | 3 ++- libelf/Makefile.am | 3 ++- tests/Makefile.am | 10 +++++++++- tests/run-readelf-self.sh | 5 +++++ tests/run-strip-reloc.sh | 5 +++++ tests/run-varlocs-self.sh | 5 +++++ 9 files changed, 56 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 62a4c8a7..0eb309cf 100644 --- a/configure.ac +++ b/configure.ac @@ -155,6 +155,29 @@ AC_SUBST([fpie_CFLAGS]) dso_LDFLAGS="-shared" +NO_UNDEFINED=-Wl,--no-undefined +AC_ARG_ENABLE([sanitize-memory], + AS_HELP_STRING([--enable-sanitize-memory], + [Use clang memory sanitizer]), + [use_msan=$enableval], [use_msan=no]) +if test "$use_msan" = yes; then + old_CFLAGS="$CFLAGS" + old_CXXFLAGS="$CXXFLAGS" + old_LDFLAGS="$LDFLAGS" + # -fsanitize=memory is not compatible with -D_FORTIFY_SOURCE, -Wl,-z,defs and --no-undefined + CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins -D_FORTIFY_SOURCE=0" + CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins -D_FORTIFY_SOURCE=0" + LDFLAGS="-shared" + AC_LINK_IFELSE([AC_LANG_SOURCE([int main (int argc, char **argv) { return 0; }])], use_msan=yes, use_msan=no) + AS_IF([test "x$use_msan" == xyes], + ac_cv_zdefs=no NO_UNDEFINED=, + AC_MSG_WARN([clang memory sanitizer not available]) + CFLAGS="$old_CFLAGS" CXXFLAGS="$old_CXXFLAGS") + LDFLAGS="$old_LDFLAGS" +fi +AC_SUBST(NO_UNDEFINED) +AM_CONDITIONAL(USE_MEMORY_SANITIZER, test "$use_msan" = yes) + ZDEFS_LDFLAGS="-Wl,-z,defs" AC_CACHE_CHECK([whether gcc supports $ZDEFS_LDFLAGS], ac_cv_zdefs, [dnl save_LDFLAGS="$LDFLAGS" @@ -887,6 +910,7 @@ AC_MSG_NOTICE([ run all tests under valgrind : ${use_valgrind} gcc undefined behaviour sanitizer : ${use_undefined} gcc address sanitizer : ${use_address} + clang memory sanitizer : ${use_msan} use rpath in tests : ${tests_use_rpath} test biarch : ${utrace_cv_cc_biarch} ]) diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am index f27d6e2e..125be97b 100644 --- a/debuginfod/Makefile.am +++ b/debuginfod/Makefile.am @@ -102,7 +102,8 @@ endif $(LIBDEBUGINFOD_SONAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ -Wl,--soname,$(LIBDEBUGINFOD_SONAME) \ - -Wl,--version-script,$<,--no-undefined \ + -Wl,--version-script,$< \ + $(NO_UNDEFINED) \ -Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \ $(libdebuginfod_so_LDLIBS) @$(textrel_check) diff --git a/libasm/Makefile.am b/libasm/Makefile.am index c2b54811..1e6b63e8 100644 --- a/libasm/Makefile.am +++ b/libasm/Makefile.am @@ -64,7 +64,8 @@ libasm_so_LIBS = libasm_pic.a libasm.so: $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS) $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ -Wl,--soname,$@.$(VERSION) \ - -Wl,--version-script,$<,--no-undefined \ + -Wl,--version-script,$< \ + $(NO_UNDEFINED) \ -Wl,--whole-archive $(libasm_so_LIBS) -Wl,--no-whole-archive \ $(libasm_so_LDLIBS) @$(textrel_check) diff --git a/libdw/Makefile.am b/libdw/Makefile.am index 1b6fead4..e548f38c 100644 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@ -114,7 +114,8 @@ libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_ libdw.so: $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ -Wl,--soname,$@.$(VERSION),--enable-new-dtags \ - -Wl,--version-script,$<,--no-undefined \ + -Wl,--version-script,$< \ + $(NO_UNDEFINED) \ -Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \ $(libdw_so_LDLIBS) @$(textrel_check) diff --git a/libelf/Makefile.am b/libelf/Makefile.am index 24c25cf8..aabce43e 100644 --- a/libelf/Makefile.am +++ b/libelf/Makefile.am @@ -115,7 +115,8 @@ libelf_so_LIBS = libelf_pic.a libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS) $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ -Wl,--soname,$@.$(VERSION) \ - -Wl,--version-script,$<,--no-undefined \ + -Wl,--version-script,$< \ + $(NO_UNDEFINED) \ -Wl,--whole-archive $(libelf_so_LIBS) -Wl,--no-whole-archive \ $(libelf_so_LDLIBS) @$(textrel_check) diff --git a/tests/Makefile.am b/tests/Makefile.am index 36823d94..31dd2f67 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -88,12 +88,16 @@ endif # test_nlist checks its own symbol table, and expects various symbols # to be in the order as specified in the source file. Explicitly set -# minimal CFLAGS. But add address sanitizer if in use. +# minimal CFLAGS. But add sanitizers if in use. if USE_ADDRESS_SANITIZER EXTRA_NLIST_CFLAGS=-fsanitize=address else +if USE_MEMORY_SANITIZER +EXTRA_NLIST_CFLAGS=-fsanitize=memory -fsanitize-memory-track-origins +else EXTRA_NLIST_CFLAGS= endif +endif test-nlist$(EXEEXT): test-nlist.c $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ @@ -225,6 +229,10 @@ if USE_ZSTD_COMPRESS export ELFUTILS_ZSTD = 1 endif +if USE_MEMORY_SANITIZER +export ELFUTILS_MEMORY_SANITIZER = 1 +endif + if DEBUGINFOD check_PROGRAMS += debuginfod_build_id_find # With the dummy delegation doesn't work diff --git a/tests/run-readelf-self.sh b/tests/run-readelf-self.sh index 7ffb3577..61f803fb 100755 --- a/tests/run-readelf-self.sh +++ b/tests/run-readelf-self.sh @@ -17,5 +17,10 @@ . $srcdir/test-subr.sh +if test -n "$ELFUTILS_MEMORY_SANITIZER"; then + echo "binaries statically linked memory sanitizer are too big" + exit 77 +fi + # Just makes sure readelf doesn't crash testrun_on_self_quiet ${abs_top_builddir}/src/readelf -a -w diff --git a/tests/run-strip-reloc.sh b/tests/run-strip-reloc.sh index 033ed278..31a11fa2 100755 --- a/tests/run-strip-reloc.sh +++ b/tests/run-strip-reloc.sh @@ -17,6 +17,11 @@ . $srcdir/test-subr.sh +if test -n "$ELFUTILS_MEMORY_SANITIZER"; then + echo "binaries statically linked memory sanitizer are too big" + exit 77 +fi + testfiles hello_i386.ko hello_x86_64.ko hello_ppc64.ko hello_s390.ko \ hello_aarch64.ko hello_m68k.ko hello_riscv64.ko hello_csky.ko \ hello_arc_hs4.ko diff --git a/tests/run-varlocs-self.sh b/tests/run-varlocs-self.sh index 5454fc70..7d79f70e 100755 --- a/tests/run-varlocs-self.sh +++ b/tests/run-varlocs-self.sh @@ -17,6 +17,11 @@ . $srcdir/test-subr.sh +if test -n "$ELFUTILS_MEMORY_SANITIZER"; then + echo "binaries statically linked memory sanitizer are too big" + exit 77 +fi + # Make sure varlocs doesn't crash, doesn't trigger self-check/asserts # or leaks running under valgrind. testrun_on_self_exe ${abs_top_builddir}/tests/varlocs -e