* [PATCH 1 of 7 v2] xen: Add -Wno-unused-value to the clang CFLAGS
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
@ 2012-04-05 15:51 ` Tim Deegan
2012-04-05 15:51 ` [PATCH 2 of 7 v2] x86/mm: Another couple of comparisons of unsigned vars with < 0 Tim Deegan
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Tim Deegan @ 2012-04-05 15:51 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333640955 -3600
# Node ID 7922a921d2034930780e41f1bc71d2c4ddb3b782
# Parent d690c7e896a26c54a5ab85458824059de72d5cba
xen: Add -Wno-unused-value to the clang CFLAGS
clang complains about a lot of functions and macros whose return value
is unused. I started on patches to drop some functions' return values
and scatter (void)s around callers, but it was getting too messy.
Just turn off the warning instead.
Signed-off-by: Tim Deegan <tim@xen.org>
diff -r d690c7e896a2 -r 7922a921d203 Config.mk
--- a/Config.mk Thu Apr 05 11:06:03 2012 +0100
+++ b/Config.mk Thu Apr 05 16:49:15 2012 +0100
@@ -159,7 +159,8 @@ CFLAGS += -Wall -Wstrict-prototypes
# Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
# and is over-zealous with the printf format lint
-CFLAGS-$(clang) += -Wno-parentheses -Wno-format
+# and is a bit too fierce about unused return values
+CFLAGS-$(clang) += -Wno-parentheses -Wno-format -Wno-unused-value
$(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
$(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 2 of 7 v2] x86/mm: Another couple of comparisons of unsigned vars with < 0
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
2012-04-05 15:51 ` [PATCH 1 of 7 v2] xen: Add -Wno-unused-value to the clang CFLAGS Tim Deegan
@ 2012-04-05 15:51 ` Tim Deegan
2012-04-05 15:51 ` [PATCH 3 of 7 v2] x86: fix logical ANDs used to mask bitfields Tim Deegan
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Tim Deegan @ 2012-04-05 15:51 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333640955 -3600
# Node ID 08612e81926857363618746fd01f9b08b7c3ac73
# Parent 7922a921d2034930780e41f1bc71d2c4ddb3b782
x86/mm: Another couple of comparisons of unsigned vars with < 0.
Adding the explicit (unsigned) casts in case enums ever end up signed.
Signed-off-by: Tim Deegan <tim@xen.org>
diff -r 7922a921d203 -r 08612e819268 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
@@ -1305,7 +1305,7 @@ int p2m_set_mem_access(struct domain *d,
p2m->default_access,
};
- if ( access >= HVMMEM_access_default || access < 0 )
+ if ( (unsigned) access >= HVMMEM_access_default )
return -EINVAL;
a = memaccess[access];
@@ -1367,7 +1367,7 @@ int p2m_get_mem_access(struct domain *d,
if ( mfn_x(mfn) == INVALID_MFN )
return -ESRCH;
- if ( a >= ARRAY_SIZE(memaccess) || a < 0 )
+ if ( (unsigned) a >= ARRAY_SIZE(memaccess) )
return -ERANGE;
*access = memaccess[a];
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 3 of 7 v2] x86: fix logical ANDs used to mask bitfields
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
2012-04-05 15:51 ` [PATCH 1 of 7 v2] xen: Add -Wno-unused-value to the clang CFLAGS Tim Deegan
2012-04-05 15:51 ` [PATCH 2 of 7 v2] x86/mm: Another couple of comparisons of unsigned vars with < 0 Tim Deegan
@ 2012-04-05 15:51 ` Tim Deegan
2012-04-05 15:51 ` [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr) Tim Deegan
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Tim Deegan @ 2012-04-05 15:51 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333640955 -3600
# Node ID 4674ce03c62a3e916954fd445b4510ffe72e64f4
# Parent 08612e81926857363618746fd01f9b08b7c3ac73
x86: fix logical ANDs used to mask bitfields.
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
diff -r 08612e819268 -r 4674ce03c62a xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c Thu Apr 05 16:49:15 2012 +0100
@@ -752,7 +752,7 @@ static void svm_lwp_interrupt(struct cpu
ack_APIC_irq();
vlapic_set_irq(
vcpu_vlapic(curr),
- (curr->arch.hvm_svm.guest_lwp_cfg >> 40) && 0xff,
+ (curr->arch.hvm_svm.guest_lwp_cfg >> 40) & 0xff,
0);
}
diff -r 08612e819268 -r 4674ce03c62a xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c Thu Apr 05 16:49:15 2012 +0100
@@ -1382,7 +1382,7 @@ void vmx_inject_extint(int trap)
if ( nestedhvm_vcpu_in_guestmode(v) ) {
pin_based_cntrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx,
PIN_BASED_VM_EXEC_CONTROL);
- if ( pin_based_cntrl && PIN_BASED_EXT_INTR_MASK ) {
+ if ( pin_based_cntrl & PIN_BASED_EXT_INTR_MASK ) {
nvmx_enqueue_n2_exceptions (v,
INTR_INFO_VALID_MASK | (X86_EVENTTYPE_EXT_INTR<<8) | trap,
HVM_DELIVER_NO_ERROR_CODE);
@@ -1401,7 +1401,7 @@ void vmx_inject_nmi(void)
if ( nestedhvm_vcpu_in_guestmode(v) ) {
pin_based_cntrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx,
PIN_BASED_VM_EXEC_CONTROL);
- if ( pin_based_cntrl && PIN_BASED_NMI_EXITING ) {
+ if ( pin_based_cntrl & PIN_BASED_NMI_EXITING ) {
nvmx_enqueue_n2_exceptions (v,
INTR_INFO_VALID_MASK | (X86_EVENTTYPE_NMI<<8) | TRAP_nmi,
HVM_DELIVER_NO_ERROR_CODE);
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr)
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
` (2 preceding siblings ...)
2012-04-05 15:51 ` [PATCH 3 of 7 v2] x86: fix logical ANDs used to mask bitfields Tim Deegan
@ 2012-04-05 15:51 ` Tim Deegan
2012-04-10 7:41 ` Jan Beulich
2012-04-10 10:08 ` Christoph Egger
2012-04-05 15:51 ` [PATCH 5 of 7 v2] x86: don't use .subsection when compiling with clang Tim Deegan
` (3 subsequent siblings)
7 siblings, 2 replies; 13+ messages in thread
From: Tim Deegan @ 2012-04-05 15:51 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333640955 -3600
# Node ID a93381049790e4f8a02f2322851f78175c254c5b
# Parent 4674ce03c62a3e916954fd445b4510ffe72e64f4
x86: fix memset(ptr, 0, sizeof ptr).
Signed-off-by: Tim Deegan <tim@xen.org>
diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/cpu/mcheck/amd_f10.c
--- a/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
@@ -73,9 +73,9 @@ amd_f10_handler(struct mc_info *mi, uint
return NULL;
}
- memset(mc_ext, 0, sizeof(mc_ext));
+ memset(mc_ext, 0, sizeof(*mc_ext));
mc_ext->common.type = MC_TYPE_EXTENDED;
- mc_ext->common.size = sizeof(mc_ext);
+ mc_ext->common.size = sizeof(*mc_ext);
mc_ext->mc_msrs = 3;
mc_ext->mc_msr[0].reg = MSR_F10_MC4_MISC1;
diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
@@ -1232,11 +1232,10 @@ bool_t p2m_mem_access_check(unsigned lon
}
*req_ptr = NULL;
- req = xmalloc(mem_event_request_t);
+ req = xzalloc(mem_event_request_t);
if ( req )
{
*req_ptr = req;
- memset(req, 0, sizeof(req));
req->reason = MEM_EVENT_REASON_VIOLATION;
/* Pause the current VCPU */
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr)
2012-04-05 15:51 ` [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr) Tim Deegan
@ 2012-04-10 7:41 ` Jan Beulich
2012-04-10 10:08 ` Christoph Egger
1 sibling, 0 replies; 13+ messages in thread
From: Jan Beulich @ 2012-04-10 7:41 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel
>>> On 05.04.12 at 17:51, Tim Deegan <tim@xen.org> wrote:
> # HG changeset patch
> # User Tim Deegan <tim@xen.org>
> # Date 1333640955 -3600
> # Node ID a93381049790e4f8a02f2322851f78175c254c5b
> # Parent 4674ce03c62a3e916954fd445b4510ffe72e64f4
> x86: fix memset(ptr, 0, sizeof ptr).
>
> Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
> diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/cpu/mcheck/amd_f10.c
> --- a/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
> +++ b/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
> @@ -73,9 +73,9 @@ amd_f10_handler(struct mc_info *mi, uint
> return NULL;
> }
>
> - memset(mc_ext, 0, sizeof(mc_ext));
> + memset(mc_ext, 0, sizeof(*mc_ext));
> mc_ext->common.type = MC_TYPE_EXTENDED;
> - mc_ext->common.size = sizeof(mc_ext);
> + mc_ext->common.size = sizeof(*mc_ext);
> mc_ext->mc_msrs = 3;
>
> mc_ext->mc_msr[0].reg = MSR_F10_MC4_MISC1;
> diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/mm/p2m.c
> --- a/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
> +++ b/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
> @@ -1232,11 +1232,10 @@ bool_t p2m_mem_access_check(unsigned lon
> }
>
> *req_ptr = NULL;
> - req = xmalloc(mem_event_request_t);
> + req = xzalloc(mem_event_request_t);
> if ( req )
> {
> *req_ptr = req;
> - memset(req, 0, sizeof(req));
> req->reason = MEM_EVENT_REASON_VIOLATION;
>
> /* Pause the current VCPU */
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr)
2012-04-05 15:51 ` [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr) Tim Deegan
2012-04-10 7:41 ` Jan Beulich
@ 2012-04-10 10:08 ` Christoph Egger
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Egger @ 2012-04-10 10:08 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel
On 04/05/12 17:51, Tim Deegan wrote:
> # HG changeset patch
> # User Tim Deegan<tim@xen.org>
> # Date 1333640955 -3600
> # Node ID a93381049790e4f8a02f2322851f78175c254c5b
> # Parent 4674ce03c62a3e916954fd445b4510ffe72e64f4
> x86: fix memset(ptr, 0, sizeof ptr).
>
> Signed-off-by: Tim Deegan<tim@xen.org>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
>
> diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/cpu/mcheck/amd_f10.c
> --- a/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
> +++ b/xen/arch/x86/cpu/mcheck/amd_f10.c Thu Apr 05 16:49:15 2012 +0100
> @@ -73,9 +73,9 @@ amd_f10_handler(struct mc_info *mi, uint
> return NULL;
> }
>
> - memset(mc_ext, 0, sizeof(mc_ext));
> + memset(mc_ext, 0, sizeof(*mc_ext));
> mc_ext->common.type = MC_TYPE_EXTENDED;
> - mc_ext->common.size = sizeof(mc_ext);
> + mc_ext->common.size = sizeof(*mc_ext);
> mc_ext->mc_msrs = 3;
>
> mc_ext->mc_msr[0].reg = MSR_F10_MC4_MISC1;
> diff -r 4674ce03c62a -r a93381049790 xen/arch/x86/mm/p2m.c
> --- a/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
> +++ b/xen/arch/x86/mm/p2m.c Thu Apr 05 16:49:15 2012 +0100
> @@ -1232,11 +1232,10 @@ bool_t p2m_mem_access_check(unsigned lon
> }
>
> *req_ptr = NULL;
> - req = xmalloc(mem_event_request_t);
> + req = xzalloc(mem_event_request_t);
> if ( req )
> {
> *req_ptr = req;
> - memset(req, 0, sizeof(req));
> req->reason = MEM_EVENT_REASON_VIOLATION;
>
> /* Pause the current VCPU */
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5 of 7 v2] x86: don't use .subsection when compiling with clang
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
` (3 preceding siblings ...)
2012-04-05 15:51 ` [PATCH 4 of 7 v2] x86: fix memset(ptr, 0, sizeof ptr) Tim Deegan
@ 2012-04-05 15:51 ` Tim Deegan
2012-04-10 7:43 ` Jan Beulich
2012-04-05 15:51 ` [PATCH 6 of 7 v2] xen: define __section() and friends and use them for section annotations Tim Deegan
` (2 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Tim Deegan @ 2012-04-05 15:51 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333640955 -3600
# Node ID 0908535327a5b01e49b69cd96db464be21ff3ee6
# Parent a93381049790e4f8a02f2322851f78175c254c5b
x86: don't use .subsection when compiling with clang
LLVM's assembler doesn't support the .subsection directive, so put
the out-of-line failure path in .fixup instead.
Signed-off-by: Tim Deegan <tim@xen.org>
diff -r a93381049790 -r 0908535327a5 xen/include/asm-x86/spinlock.h
--- a/xen/include/asm-x86/spinlock.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-x86/spinlock.h Thu Apr 05 16:49:15 2012 +0100
@@ -45,11 +45,19 @@ static always_inline int _raw_read_trylo
asm volatile (
" lock; decl %0 \n"
" jns 2f \n"
+#ifdef __clang__ /* clang's builtin assember can't do .subsection */
+ "1: .pushsection .fixup,\"ax\"\n"
+#else
"1: .subsection 1 \n"
+#endif
"2: lock; incl %0 \n"
" decl %1 \n"
" jmp 1b \n"
+#ifdef __clang__
+ " .popsection \n"
+#else
" .subsection 0 \n"
+#endif
: "=m" (rw->lock), "=r" (acquired) : "1" (1) : "memory" );
return acquired;
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 5 of 7 v2] x86: don't use .subsection when compiling with clang
2012-04-05 15:51 ` [PATCH 5 of 7 v2] x86: don't use .subsection when compiling with clang Tim Deegan
@ 2012-04-10 7:43 ` Jan Beulich
0 siblings, 0 replies; 13+ messages in thread
From: Jan Beulich @ 2012-04-10 7:43 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel
>>> On 05.04.12 at 17:51, Tim Deegan <tim@xen.org> wrote:
> # HG changeset patch
> # User Tim Deegan <tim@xen.org>
> # Date 1333640955 -3600
> # Node ID 0908535327a5b01e49b69cd96db464be21ff3ee6
> # Parent a93381049790e4f8a02f2322851f78175c254c5b
> x86: don't use .subsection when compiling with clang
>
> LLVM's assembler doesn't support the .subsection directive, so put
> the out-of-line failure path in .fixup instead.
Given that it's a single place only, addressing this inline rather than
creating a proper abstraction is probably fine, so ...
> Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
> diff -r a93381049790 -r 0908535327a5 xen/include/asm-x86/spinlock.h
> --- a/xen/include/asm-x86/spinlock.h Thu Apr 05 16:49:15 2012 +0100
> +++ b/xen/include/asm-x86/spinlock.h Thu Apr 05 16:49:15 2012 +0100
> @@ -45,11 +45,19 @@ static always_inline int _raw_read_trylo
> asm volatile (
> " lock; decl %0 \n"
> " jns 2f \n"
> +#ifdef __clang__ /* clang's builtin assember can't do .subsection */
> + "1: .pushsection .fixup,\"ax\"\n"
> +#else
> "1: .subsection 1 \n"
> +#endif
> "2: lock; incl %0 \n"
> " decl %1 \n"
> " jmp 1b \n"
> +#ifdef __clang__
> + " .popsection \n"
> +#else
> " .subsection 0 \n"
> +#endif
> : "=m" (rw->lock), "=r" (acquired) : "1" (1) : "memory" );
>
> return acquired;
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6 of 7 v2] xen: define __section() and friends and use them for section annotations
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
` (4 preceding siblings ...)
2012-04-05 15:51 ` [PATCH 5 of 7 v2] x86: don't use .subsection when compiling with clang Tim Deegan
@ 2012-04-05 15:51 ` Tim Deegan
2012-04-05 15:51 ` [PATCH 7 of 7 v2] x86: explicitly mark __initdata variables as used when building with clang Tim Deegan
2012-04-10 7:46 ` [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Jan Beulich
7 siblings, 0 replies; 13+ messages in thread
From: Tim Deegan @ 2012-04-05 15:51 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333640955 -3600
# Node ID fba1917c638768c0a4e45c507c29f1020e08dfc1
# Parent 0908535327a5b01e49b69cd96db464be21ff3ee6
xen: define __section() and friends and use them for section annotations.
By itself this is just code-tidying, but it's also useful for the
following patch, which will adjust __section() for clang compiles.
Signed-off-by: Tim Deegan <tim@xen.org>
diff -r 0908535327a5 -r fba1917c6387 xen/include/asm-arm/cache.h
--- a/xen/include/asm-arm/cache.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-arm/cache.h Thu Apr 05 16:49:15 2012 +0100
@@ -7,7 +7,7 @@
#define L1_CACHE_SHIFT (CONFIG_ARM_L1_CACHE_SHIFT)
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
#endif
/*
diff -r 0908535327a5 -r fba1917c6387 xen/include/asm-arm/percpu.h
--- a/xen/include/asm-arm/percpu.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-arm/percpu.h Thu Apr 05 16:49:15 2012 +0100
@@ -8,7 +8,7 @@ void percpu_init_areas(void);
/* Separate out the type, so (int[3], foo) works. */
#define __DEFINE_PER_CPU(type, name, suffix) \
- __attribute__((__section__(".bss.percpu" #suffix))) \
+ __section(".bss.percpu" #suffix) \
__typeof__(type) per_cpu_##name
diff -r 0908535327a5 -r fba1917c6387 xen/include/asm-x86/cache.h
--- a/xen/include/asm-x86/cache.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-x86/cache.h Thu Apr 05 16:49:15 2012 +0100
@@ -10,6 +10,6 @@
#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
#endif
diff -r 0908535327a5 -r fba1917c6387 xen/include/asm-x86/percpu.h
--- a/xen/include/asm-x86/percpu.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/asm-x86/percpu.h Thu Apr 05 16:49:15 2012 +0100
@@ -9,7 +9,7 @@ void percpu_init_areas(void);
/* Separate out the type, so (int[3], foo) works. */
#define __DEFINE_PER_CPU(type, name, suffix) \
- __attribute__((__section__(".bss.percpu" #suffix))) \
+ __section(".bss.percpu" #suffix) \
__typeof__(type) per_cpu_##name
/* var is in discarded region: offset to particular copy we want */
diff -r 0908535327a5 -r fba1917c6387 xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xen/compiler.h Thu Apr 05 16:49:15 2012 +0100
@@ -14,6 +14,10 @@
#define always_inline __inline__ __attribute__ ((always_inline))
#define noinline __attribute__((noinline))
+#define __section(s) __attribute__((__section__(s)))
+#define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
+#define __text_section(s) __attribute__((__section__(s)))
+
#ifdef INIT_SECTIONS_ONLY
/*
* For sources indicated to have only init code, make sure even
diff -r 0908535327a5 -r fba1917c6387 xen/include/xen/init.h
--- a/xen/include/xen/init.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xen/init.h Thu Apr 05 16:49:15 2012 +0100
@@ -7,20 +7,13 @@
* Mark functions and data as being only used at initialization
* or exit time.
*/
-#define __init \
- __attribute__ ((__section__ (".init.text")))
-#define __exit \
- __attribute_used__ __attribute__ ((__section__(".exit.text")))
-#define __initdata \
- __attribute__ ((__section__ (".init.data")))
-#define __exitdata \
- __attribute_used__ __attribute__ ((__section__ (".exit.data")))
-#define __initsetup \
- __attribute_used__ __attribute__ ((__section__ (".init.setup")))
-#define __init_call(lvl) \
- __attribute_used__ __attribute__ ((__section__ (".initcall" lvl ".init")))
-#define __exit_call \
- __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+#define __init __text_section(".init.text")
+#define __exit __text_section(".exit.text")
+#define __initdata __section(".init.data")
+#define __exitdata __used_section(".exit.data")
+#define __initsetup __used_section(".init.setup")
+#define __init_call(lvl) __used_section(".initcall" lvl ".init")
+#define __exit_call __used_section(".exitcall.exit")
/* These macros are used to mark some functions or
* initialized data (doesn't apply to uninitialized data)
@@ -95,7 +88,7 @@ struct kernel_param {
extern struct kernel_param __setup_start, __setup_end;
#define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __attribute_used__ __initsetup struct kernel_param
+#define __kparam static __initsetup struct kernel_param
#define custom_param(_name, _var) \
__setup_str __setup_str_##_var[] = _name; \
diff -r 0908535327a5 -r fba1917c6387 xen/include/xen/spinlock.h
--- a/xen/include/xen/spinlock.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xen/spinlock.h Thu Apr 05 16:49:15 2012 +0100
@@ -77,8 +77,8 @@ struct lock_profile_qhead {
#define _LOCK_PROFILE(name) { 0, #name, &name, 0, 0, 0, 0, 0 }
#define _LOCK_PROFILE_PTR(name) \
- static struct lock_profile *__lock_profile_##name __attribute_used__ \
- __attribute__ ((__section__(".lockprofile.data"))) = \
+ static struct lock_profile *__lock_profile_##name \
+ __used_section(".lockprofile.data") = \
&__lock_profile_data_##name
#define _SPIN_LOCK_UNLOCKED(x) { _RAW_SPIN_LOCK_UNLOCKED, 0xfffu, 0, \
_LOCK_DEBUG, x }
diff -r 0908535327a5 -r fba1917c6387 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xsm/xsm.h Thu Apr 05 16:49:15 2012 +0100
@@ -44,7 +44,7 @@ extern xsm_initcall_t __xsm_initcall_sta
#define xsm_initcall(fn) \
static xsm_initcall_t __initcall_##fn \
- __attribute_used__ __attribute__((__section__(".xsm_initcall.init"))) = fn
+ __used_section(".xsm_initcall.init") = fn
struct xsm_operations {
void (*security_domaininfo) (struct domain *d,
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 7 of 7 v2] x86: explicitly mark __initdata variables as used when building with clang
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
` (5 preceding siblings ...)
2012-04-05 15:51 ` [PATCH 6 of 7 v2] xen: define __section() and friends and use them for section annotations Tim Deegan
@ 2012-04-05 15:51 ` Tim Deegan
2012-04-10 7:46 ` [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Jan Beulich
7 siblings, 0 replies; 13+ messages in thread
From: Tim Deegan @ 2012-04-05 15:51 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333640955 -3600
# Node ID 51174f350092962ad36e406adf7ae1f173330a37
# Parent fba1917c638768c0a4e45c507c29f1020e08dfc1
x86: explicitly mark __initdata variables as used when building with clang.
This stops LLVM from replacing it with a different, auto-generated
variable as part of an optimization. (The auto-generated variable
ends up in the normal data section.)
Remove stray __read_mostly annotations on declarations that this unmasked.
Signed-off-by: Tim Deegan <tim@xen.org>
diff -r fba1917c6387 -r 51174f350092 xen/arch/x86/oprofile/op_x86_model.h
--- a/xen/arch/x86/oprofile/op_x86_model.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/arch/x86/oprofile/op_x86_model.h Thu Apr 05 16:49:15 2012 +0100
@@ -53,6 +53,6 @@ extern struct op_x86_model_spec const op
void arch_perfmon_setup_counters(void);
extern int ppro_has_global_ctrl;
-extern struct op_x86_model_spec const *__read_mostly model;
+extern struct op_x86_model_spec const *model;
#endif /* OP_X86_MODEL_H */
diff -r fba1917c6387 -r 51174f350092 xen/include/acpi/cpufreq/cpufreq.h
--- a/xen/include/acpi/cpufreq/cpufreq.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/acpi/cpufreq/cpufreq.h Thu Apr 05 16:49:15 2012 +0100
@@ -22,7 +22,7 @@
DECLARE_PER_CPU(spinlock_t, cpufreq_statistic_lock);
-extern bool_t __read_mostly cpufreq_verbose;
+extern bool_t cpufreq_verbose;
struct cpufreq_governor;
diff -r fba1917c6387 -r 51174f350092 xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h Thu Apr 05 16:49:15 2012 +0100
+++ b/xen/include/xen/compiler.h Thu Apr 05 16:49:15 2012 +0100
@@ -14,7 +14,13 @@
#define always_inline __inline__ __attribute__ ((always_inline))
#define noinline __attribute__((noinline))
+#ifdef __clang__
+/* Clang can replace some vars with new automatic ones that go in .data;
+ * mark all explicit-segment vars 'used' to prevent that. */
+#define __section(s) __attribute_used__ __attribute__((__section__(s)))
+#else
#define __section(s) __attribute__((__section__(s)))
+#endif
#define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
#define __text_section(s) __attribute__((__section__(s)))
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 0 of 7 v2] Make xen build with clang/LLVM again
2012-04-05 15:51 [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Tim Deegan
` (6 preceding siblings ...)
2012-04-05 15:51 ` [PATCH 7 of 7 v2] x86: explicitly mark __initdata variables as used when building with clang Tim Deegan
@ 2012-04-10 7:46 ` Jan Beulich
2012-04-10 9:08 ` Keir Fraser
7 siblings, 1 reply; 13+ messages in thread
From: Jan Beulich @ 2012-04-10 7:46 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel
>>> On 05.04.12 at 17:51, Tim Deegan <tim@xen.org> wrote:
> This series makes the hypervisor build with clang/LLVM again,
> after a certain amount of bit-rot.
I ack-ed the ones I uesfully can; the rest looks good to me too but
may need an ack from Keir.
Jan
> Since v1:
> - Changed an xmalloc+memset pair to xzalloc in the memset patch
> - Reworked the spinlock patch not to touch gcc builds
> - Added a patch to indirect all __section__ directives through a macro.
> - Commented up the ugly __attribute__((used)) change and moved it
> into the definition of __section().
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 0 of 7 v2] Make xen build with clang/LLVM again
2012-04-10 7:46 ` [PATCH 0 of 7 v2] Make xen build with clang/LLVM again Jan Beulich
@ 2012-04-10 9:08 ` Keir Fraser
0 siblings, 0 replies; 13+ messages in thread
From: Keir Fraser @ 2012-04-10 9:08 UTC (permalink / raw)
To: Jan Beulich, Tim Deegan; +Cc: xen-devel
On 10/04/2012 08:46, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>> On 05.04.12 at 17:51, Tim Deegan <tim@xen.org> wrote:
>> This series makes the hypervisor build with clang/LLVM again,
>> after a certain amount of bit-rot.
>
> I ack-ed the ones I uesfully can; the rest looks good to me too but
> may need an ack from Keir.
I acked already, I think, but just in case
Acked-by: Keir Fraser <keir@xen.org>
> Jan
>
>> Since v1:
>> - Changed an xmalloc+memset pair to xzalloc in the memset patch
>> - Reworked the spinlock patch not to touch gcc builds
>> - Added a patch to indirect all __section__ directives through a macro.
>> - Commented up the ugly __attribute__((used)) change and moved it
>> into the definition of __section().
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 13+ messages in thread