Skip to contentSkip to conversation

Fix asmlinkage functions

PATCH In review Bastian Blank 4 participants 6 messages Jun 19, 2012 – Jun 20, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix asmlinkage functions

According to gcc-4.7, "void bla(void)" is incompatible with "asmlinkage void bla(void)". As asmlinkage expands to __attribute__((regparm(0))), it is correct.

The patch adds the missing asmlinkage to function declarations affected. It is needed for 4.1 and 4.2.

---
Origin: debian
Forwarded: no
Last-Update: 2012-06-15

xen/arch/x86/i8259.c +1 -1
@@ -62,7 +62,7 @@
     IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
     IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
 
-    static void (*interrupt[])(void) = {
+    static void (*asmlinkage interrupt[])(void) = {
         IRQLIST_16(0x0), IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3),
         IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
         IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
xen/include/asm-x86/hvm/svm/intr.h +3 -1
@@ -21,6 +21,8 @@
 #ifndef __ASM_X86_HVM_SVM_INTR_H__
 #define __ASM_X86_HVM_SVM_INTR_H__
 
-void svm_intr_assist(void);
+#include <asm/config.h>
+
+asmlinkage void svm_intr_assist(void);
 
 #endif /* __ASM_X86_HVM_SVM_INTR_H__ */
xen/include/asm-x86/hvm/vmx/vmx.h +1 -1
@@ -63,7 +63,7 @@
 
 void vmx_asm_vmexit_handler(struct cpu_user_regs);
 void vmx_asm_do_vmentry(void);
-void vmx_intr_assist(void);
+asmlinkage void vmx_intr_assist(void);
 void vmx_do_resume(struct vcpu *);
 void vmx_vlapic_msr_changed(struct vcpu *v);
 void vmx_realmode(struct cpu_user_regs *regs);
Signature · 2 lines
There is a multi-legged creature crawling on your shoulder.
		-- Spock, "A Taste of Armageddon", stardate 3193.9
#1 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · Bastian Blank

According to gcc-4.7, "void bla(void)" is incompatible with "asmlinkage void bla(void)". As asmlinkage expands to __attribute__((regparm(0))), it is correct.

The patch adds the missing asmlinkage to function declarations affected. It is needed for 4.1 and 4.2.

Iirc Keir had already taken steps towards removing all the (pointless) asmlinkage annotations, so if there are any left I think we'd rather see them removed than made consistent.

Additionally I doubt there is such a problem in current -unstable, as the result of Keir's work was to have asmlinkage defined to nothing on x86 (so I can't see how gcc would be able to diagnose any inconsistencies). Is Debian (and 4.1) perhaps rather in need of some backport?

Jan

Quoted 21 lines

---
Origin: debian
Forwarded: no
Last-Update: 2012-06-15

xen/arch/x86/i8259.c +1 -1
@@ -62,7 +62,7 @@
     IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
     IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
 
-    static void (*interrupt[])(void) = {
+    static void (*asmlinkage interrupt[])(void) = {
         IRQLIST_16(0x0), IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3),
         IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
         IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),

xen/include/asm-x86/hvm/svm/intr.h line 26

Quoted 7 lines
xen/include/asm-x86/hvm/svm/intr.h +3 -1
@@ -21,6 +21,8 @@
 #ifndef __ASM_X86_HVM_SVM_INTR_H__
 #define __ASM_X86_HVM_SVM_INTR_H__
 
-void svm_intr_assist(void);
+#include <asm/config.h>
+
+asmlinkage void svm_intr_assist(void);

Furthermore, this ...

xen/include/asm-x86/hvm/vmx/vmx.h line 66

Quoted 9 lines
xen/include/asm-x86/hvm/svm/intr.h +0 -0
 #endif /* __ASM_X86_HVM_SVM_INTR_H__ */
xen/include/asm-x86/hvm/vmx/vmx.h +1 -1
@@ -63,7 +63,7 @@
 
 void vmx_asm_vmexit_handler(struct cpu_user_regs);
 void vmx_asm_do_vmentry(void);
-void vmx_intr_assist(void);
+asmlinkage void vmx_intr_assist(void);

... and this declaration could be dropped altogether (as having call sites in assembly files only).

Jan

Quoted 11 lines
xen/include/asm-x86/hvm/vmx/vmx.h +0 -0
 void vmx_do_resume(struct vcpu *);
 void vmx_vlapic_msr_changed(struct vcpu *v);
 void vmx_realmode(struct cpu_user_regs *regs);
