From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 16BDF3858D1E for ; Sun, 15 Jan 2023 00:58:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16BDF3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Content-Type: multipart/signed; boundary="Apple-Mail=_F7DAD6AB-F664-4B0A-B394-369EFECF30F1"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: Re: [PATCH] sim: common, microblaze, mn10300: handle signal.h defining REC_PC. From: Sam James In-Reply-To: Date: Sun, 15 Jan 2023 00:58:24 +0000 Cc: Mark Wielaard , gdb-patches@sourceware.org Message-Id: <0FE61864-9F15-4D26-B1AD-DC15FA4CF94D@gentoo.org> References: <20230114232805.827713-1-mark@klomp.org> To: Mike Frysinger X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Apple-Mail=_F7DAD6AB-F664-4B0A-B394-369EFECF30F1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 15 Jan 2023, at 00:22, Mike Frysinger wrote: >=20 > On 15 Jan 2023 00:28, Mark Wielaard wrote: >> signal.h isn't needed in microblaze and mn10300 interp.c >> so don't include it. >=20 > these changes are fine to merge if you want to split it out >=20 >> In common sim-events.c, sim-signal.c, nrun.c and dv-sockser.c we >> do need signal.h, but check whether REG_PC is defined (and then >> undefine it) before including the sim headers. >>=20 >> It breaks the build on sparc because signal.h indirectly >> includes /usr/include/sys/ucontext.h and defines REG_PC, >> which is also defined in microblaze-opcm.h >=20 > i don't think this is correct. none of the files quoted use REG_PC, > so undefining a random symbol in them doesn't make sense. nothing in > sim/common/ uses REG_PC for that matter. The original error = (https://builder.sourceware.org/buildbot/#/builders/229/builds/3) is: ``` In file included from ../../binutils-gdb/sim/mn10300/sim-main.h:41, from ../../binutils-gdb/sim/common/dv-sockser.c:42: ../../binutils-gdb/sim/mn10300/mn10300-sim.h:68: error: "REG_PC" = redefined [-Werror] 68 | #define REG_PC 9 | In file included from /usr/include/signal.h:316, from ../gnulib/import/signal.h:52, from ../../binutils-gdb/sim/common/dv-sockser.c:29: /usr/include/sys/ucontext.h:111: note: this is the location of the = previous definition 111 | # define REG_PC (1) | ``` There's history of just ducking this in other projects, and I can't = really blame them: = https://patchwork.kernel.org/project/qemu-devel/patch/1490272961-1128-1-gi= t-send-email-peter.maydell@linaro.org/ Overall, we have: ``` $ grep -rsin "#define.*REG_PC" sim/mn10300/mn10300_sim.h:57:#define PC (State.regs[REG_PC]) sim/mn10300/mn10300_sim.h:74:#define REG_PC 9 gas/config/tc-arm.c:744:#define REG_PC 15 gprofng/libcollector/unwind.c:111:#define GET_PC(ctx) = (((ucontext_t*)ctx)->uc_mcontext.gregs[REG_PC]) opcodes/microblaze-opcm.h:77:#define REG_PC_MASK 0x8000 opcodes/microblaze-opcm.h:101:#define REG_PC 32 /* PC. */ include/opcode/cris.h:35:#define REG_PC (15) include/opcode/cris.h:143:#define BDAP_PC_LOW (BDAP_INDIR_LOW + = REG_PC) ``` What do you prefer? 1. Rename all the REG_* (ugly) 2. #undef hack in each of the consumers where there's a #define for it? 3. What Mark did in some misc. top-level sim place 4. Beg every vendor to change their ucontext.h 5. Something else? thanks, sam --Apple-Mail=_F7DAD6AB-F664-4B0A-B394-369EFECF30F1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iNUEARYKAH0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCY8NPsF8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MAAKCRBzhAn1IN+R kAD5AP9SxyK9DHdQweAVMnpcu9HeDl3x28QL717EGOh05bA6pgEA+ue69LpbqdhX hm66UpnxALL2z/LPsKCV9tWhNtyNWAU= =irQz -----END PGP SIGNATURE----- --Apple-Mail=_F7DAD6AB-F664-4B0A-B394-369EFECF30F1--