From patchwork Thu Nov 24 12:45:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 61077 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 AE1AA3836651 for ; Thu, 24 Nov 2022 12:45:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE1AA3836651 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669293940; bh=9N2Ddw/b83jxGCHHspz9gOYU8LskElcYygLmuh9Lob8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=QjdQEX+G17mysaq6Q/bwAhQA8ExKO55MF6N8KN+n52IXG+nGl1gaeM7eoWJszFin1 N5Z4K/X+dMVBOH9YS9lh+VhaTGol5lgVjzjPa1iqGUhaVAg4KoHKPcQwnMXzm+vuJS zJrmGpbFXZDqnfyDiVlnKliHVrDpbU0U0lMMYdzE= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 3A65238432E3 for ; Thu, 24 Nov 2022 12:45:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A65238432E3 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 73A6821889; Thu, 24 Nov 2022 12:45:15 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6641D13488; Thu, 24 Nov 2022 12:45:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qY5fGFtnf2MtDQAAMHmgww (envelope-from ); Thu, 24 Nov 2022 12:45:15 +0000 To: gdb-patches@sourceware.org Cc: Carl Love , Ulrich Weigand Subject: [PATCH] [gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le Date: Thu, 24 Nov 2022 13:45:15 +0100 Message-Id: <20221124124515.10182-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.base/msym-bp-shl.exp on powerpc64le-linux, I run into: ... (gdb) PASS: gdb.base/msym-bp-shl.exp: debug=0: before run: break foo info breakpoint^M Num Type Disp Enb Address What^M 1 breakpoint keep y ^M 1.1 y 0x00000000000008d4 ^M 1.2 y 0x0000000000000a34 crti.S:88^M (gdb) FAIL: gdb.base/msym-bp-shl.exp: debug=0: before run: info breakpoint ... The problem is that the prologue skipper walks from foo@plt at 0xa28 to 0xa34: ... 0000000000000a28 : a28: c0 ff ff 4b b 9e8 <__glink_PLTresolve> Disassembly of section .fini: 0000000000000a2c <_fini>: a2c: 02 00 4c 3c addis r2,r12,2 a30: d4 74 42 38 addi r2,r2,29908 a34: a6 02 08 7c mflr r0 ... This is caused by ppc_elfv2_elf_make_msymbol_special which marks foo@plt as having a local entry point, due incorrectly accessing an asymbol struct using a (larger) elf_symbol_type. Fix this by simply ignoring artificial symbols in ppc_elfv2_elf_make_msymbol_special. Tested on powerpc64le. Approved-By: Ulrich Weigand Reviewed-By: Carl Love Tested-By: Carl Love PR tdep/29814 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29814 --- gdb/ppc-linux-tdep.c | 5 +++++ 1 file changed, 5 insertions(+) base-commit: 8ee52bcf39e95abbc9cfffbb0afbb55be67e8c3d diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index cc5a26431ba..39d692b2764 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1632,6 +1632,11 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch, static void ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) { + if ((sym->flags & BSF_SYNTHETIC) != 0) + /* ELFv2 synthetic symbols (the PLT stubs and the __glink_PLTresolve + trampoline) do not have a local entry point. */ + return; + elf_symbol_type *elf_sym = (elf_symbol_type *)sym; /* If the symbol is marked as having a local entry point, set a target