Signature · 7 lines
There is a multi-legged creature crawling on your shoulder.
		-- Spock, "A Taste of Armageddon", stardate 3193.9

_______________________________________________
Xen-devel mailing list
[email protected] 
http://lists.xen.org/xen-devel 
#2 lore raw
Quoted 3 lines · Jan Beulich

Iirc Keir had already taken steps towards removing all the (pointless) asmlinkage annotations, so if there are any left I think we'd rather see them removed than made consistent.

I see a lot of them and always not on both declaration and definition.

| xen/arch/arm/traps.c:asmlinkage void __div0(void)
| xen/arch/arm/traps.c:asmlinkage void do_trap_undefined_instruction(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_supervisor_call(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_prefetch_abort(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_data_abort(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_irq(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_fiq(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void leave_hypervisor_tail(void)
| xen/common/softirq.c:asmlinkage void do_softirq(void)
| xen/include/acpi/acpixf.h:acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state);
| xen/include/acpi/acpixf.h:acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void);
| xen/include/xen/softirq.h:asmlinkage void do_softirq(void);

It is not longer problematic because asmlinkage is always defined empty, but it is still there.

Bastian

Signature · 3 lines
We have found all life forms in the galaxy are capable of superior
development.
		-- Kirk, "The Gamesters of Triskelion", stardate 3211.7
#3 lore raw
Quoted 6 lines · Bastian Blank
Quoted 3 lines · Jan Beulich

Iirc Keir had already taken steps towards removing all the (pointless) asmlinkage annotations, so if there are any left I think we'd rather see them removed than made consistent.

I see a lot of them and always not on both declaration and definition.

Most of the below are in arch/arm, no relevance to x86. The few others are acceptable, only acpi_enter_sleep_state() has a 'non-matching' definition in arch/x86, but of course x86 asmlinkage is a no-op so it's fine.

I have backported my xen-unstable patch to 4.0 and 4.1, so you should find those trees build okay now.

-- Keir

Quoted 25 lines

| xen/arch/arm/traps.c:asmlinkage void __div0(void)
| xen/arch/arm/traps.c:asmlinkage void do_trap_undefined_instruction(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_supervisor_call(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_prefetch_abort(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_data_abort(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)

| xen/arch/arm/traps.c:asmlinkage void do_trap_irq(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void do_trap_fiq(struct cpu_user_regs *regs)
| xen/arch/arm/traps.c:asmlinkage void leave_hypervisor_tail(void)
| xen/common/softirq.c:asmlinkage void do_softirq(void)
| xen/include/acpi/acpixf.h:acpi_status asmlinkage acpi_enter_sleep_state(u8

sleep_state);
| xen/include/acpi/acpixf.h:acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void);
| xen/include/xen/softirq.h:asmlinkage void do_softirq(void);

It is not longer problematic because asmlinkage is always defined empty, but it is still there.

Bastian

#4 lore raw
In reply to Bastian Blank
Quoted 8 lines · Bastian Blank

According to gcc-4.7, "void bla(void)" is incompatible with "asmlinkage void bla(void)". As asmlinkage expands to __attribute__((regparm(0))), it is correct.

The patch adds the missing asmlinkage to function declarations affected. It is needed for 4.1 and 4.2.

This is only relevant for 4.1 . In 4.2 asmlinkage got flattened to a no-op in changeset 24511
http://xenbits.xen.org/hg/staging/xen-unstable.hg/rev/a141f6d64916 . It would be a good idea to get this problem fixed for 4.1.3 but backporting the change from 4.2 might be a better idea.

Michael Young

#5 lore raw
Quoted 9 lines · M A Young
Quoted 7 lines · Bastian Blank

According to gcc-4.7, "void bla(void)" is incompatible with "asmlinkage void bla(void)". As asmlinkage expands to __attribute__((regparm(0))), it is correct.

The patch adds the missing asmlinkage to function declarations affected. It is needed for 4.1 and 4.2.

Quoted 7 lines
Quoted 1 line

This is only relevant for 4.1 . In 4.2 asmlinkage got flattened to a no-op in changeset 24511
http://xenbits.xen.org/hg/staging/xen-unstable.hg/rev/a141f6d64916 . It would be a good idea to get this problem fixed for 4.1.3 but backporting the change from 4.2 might be a better idea.

Done, and for forthcoming 4.0.4-rc3 too.

Quoted 6 lines

Michael Young

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel