Skip to content

Commit 22315a2

Browse files
nathanchancectmarinas
authored andcommitted
arm64: alternatives: Move length validation in alternative_{insn, endif}
After commit 2decad9 ("arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically"), LLVM's integrated assembler fails to build entry.S: <instantiation>:5:7: error: expected assembly-time absolute expression .org . - (664b-663b) + (662b-661b) ^ <instantiation>:6:7: error: expected assembly-time absolute expression .org . - (662b-661b) + (664b-663b) ^ The root cause is LLVM's assembler has a one-pass design, meaning it cannot figure out these instruction lengths when the .org directive is outside of the subsection that they are in, which was changed by the .arch_extension directive added in the above commit. Apply the same fix from commit 966a0ac ("arm64/alternatives: move length validation inside the subsection") to the alternative_endif macro, shuffling the .org directives so that the length validation happen will always happen in the same subsections. alternative_insn has not shown any issue yet but it appears that it could have the same issue in the future so just preemptively change it. Fixes: f7b93d4 ("arm64/alternatives: use subsections for replacement sequences") Cc: <stable@vger.kernel.org> # 5.8.x Link: ClangBuiltLinux#1347 Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Tested-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20210414000803.662534-1-nathan@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 738fa58 commit 22315a2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

arch/arm64/include/asm/alternative-macros.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@
9797
.popsection
9898
.subsection 1
9999
663: \insn2
100-
664: .previous
101-
.org . - (664b-663b) + (662b-661b)
100+
664: .org . - (664b-663b) + (662b-661b)
102101
.org . - (662b-661b) + (664b-663b)
102+
.previous
103103
.endif
104104
.endm
105105

@@ -169,11 +169,11 @@
169169
*/
170170
.macro alternative_endif
171171
664:
172+
.org . - (664b-663b) + (662b-661b)
173+
.org . - (662b-661b) + (664b-663b)
172174
.if .Lasm_alt_mode==0
173175
.previous
174176
.endif
175-
.org . - (664b-663b) + (662b-661b)
176-
.org . - (662b-661b) + (664b-663b)
177177
.endm
178178

179179
/*

0 commit comments

Comments
 (0)