From ccd0a1ca865d3b640f902945df84bb2be388a755 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 4 Sep 2026 22:10:44 +0200 Subject: x86_64/cpu: fix asm input constraint The "X" constraint tells GCC that any operand whatsoever is valid to be placed in the assembler template. This makes no sense in this case, since that would allow for the exact expression to be inserted. If that happens, which it does when `-Og` is active, GCC is unable to assemble that template. The correct constraint is forcing the value into a register. --- arch/x86_64/arch/cpu/global_descriptor_table.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86_64/arch/cpu/global_descriptor_table.hpp b/arch/x86_64/arch/cpu/global_descriptor_table.hpp index 986dd566..0bd7677d 100644 --- a/arch/x86_64/arch/cpu/global_descriptor_table.hpp +++ b/arch/x86_64/arch/cpu/global_descriptor_table.hpp @@ -73,8 +73,8 @@ namespace arch::cpu "mov %%rax, %%fs\n" "mov %%rax, %%gs\n" : - : "X"(code_segment_index * sizeof(segment_descriptor)), - "X"(data_segment_index * sizeof(segment_descriptor)) + : "r"(code_segment_index * sizeof(segment_descriptor)), + "r"(data_segment_index * sizeof(segment_descriptor)) : "rax"); } -- cgit v1.2.3