From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Alan Hayward <Alan.Hayward@arm.com>
Cc: GDB Patches <gdb-patches@sourceware.org>, nd <nd@arm.com>,
Simon Marchi <simon.marchi@ericsson.com>
Subject: Re: [PATCH] Guard declarations of 'sve_*_from_*' macros on Aarch64 (and unbreak build)
Date: Wed, 06 Jun 2018 21:36:00 -0000 [thread overview]
Message-ID: <874lifwqag.fsf@redhat.com> (raw)
In-Reply-To: <E678627F-7C9F-4D4A-9E38-589ED9D21307@arm.com> (Alan Hayward's message of "Wed, 6 Jun 2018 07:34:20 +0000")
On Wednesday, June 06 2018, Alan Hayward wrote:
>> On 5 Jun 2018, at 23:05, Sergio Durigan Junior <sergiodj@redhat.com> wrote:
>>
>> Commit 122394f1476b1c925a281b15399119500c8231c1 ("Function for reading
>> the Aarch64 SVE vector length") has added macros to manipulate SVE
>> vector sizes based on Linux kernel sources, but did not guard them
>> with #ifndef's, which breaks the build when the system headers already
>> have these macros:
>>
>> CXX aarch64-linux-nat.o
>> In file included from ../../gdb/aarch64-tdep.h:25,
>> from ../../gdb/aarch64-linux-nat.c:30:
>> ../../gdb/arch/aarch64.h:79: error: "sve_vq_from_vl" redefined [-Werror]
>> #define sve_vq_from_vl(vl) ((vl) / 0x10)
>>
>> In file included from /usr/include/bits/sigcontext.h:30,
>> from /usr/include/signal.h:291,
>> from build-gnulib/import/signal.h:52,
>> from ../../gdb/linux-nat.h:23,
>> from ../../gdb/aarch64-linux-nat.c:26:
>> /usr/include/asm/sigcontext.h:154: note: this is the location of the previous definition
>> #define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
>>
>> In file included from ../../gdb/aarch64-tdep.h:25,
>> from ../../gdb/aarch64-linux-nat.c:30:
>> ../../gdb/arch/aarch64.h:80: error: "sve_vl_from_vq" redefined [-Werror]
>> #define sve_vl_from_vq(vq) ((vq) * 0x10)
>>
>> In file included from /usr/include/bits/sigcontext.h:30,
>> from /usr/include/signal.h:291,
>> from build-gnulib/import/signal.h:52,
>> from ../../gdb/linux-nat.h:23,
>> from ../../gdb/aarch64-linux-nat.c:26:
>> /usr/include/asm/sigcontext.h:155: note: this is the location of the previous definition
>> #define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
>>
>> In order to fix this breakage, this commit guards the declaration of
>> the macros using #ifndef’s.
>
> Apologies for breaking this.
> I originally had them in nat/aarch64-sve-linux-ptrace.h, within the
> SVE_SIG_ZREGS_SIZE block, which does guard appropriately.
>
> Thanks for fixing so quickly.
No problem.
>> Tested by making sure GDB compiles fine again. Since the system I'm
>> using doesn't have support for SVE, there's no way I can really test
>> these changes.
>>
>
> Changes work fine for me on my SVE builds.
Thanks for testing!
>> gdb/ChangeLog:
>> 2018-06-05 Sergio Durigan Junior <sergiodj@redhat.com>
>>
>> * arch/aarch64.h (sve_vg_from_vl): Guard with #ifndef.
>> (sve_vl_from_vg): Likewise.
>> (sve_vq_from_vl): Likewise.
>> (sve_vl_from_vq): Likewise.
>> (sve_vq_from_vg): Likewise.
>> (sve_vg_from_vq): Likewise.
>> ---
>> gdb/arch/aarch64.h | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
>> index 9040d8d4c8..c378a4b239 100644
>> --- a/gdb/arch/aarch64.h
>> +++ b/gdb/arch/aarch64.h
>> @@ -74,12 +74,24 @@ enum aarch64_regnum
>> VG : Vector Gradient.
>> The number of 64bit chunks in an SVE Z register. */
>>
>> +#ifndef sve_vg_from_vl
>> #define sve_vg_from_vl(vl) ((vl) / 8)
>> +#endif
>> +#ifndef sve_vl_from_vg
>> #define sve_vl_from_vg(vg) ((vg) * 8)
>> +#endif
>
> The guards around these first two aren’t needed. The kernel only
> defines the VQ to/from VL macros - as those are the only values the
> kernel cares about. Only GDB cares about VG because that is needed
> for dwarf.
Ah, fair enough. Removed.
>> +#ifndef sve_vq_from_vl
>> #define sve_vq_from_vl(vl) ((vl) / 0x10)
>> +#endif
>> +#ifndef sve_vl_from_vq
>> #define sve_vl_from_vq(vq) ((vq) * 0x10)
>> +#endif
>
> These two are fine!
>
>> +#ifndef sve_vq_from_vg
>> #define sve_vq_from_vg(vg) (sve_vq_from_vl (sve_vl_from_vg (vg)))
>> +#endif
>> +#ifndef sve_vg_from_vq
>> #define sve_vg_from_vq(vq) (sve_vg_from_vl (sve_vl_from_vq (vq)))
>> +#endif
>
> Again these last two aren’t needed.
Removed.
On Wednesday, June 06 2018, Simon Marchi wrote:
> On 2018-06-06 03:34 AM, Alan Hayward wrote:
>> FYI, either today or tomorrow I’ll be posting a new set of SVE patches.
>> As part of that series, due to review comments, I’ll be moving the all
>> the linux kernel defines to two new files which contain only kernel
>> defines (From ptrace.h and sigcontext.h). I’ll double check this works
>> with new header files. Regardless of that, I think your patch should
>> still go in to unbreak the build until then.
>>
>>
>> Changes are good to me if the VG guards are removed (but I’m not a
>> maintainer so cannot officially approve it).
>
> LGTM with Alan's proposed changes.
Thanks, pushed:
e5a77256e8961294b3ea7d483124834311ca363b
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
next prev parent reply other threads:[~2018-06-06 21:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 10:53 [PATCH 0/8] Add SVE support for Aarch64 GDB Alan Hayward
2018-05-11 10:53 ` [PATCH 4/8] Enable SVE for GDB Alan Hayward
2018-05-31 12:22 ` Simon Marchi
2018-05-31 14:58 ` Pedro Alves
2018-05-31 16:13 ` Pedro Alves
2018-05-31 16:20 ` Alan Hayward
[not found] ` <2c87cd8d-c608-4ccf-b16a-635168dbb250@redhat.com>
2018-05-31 18:06 ` Alan Hayward
2018-05-11 10:53 ` [PATCH 6/8] Aarch64 SVE pseudo register support Alan Hayward
2018-05-31 13:26 ` Simon Marchi
2018-05-31 14:59 ` Pedro Alves
2018-05-11 10:53 ` [PATCH 8/8] Ptrace support for Aarch64 SVE Alan Hayward
2018-05-31 13:40 ` Simon Marchi
2018-05-31 14:56 ` Alan Hayward
2018-06-01 15:17 ` Simon Marchi
2018-06-04 15:49 ` Alan Hayward
2018-05-31 20:17 ` Simon Marchi
2018-05-11 10:53 ` [PATCH 2/8] Function for reading the Aarch64 SVE vector length Alan Hayward
2018-05-31 12:06 ` Simon Marchi
2018-05-31 14:57 ` Pedro Alves
2018-06-05 20:01 ` Sergio Durigan Junior
2018-06-05 22:06 ` [PATCH] Guard declarations of 'sve_*_from_*' macros on Aarch64 (and unbreak build) Sergio Durigan Junior
2018-06-05 23:37 ` Sergio Durigan Junior
2018-06-06 7:34 ` Alan Hayward
2018-06-06 21:19 ` Simon Marchi
2018-06-06 21:36 ` Sergio Durigan Junior [this message]
2018-05-11 10:53 ` [PATCH 1/8] Add Aarch64 SVE target description Alan Hayward
2018-05-11 14:56 ` Eli Zaretskii
2018-05-11 16:46 ` Alan Hayward
2018-05-31 11:56 ` Simon Marchi
2018-05-31 14:12 ` Alan Hayward
2018-05-11 10:53 ` [PATCH 7/8] Add methods to gdbserver regcache and raw_compare Alan Hayward
2018-05-11 11:52 ` [PATCH 5/8] Add aarch64 psuedo help functions Alan Hayward
2018-05-31 13:22 ` Simon Marchi
2018-05-31 15:20 ` Pedro Alves
2018-06-04 13:13 ` Alan Hayward
2018-05-11 12:12 ` [PATCH 3/8] Add SVE register defines Alan Hayward
2018-06-01 8:33 ` Alan Hayward
2018-06-01 15:18 ` Simon Marchi
2018-05-22 11:00 ` [PATCH 0/8] Add SVE support for Aarch64 GDB Alan Hayward
2018-05-29 12:09 ` [PING 2][PATCH " Alan Hayward
2018-05-29 14:35 ` Omair Javaid
2018-05-29 14:59 ` Alan Hayward
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=874lifwqag.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=Alan.Hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=nd@arm.com \
--cc=simon.marchi@ericsson.com \
/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