Skip to contentSkip to conversation

x86/entry: add compatibility with IAS

PATCH In review Jian Cai 5 participants 11 messages Jul 13, 2020 – Jul 16, 2020 x86

lore
Share & tools
lore

Jian Cai

author
#0 lore raw

PATCH 1/1 x86/entry: add compatibility with IAS

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

---
 arch/x86/include/asm/idtentry.h | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
arch/x86/include/asm/idtentry.h +10 -12
index f3d70830bf2a..77beed2cd6d9 100644
@@ -468,34 +468,32 @@ __visible noinstr void func(struct pt_regs *regs,			\
  */
 	.align 8
 SYM_CODE_START(irq_entries_start)
-    vector=FIRST_EXTERNAL_VECTOR
-    pos = .
+    i = 1
+    pos1 = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
 	UNWIND_HINT_IRET_REGS
-	.byte	0x6a, vector
+	.byte	0x6a, FIRST_EXTERNAL_VECTOR + i - 1
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = pos1 + 8 * i
+	i = i + 1
     .endr
 SYM_CODE_END(irq_entries_start)
 
 #ifdef CONFIG_X86_LOCAL_APIC
 	.align 8
 SYM_CODE_START(spurious_entries_start)
-    vector=FIRST_SYSTEM_VECTOR
-    pos = .
+    i = 1
+    pos2 = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
 	UNWIND_HINT_IRET_REGS
-	.byte	0x6a, vector
+	.byte	0x6a, FIRST_SYSTEM_VECTOR + i - 1
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = pos2 + 8 * i
+	i = i + 1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif
Signature · 1 line
2.27.0.383.g050319c2ae-goog
#1 lore raw
Quoted 20 lines · Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

---
 arch/x86/include/asm/idtentry.h | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
arch/x86/include/asm/idtentry.h +0 -0
index f3d70830bf2a..77beed2cd6d9 100644

arch/x86/include/asm/idtentry.h __visible noinstr void func(struct pt_regs *regs, \ · line 471

Quoted 6 lines
arch/x86/include/asm/idtentry.h +1 -2
@@ -468,34 +468,32 @@ __visible noinstr void func(struct pt_regs *regs,                 \
  */
        .align 8
 SYM_CODE_START(irq_entries_start)
-    vector=FIRST_EXTERNAL_VECTOR
-    pos = .
+    i = 1

Start with index 0.

arch/x86/include/asm/idtentry.h __visible noinstr void func(struct pt_regs *regs, \ · line 472

Quoted 1 line
arch/x86/include/asm/idtentry.h +1 -0
+    pos1 = .

pos1 is unnecessary, as it's equal to irq_entries_start.

arch/x86/include/asm/idtentry.h __visible noinstr void func(struct pt_regs *regs, \ · line 480

Quoted 12 lines
arch/x86/include/asm/idtentry.h +3 -4
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
        UNWIND_HINT_IRET_REGS
-       .byte   0x6a, vector
+       .byte   0x6a, FIRST_EXTERNAL_VECTOR + i - 1
        jmp     asm_common_interrupt
        nop
        /* Ensure that the above is 8 bytes max */
-       . = pos + 8
-    pos=pos+8
-    vector=vector+1
+       . = pos1 + 8 * i
+       i = i + 1

If you swap these two lines then the index will be correct for the next stub if you start at 0..

Quoted 15 lines
arch/x86/include/asm/idtentry.h +3 -3
     .endr
 SYM_CODE_END(irq_entries_start)
 
 #ifdef CONFIG_X86_LOCAL_APIC
        .align 8
 SYM_CODE_START(spurious_entries_start)
-    vector=FIRST_SYSTEM_VECTOR
-    pos = .
+    i = 1
+    pos2 = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
        UNWIND_HINT_IRET_REGS
-       .byte   0x6a, vector
+       .byte   0x6a, FIRST_SYSTEM_VECTOR + i - 1
        jmp     asm_spurious_interrupt

arch/x86/include/asm/idtentry.h __visible noinstr void func(struct pt_regs *regs, \ · line 499

Quoted 10 lines
arch/x86/include/asm/idtentry.h +2 -3
        nop
        /* Ensure that the above is 8 bytes max */
-       . = pos + 8
-    pos=pos+8
-    vector=vector+1
+       . = pos2 + 8 * i
+       i = i + 1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif

--
Brian Gerst

#2 lore raw
In reply to Jian Cai
Quoted 30 lines · Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

---
 arch/x86/include/asm/idtentry.h | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
arch/x86/include/asm/idtentry.h +3 -3
index f3d70830bf2a..77beed2cd6d9 100644
@@ -468,34 +468,32 @@ __visible noinstr void func(struct pt_regs *regs,			\
  */
 	.align 8
 SYM_CODE_START(irq_entries_start)
-    vector=FIRST_EXTERNAL_VECTOR
-    pos = .
+    i = 1
+    pos1 = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
 	UNWIND_HINT_IRET_REGS
-	.byte	0x6a, vector
+	.byte	0x6a, FIRST_EXTERNAL_VECTOR + i - 1

arch/x86/include/asm/idtentry.h __visible noinstr void func(struct pt_regs *regs, \ · line 482

Quoted 10 lines
arch/x86/include/asm/idtentry.h +2 -3
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = pos1 + 8 * i
+	i = i + 1
     .endr
 SYM_CODE_END(irq_entries_start)

I think it would be a little cleaner to initialize i to 0, and drop pos. i.e. couldn't we do

	i = 0
	...
	.byte	0x6a, FIRST_EXTERNAL_VECTOR + i
	...
	i = i + 1
	. = irq_entries_start + 8 * i
Quoted 26 lines
arch/x86/include/asm/idtentry.h +5 -6
 #ifdef CONFIG_X86_LOCAL_APIC
 	.align 8
 SYM_CODE_START(spurious_entries_start)
-    vector=FIRST_SYSTEM_VECTOR
-    pos = .
+    i = 1
+    pos2 = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
 	UNWIND_HINT_IRET_REGS
-	.byte	0x6a, vector
+	.byte	0x6a, FIRST_SYSTEM_VECTOR + i - 1
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = pos2 + 8 * i
+	i = i + 1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif
Signature · 1 line
2.27.0.383.g050319c2ae-goog
#3 lore raw
Quoted 44 lines · Arvind Sankar
Quoted 30 lines · Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

---
 arch/x86/include/asm/idtentry.h | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
arch/x86/include/asm/idtentry.h +3 -3
index f3d70830bf2a..77beed2cd6d9 100644
@@ -468,34 +468,32 @@ __visible noinstr void func(struct pt_regs *regs,			\
  */
 	.align 8
 SYM_CODE_START(irq_entries_start)
-    vector=FIRST_EXTERNAL_VECTOR
-    pos = .
+    i = 1
+    pos1 = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
 	UNWIND_HINT_IRET_REGS
-	.byte	0x6a, vector
+	.byte	0x6a, FIRST_EXTERNAL_VECTOR + i - 1

arch/x86/include/asm/idtentry.h __visible noinstr void func(struct pt_regs *regs, \ · line 482

Quoted 10 lines
arch/x86/include/asm/idtentry.h +2 -3
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = pos1 + 8 * i
+	i = i + 1
     .endr
 SYM_CODE_END(irq_entries_start)

I think it would be a little cleaner to initialize i to 0, and drop pos. i.e. couldn't we do

Quoted 7 lines
	i = 0
	...
	.byte	0x6a, FIRST_EXTERNAL_VECTOR + i
	...
	i = i + 1
	. = irq_entries_start + 8 * i

Or maybe just:

arch/x86/include/asm/idtentry.h +4 -6
index eeac6dc2adaa..c774039d130b 100644
@@ -469,15 +469,14 @@ __visible noinstr void func(struct pt_regs *regs,			\
 	.align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
+    0:
 	UNWIND_HINT_IRET_REGS
 	.byte	0x6a, vector
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
+	. = 0b + 8
     vector=vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
@@ -486,15 +485,14 @@ SYM_CODE_END(irq_entries_start)
 	.align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
+    0:
 	UNWIND_HINT_IRET_REGS
 	.byte	0x6a, vector
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
+	. = 0b + 8
     vector=vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)
author
#4 lore raw

PATCH 1/1 x86/entry: add compatibility with IAS

In reply to Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

---
 arch/x86/include/asm/idtentry.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
arch/x86/include/asm/idtentry.h +7 -9
index f3d70830bf2a..7d22684eafdf 100644
@@ -469,16 +469,15 @@ __visible noinstr void func(struct pt_regs *regs,			\
 	.align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
+0 :
 	UNWIND_HINT_IRET_REGS
 	.byte	0x6a, vector
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
 
@@ -486,16 +485,15 @@ SYM_CODE_END(irq_entries_start)
 	.align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
+0 :
 	UNWIND_HINT_IRET_REGS
-	.byte	0x6a, vector
+	.byte	0x6a, FIRST_SYSTEM_VECTOR + i
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif
Signature · 1 line
2.27.0.383.g050319c2ae-goog
#5 lore raw
Quoted 21 lines · Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

---
 arch/x86/include/asm/idtentry.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
arch/x86/include/asm/idtentry.h +0 -0
index f3d70830bf2a..7d22684eafdf 100644

arch/x86/include/asm/idtentry.h __visible noinstr void func(struct pt_regs *regs, \ · line 474

Quoted 7 lines
arch/x86/include/asm/idtentry.h +1 -1
@@ -469,16 +469,15 @@ __visible noinstr void func(struct pt_regs *regs,			\
 	.align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
+0 :
 	UNWIND_HINT_IRET_REGS

I know I had it this way, but I think it may be slightly safer to put the label immediately after UNWIND_HINT_IRET_REGS instead of before, just in case anyone adds a 0: inside that macro.

author
#6 lore raw

PATCH 1/1 x86/entry: add compatibility with IAS

In reply to Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

---
 arch/x86/include/asm/idtentry.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
arch/x86/include/asm/idtentry.h +6 -8
index f3d70830bf2a..5efaaed34eda 100644
@@ -469,16 +469,15 @@ __visible noinstr void func(struct pt_regs *regs,			\
 	.align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
 	UNWIND_HINT_IRET_REGS
+0 :
 	.byte	0x6a, vector
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
 
@@ -486,16 +485,15 @@ SYM_CODE_END(irq_entries_start)
 	.align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
 	UNWIND_HINT_IRET_REGS
+0 :
 	.byte	0x6a, vector
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif
Signature · 1 line
2.27.0.383.g050319c2ae-goog
#7 lore raw
Quoted 5 lines · Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

Quoted 8 lines

Hi Jian,

thanks for the update!

I am glad to see that some Linux/x86 assembler "monsters" jumped on the train.

So, your patch with reviewer's comment got several iterations? Not sure if you are aware of the process of submitting patches (see [1])?

It is common to add a ChangeLog below commit-message-body and diffstat means add below "--".
Something like:
--
Changes v1 -> v2:
- I did some cool stuff to improve this

While at it... Please add your version-of-patch to the subject-line:
You can do this via "git format-patch --signoff --subject-prefix="PATCH v2". There might be other cool git tricks I do not know.

Hope I was no "Uberlehrer".

- Sedat -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst

Quoted 51 lines
---
 arch/x86/include/asm/idtentry.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
arch/x86/include/asm/idtentry.h +6 -9
index f3d70830bf2a..5efaaed34eda 100644
@@ -469,16 +469,15 @@ __visible noinstr void func(struct pt_regs *regs,                 \
        .align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
        UNWIND_HINT_IRET_REGS
+0 :
        .byte   0x6a, vector
        jmp     asm_common_interrupt
        nop
        /* Ensure that the above is 8 bytes max */
-       . = pos + 8
-    pos=pos+8
-    vector=vector+1
+       . = 0b + 8
+       vector = vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
 
@@ -486,16 +485,15 @@ SYM_CODE_END(irq_entries_start)
        .align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
        UNWIND_HINT_IRET_REGS
+0 :
        .byte   0x6a, vector
        jmp     asm_spurious_interrupt
        nop
        /* Ensure that the above is 8 bytes max */
-       . = pos + 8
-    pos=pos+8
-    vector=vector+1
+       . = 0b + 8
+       vector = vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif
--

2.27.0.383.g050319c2ae-goog

Tested-by
#8 lore raw
Quoted 85 lines · Sedat Dilek
Quoted 5 lines · Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

Quoted 8 lines

Hi Jian,

thanks for the update!

I am glad to see that some Linux/x86 assembler "monsters" jumped on the train.

So, your patch with reviewer's comment got several iterations? Not sure if you are aware of the process of submitting patches (see [1])?

It is common to add a ChangeLog below commit-message-body and diffstat means add below "--".
Something like:
--
Changes v1 -> v2:
- I did some cool stuff to improve this

While at it... Please add your version-of-patch to the subject-line:
You can do this via "git format-patch --signoff --subject-prefix="PATCH v2". There might be other cool git tricks I do not know.

Hope I was no "Uberlehrer".

- Sedat -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst

Quoted 43 lines
---
 arch/x86/include/asm/idtentry.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
arch/x86/include/asm/idtentry.h +4 -8
index f3d70830bf2a..5efaaed34eda 100644
@@ -469,16 +469,15 @@ __visible noinstr void func(struct pt_regs *regs,                 \
        .align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
        UNWIND_HINT_IRET_REGS
+0 :
        .byte   0x6a, vector
        jmp     asm_common_interrupt
        nop
        /* Ensure that the above is 8 bytes max */
-       . = pos + 8
-    pos=pos+8
-    vector=vector+1
+       . = 0b + 8
+       vector = vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
 
@@ -486,16 +485,15 @@ SYM_CODE_END(irq_entries_start)
        .align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
        UNWIND_HINT_IRET_REGS
+0 :
        .byte   0x6a, vector
        jmp     asm_spurious_interrupt
        nop
        /* Ensure that the above is 8 bytes max */
-       . = pos + 8
-    pos=pos+8
-    vector=vector+1
Quoted 8 lines
Quoted 8 lines
arch/x86/include/asm/idtentry.h +2 -1
+       . = 0b + 8
+       vector = vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif
--

2.27.0.383.g050319c2ae-goog

Stolen the patch from [1].

Compile-/Assemble-tested against Linux v5.8-rc5 with LLVM/Clang v11.0.0-git

- Sedat -

[1] https://lore.kernel.org/patchwork/patch/1272115/

author
#9 lore raw

PATCH v2 1/1 x86/entry: add compatibility with IAS

In reply to Jian Cai

Clang's integrated assembler does not allow symbols with non-absolute values to be reassigned. This patch allows the affected code to be compatible with IAS.

Compile-/Assemble-tested against Linux v5.8-rc5 with LLVM/Clang v11.0.0-git

---

Thanks Nick and Sedat for explaining the process of submitting patches. Include the changelog as follows,

Changes v1 -> v2:
Update the patch based on Arvind Sankar <[email protected]>'s comments. Also include addtional information in the Tested-by tag.

 arch/x86/include/asm/idtentry.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
arch/x86/include/asm/idtentry.h +6 -8
index f3d70830bf2a..5efaaed34eda 100644
@@ -469,16 +469,15 @@ __visible noinstr void func(struct pt_regs *regs,			\
 	.align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
 	UNWIND_HINT_IRET_REGS
+0 :
 	.byte	0x6a, vector
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
 
@@ -486,16 +485,15 @@ SYM_CODE_END(irq_entries_start)
 	.align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
 	UNWIND_HINT_IRET_REGS
+0 :
 	.byte	0x6a, vector
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif
Signature · 1 line
2.27.0.389.gc38d7665816-goog
merge bot Applied
#10 lore raw

[tip: x86/urgent] x86/entry: Add compatibility with IAS

The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     6ee93f8df09c470da1a4af11e394c52d7b62418c
Gitweb:        https://git.kernel.org/tip/6ee93f8df09c470da1a4af11e394c52d7b62418c
Author:        Jian Cai <[email protected]>
AuthorDate:    Tue, 14 Jul 2020 16:30:21 -07:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Thu, 16 Jul 2020 17:25:09 +02:00

x86/entry: Add compatibility with IAS

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.

---
 arch/x86/include/asm/idtentry.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
arch/x86/include/asm/idtentry.h +6 -8
index f3d7083..5efaaed 100644
@@ -469,16 +469,15 @@ __visible noinstr void func(struct pt_regs *regs,			\
 	.align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
 	UNWIND_HINT_IRET_REGS
+0 :
 	.byte	0x6a, vector
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
 
@@ -486,16 +485,15 @@ SYM_CODE_END(irq_entries_start)
 	.align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
 	UNWIND_HINT_IRET_REGS
+0 :
 	.byte	0x6a, vector
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
-    vector=vector+1
+	. = 0b + 8
+	vector = vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)
 #endif