From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 865D3385770F for ; Mon, 21 Aug 2023 06:05:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 865D3385770F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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-out2.suse.de (Postfix) with ESMTPS id 7D6B1204BE; Mon, 21 Aug 2023 06:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692597945; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNyR/yXTtrhzDcrww9a5zUL6Uz/vUMIpkXlalWnEkP8=; b=NtkvZFu6Az7l6vmuY2qm38pr1lWI0Br4An9RHMSSyqoVz0NiEbxFubdVryDAEWjghK57AW 7fpuppEE3Bl5yLW40NOP9seLn3ikFzrJkzBk5hf8fLdENhIkOQCMo4B14ci8h0fDO+JnMt /vbaOsx836bQM6fYAIsJ8y92NUCK/hE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692597945; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iNyR/yXTtrhzDcrww9a5zUL6Uz/vUMIpkXlalWnEkP8=; b=tFw5ESJVHG9lKzd+/qNT5/5R0L8WpmOERVeMolcveQkVDc7YPEs0doUDvv6odyVAGmJvyU SSHu3+VK4qoc4vBw== 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 6AE8813421; Mon, 21 Aug 2023 06:05:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yh0cGbn+4mSKdwAAMHmgww (envelope-from ); Mon, 21 Aug 2023 06:05:45 +0000 Message-ID: Date: Mon, 21 Aug 2023 08:05:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/build] Work around cgen odr violations Content-Language: en-US To: Tom Tromey , Tom de Vries via Gdb-patches References: <20230818083857.15960-1-tdevries@suse.de> <877cpsxsiu.fsf@tromey.com> From: Tom de Vries In-Reply-To: <877cpsxsiu.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 List-Id: On 8/18/23 17:46, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries via Gdb-patches writes: > > Tom> When building gdb with -flto -O2, I run into: > Tom> ... > Tom> opcodes/mep-desc.h:250:14: warning: type 'cgen_operand_type' violates the \ > Tom> C++ One Definition Rule [-Wodr] > Tom> typedef enum cgen_operand_type { > > I thought... hey, the best way is probably to change cgen to emit > different names for these things. So I tried looking at cgen. Then I > found out I don't know how it can even be run at all. Maybe it requires > the obsolete-and-no-longer-shipped Guile 1.8 -- it definitely barfs with > newer versions. > Agreed, that's the best way. I decided though to try to achieve that by filing the binutils PR, to see if the binutils maintainers could help out. > Tom> Fix this by making the conflicting type names unique, adding a target-specific > Tom> prefix using a define before the include: > Tom> ... > Tom> #define cgen_operand_type _cgen_operand_type > Tom> #define cgen_hw_type _cgen_hw_type > Tom> #include "opcodes/-desc.h" > Tom> ... > > Thanks. > > Approved-By: Tom Tromey > Thanks for the review. After trying a bit more, with -flto-partitions=one and and various gcc version, I found more occurrences so I went the yy-remap.h way in a v2, submitted here ( https://sourceware.org/pipermail/gdb-patches/2023-August/201719.html ). I also considered trying to generate a custom -desc.h using sed, which would be guaranteed to be complete, but I realized that would also require some complex custom solution to skip '#include' and function names, so I decided against that. > Tom> A PR has been filed to take care of this in the opcodes dir instead (PR30758). > > That was WONTFIX'd unfortunately. Yep, unfortunate indeed. FWIW, the rationale given there was about libopcodes being a C library, and I also briefly considered encapsulating the use of the *-desc.h files in a C file, and exporting a cgen-free interface from there, to be used in C++ files, but I found that there's no longer any real support for compiling C inside the gdb dir. Thanks, - Tom