selftests: kvm: remove reassignment of non-absolute variables
PATCH 1/1 selftests: kvm: remove reassignment of non-absolute variables
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2 -2
@@ -54,9 +54,9 @@ idt_handlers: .align 8 /* Fetch current address and append it to idt_handlers. */ - current_handler = . +0 : .pushsection .rodata -.quad current_handler + .quad 0b .popsection .if ! \has_error
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
Sean Christopherson
reviewerQuoted 16 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-0
tools/testing/selftests/kvm/lib/x86_64/handlers.S idt_handlers: · line 59
Quoted 8 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2
-2@@ -54,9 +54,9 @@ idt_handlers: .align 8 /* Fetch current address and append it to idt_handlers. */ - current_handler = . +0 : .pushsection .rodata -.quad current_handler + .quad 0b
Bit of a silly nit: can we use a named label, or at least a non-zero shorthand? It's really easy to misread "0b" as zeroing out the value, at least for me.
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-0.popsection .if ! \has_errorSignature · 1 line
2.29.2.576.ga3fc446d84-goog
Quoted 20 lines · Sean Christopherson
Quoted 18 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-0@@ -54,9 +54,9 @@ idt_handlers: .align 8
Quoted 10 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S idt_handlers: · line 59
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2
-2/* Fetch current address and append it to idt_handlers. */ - current_handler = . +0 : .pushsection .rodata -.quad current_handler + .quad 0bBit of a silly nit: can we use a named label, or at least a non-zero shorthand? It's really easy to misread "0b" as zeroing out the value, at least for me.
I don't believe that will work. If I rename "0 :" to something more concrete, like ".Lcurrent :", then the label's redefined because of the ".rept". If I assign the "0b" to something, we're back with the unmodified code, which clang issues an error for:
<instantiation>:3500:6: error: invalid reassignment of non-absolute variable 'x'
x = 0b
^
<instantiation>:2:2: note: while in macro instantiation
.rept 255 - 18 + 1
^
Quoted 6 lines
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-1.popsection .if ! \has_error --2.29.2.576.ga3fc446d84-goog
Sean Christopherson
reviewerQuoted 36 lines · Bill Wendling
Quoted 20 lines · Sean Christopherson
Quoted 18 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-0@@ -54,9 +54,9 @@ idt_handlers: .align 8Quoted 10 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S idt_handlers: · line 59
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2
-2/* Fetch current address and append it to idt_handlers. */ - current_handler = . +0 : .pushsection .rodata -.quad current_handler + .quad 0bBit of a silly nit: can we use a named label, or at least a non-zero shorthand? It's really easy to misread "0b" as zeroing out the value, at least for me.
I don't believe that will work. If I rename "0 :" to something more concrete, like ".Lcurrent :", then the label's redefined because of the ".rept". If I assign the "0b" to something, we're back with the unmodified code, which clang issues an error for:
Quoted 5 lines
<instantiation>:3500:6: error: invalid reassignment of non-absolute variable 'x'
x = 0b^<instantiation>:2:2: note: while in macro instantiation
.rept 255 - 18 + 1
Boo. I assume 1: and 1b work? Or my KVM favorite "666:" :-) That's enough to at least make me pause and actually read the code.
Quoted 8 lines
^
Quoted 6 lines
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-1.popsection .if ! \has_error --2.29.2.576.ga3fc446d84-goog
Quoted 36 lines · Sean Christopherson
Quoted 35 lines · Bill Wendling
Quoted 19 lines · Sean Christopherson
Quoted 18 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-0@@ -54,9 +54,9 @@ idt_handlers: .align 8Quoted 10 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S idt_handlers: · line 59
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2
-2/* Fetch current address and append it to idt_handlers. */ - current_handler = . +0 : .pushsection .rodata -.quad current_handler + .quad 0bBit of a silly nit: can we use a named label, or at least a non-zero shorthand? It's really easy to misread "0b" as zeroing out the value, at least for me.
I don't believe that will work. If I rename "0 :" to something more concrete, like ".Lcurrent :", then the label's redefined because of the ".rept". If I assign the "0b" to something, we're back with the unmodified code, which clang issues an error for:
Quoted 9 lines
Quoted 5 lines
<instantiation>:3500:6: error: invalid reassignment of non-absolute variable 'x'
x = 0b^<instantiation>:2:2: note: while in macro instantiation
.rept 255 - 18 + 1Boo. I assume 1: and 1b work? Or my KVM favorite "666:" :-) That's enough to at least make me pause and actually read the code.
Ah! I missed the second part of your message (about the non-zero shorthand). That should work. Sorry about that. :-) Should I submit a new version of this patch?
-bw
Sean Christopherson
reviewerQuoted 43 lines · Bill Wendling
Quoted 42 lines · Sean Christopherson
Quoted 40 lines · Bill Wendling
Quoted 19 lines · Sean Christopherson
Quoted 18 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-0@@ -54,9 +54,9 @@ idt_handlers: .align 8Quoted 10 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S idt_handlers: · line 59
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2
-2/* Fetch current address and append it to idt_handlers. */ - current_handler = . +0 : .pushsection .rodata -.quad current_handler + .quad 0bBit of a silly nit: can we use a named label, or at least a non-zero shorthand? It's really easy to misread "0b" as zeroing out the value, at least for me.
I don't believe that will work. If I rename "0 :" to something more concrete, like ".Lcurrent :", then the label's redefined because of the ".rept". If I assign the "0b" to something, we're back with the unmodified code, which clang issues an error for:
<instantiation>:3500:6: error: invalid reassignment of non-absolute variable 'x'
x = 0b^<instantiation>:2:2: note: while in macro instantiation
.rept 255 - 18 + 1
Quoted 6 lines
Quoted 3 lines
Boo. I assume 1: and 1b work? Or my KVM favorite "666:" :-) That's enough to at least make me pause and actually read the code.
Ah! I missed the second part of your message (about the non-zero shorthand). That should work. Sorry about that. :-) Should I submit a new version of this patch?
That'd probably be easiest. This is trivial enought to fixup when applying, but we might as well save a few of Paolo's cycles for other things.
Thanks!
PATCH v2 1/1 selftests: kvm: remove reassignment of non-absolute variables
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2 -2
@@ -54,9 +54,9 @@ idt_handlers: .align 8 /* Fetch current address and append it to idt_handlers. */ - current_handler = . +666 : .pushsection .rodata -.quad current_handler + .quad 666b .popsection .if ! \has_error
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
Quoted 8 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
Quoted 11 lines · Jim Mattson
Quoted 8 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
Reviewed-by Jim Mattson <[email protected]>
Queued, thanks.
Paolo
By non-zero, I think Sean means something like:
666:
.pushsection .rodata
.quad 666b
Quoted 50 lines · Bill Wendling
Quoted 20 lines · Sean Christopherson
Quoted 18 lines · Bill Wendling
Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. Modify the interrupt entry loop macro to be compatible with IAS by using a label and an offset.
Cc Jian Cai <[email protected]>Signed-off-by Bill Wendling <[email protected]>References: https://lore.kernel.org/lkml/[email protected]/
--- tools/testing/selftests/kvm/lib/x86_64/handlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-0@@ -54,9 +54,9 @@ idt_handlers: .align 8Quoted 10 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S idt_handlers: · line 59
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +2
-2/* Fetch current address and append it to idt_handlers. */ - current_handler = . +0 : .pushsection .rodata -.quad current_handler + .quad 0bBit of a silly nit: can we use a named label, or at least a non-zero shorthand? It's really easy to misread "0b" as zeroing out the value, at least for me.
I don't believe that will work. If I rename "0 :" to something more concrete, like ".Lcurrent :", then the label's redefined because of the ".rept". If I assign the "0b" to something, we're back with the unmodified code, which clang issues an error for:
<instantiation>:3500:6: error: invalid reassignment of non-absolute variable 'x'
x = 0b^<instantiation>:2:2: note: while in macro instantiation
.rept 255 - 18 + 1
^Quoted 6 lines
Quoted 6 lines
tools/testing/selftests/kvm/lib/x86_64/handlers.S +0
-1.popsection .if ! \has_error --2.29.2.576.ga3fc446d84-goog