All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Xen-devel List <xen-devel@lists.xen.org>
Subject: Re: Clang tools build
Date: Fri, 12 Feb 2016 16:20:47 +0000	[thread overview]
Message-ID: <56BE065F.3070201@citrix.com> (raw)
In-Reply-To: <56BE108302000078000D17D7@prv-mh.provo.novell.com>

On 12/02/16 16:04, Jan Beulich wrote:
>>>> On 12.02.16 at 16:25, <andrew.cooper3@citrix.com> wrote:
>> Hello,
>>
>> Now that Clang 3.5 can build the hypervisor, I was just preparing a
>> patch to README, and encountered this:
>>
>> In file included from xc_altp2m.c:23:
>> In file included from ./xc_private.h:35:
>> In file included from ./include/xenctrl.h:53:
>> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:203:47:
>> error: 'aligned' attribute ignored when parsing type
>> [-Werror,-Wignored-attributes]
>>     __align8__ uint64_t evtchn_pending[sizeof(__align8__ uint64_t) * 8];
>>                                               ^~~~~~~~~~
>> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:13:36:
>> note: expanded from macro '__align8__'
>> # define __align8__ __attribute__((aligned (8)))
>>                                    ^~~~~~~~~~~
>> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:204:44:
>> error: 'aligned' attribute ignored when parsing type
>> [-Werror,-Wignored-attributes]
>>     __align8__ uint64_t evtchn_mask[sizeof(__align8__ uint64_t) * 8];
>>                                            ^~~~~~~~~~
>> /local/xen.git/tools/libxc/../../tools/include/xen/foreign/x86_64.h:13:36:
>> note: expanded from macro '__align8__'
>> # define __align8__ __attribute__((aligned (8)))
>>                                    ^~~~~~~~~~~
>> 2 errors generated.
>>
>> In this case, Clang is complaining that the alignment attribute is wrong
>> for uint64_t.  This is correct for 64bit compilations, but wrong for
>> 32bit.
> If it only complains about it when used as operand to sizeof() I
> think it's correctly saying so.

Turns out that a fix^W gross hack of

diff --git a/tools/include/xen-foreign/Makefile
b/tools/include/xen-foreign/Makefile
index 80a446a..d9f68cd 100644
--- a/tools/include/xen-foreign/Makefile
+++ b/tools/include/xen-foreign/Makefile
@@ -35,6 +35,7 @@ x86_32.h: mkheader.py structs.py
$(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/
 
 x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h
$(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
        $(PYTHON) $< $* $@ $(filter %.h,$^)
+       sed 's/(__align8__ uint64_t)/(uint64_t)/g' -i $@
 
 checker.c: mkchecker.py structs.py
        $(PYTHON) $< $@ $(architectures)

Does indeed fix the build.  There are problems with sizeof(), and later,
an explicit (__align8__ uint64_t) cast.

Unfortunately, mkheader is doing dumb translation, and I don't fancy
teaching it how to parse C.  I will see if there is something neater I
can do as a solution.

Also, further real issues have surfaces, so I will have to submit a
series cleaning up the tools/ compile with Clang.

~Andrew

      reply	other threads:[~2016-02-12 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 15:25 Clang tools build Andrew Cooper
2016-02-12 16:04 ` Jan Beulich
2016-02-12 16:20   ` Andrew Cooper [this message]

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=56BE065F.3070201@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.