From: Sam James <sam@gentoo.org>
To: Mike Frysinger <vapier@gentoo.org>
Cc: Mark Wielaard <mark@klomp.org>, gdb-patches@sourceware.org
Subject: Re: [PATCH] sim: common, microblaze, mn10300: handle signal.h defining REC_PC.
Date: Sun, 15 Jan 2023 00:58:24 +0000 [thread overview]
Message-ID: <0FE61864-9F15-4D26-B1AD-DC15FA4CF94D@gentoo.org> (raw)
In-Reply-To: <Y8NHRQHwYtS4joYo@vapier>
[-- Attachment #1: Type: text/plain, Size: 2462 bytes --]
> On 15 Jan 2023, at 00:22, Mike Frysinger <vapier@gentoo.org> wrote:
>
> 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.
>
> these changes are fine to merge if you want to split it out
>
>> 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.
>>
>> 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
>
> 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-git-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
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]
next prev parent reply other threads:[~2023-01-15 0:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-14 23:28 Mark Wielaard
2023-01-15 0:22 ` Mike Frysinger
2023-01-15 0:58 ` Sam James [this message]
2023-01-15 8:07 ` Mike Frysinger
2023-01-15 17:48 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0FE61864-9F15-4D26-B1AD-DC15FA4CF94D@gentoo.org \
--to=sam@gentoo.org \
--cc=gdb-patches@sourceware.org \
--cc=mark@klomp.org \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).