[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Clang tools build



On 12/02/16 16:04, Jan Beulich wrote:
>>>> On 12.02.16 at 16:25, <andrew.cooper3@xxxxxxxxxx> 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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.