[compiler-rt] [libunwind] [openmp] [NFCI][asm][i386/x86-64] Enable AT&T syntax explicitly (PR #164453)

Raul Tambre via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 09:07:58 PDT 2025


https://github.com/tambry created https://github.com/llvm/llvm-project/pull/164453

Implementation files using the Intel syntax explicitly specify it. Do the same for the few files using AT&T syntax.

This also enables building LLVM with `-mllvm -x86-asm-syntax=intel` in one's Clang config files (i.e. a global preference for Intel syntax).

No functional change intended.

>From 3138a198f0938fbe740702d3f8bff44ae989f531 Mon Sep 17 00:00:00 2001
From: Raul Tambre <raul at tambre.ee>
Date: Tue, 21 Oct 2025 13:58:13 +0300
Subject: [PATCH] [NFCI][asm][i386/x86-64] Enable AT&T syntax explicitly

Implementation files using the Intel syntax explicitly specify it.
Do the same for the few files using AT&T syntax.

This also enables building LLVM with `-mllvm -x86-asm-syntax=intel` in one's Clang config files
(i.e. a global preference for Intel syntax).

No functional change intended.
---
 compiler-rt/lib/asan/asan_rtl_x86_64.S                        | 1 +
 compiler-rt/lib/builtins/assembly.h                           | 4 ++++
 compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S                 | 1 +
 compiler-rt/lib/orc/elfnix_tls.x86-64.S                       | 1 +
 compiler-rt/lib/orc/sysv_reenter.x86-64.S                     | 1 +
 .../sanitizer_common_interceptors_vfork_i386.inc.S            | 2 ++
 .../sanitizer_common_interceptors_vfork_x86_64.inc.S          | 2 ++
 compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S                     | 2 ++
 libunwind/src/UnwindRegistersRestore.S                        | 3 +++
 libunwind/src/UnwindRegistersSave.S                           | 2 ++
 openmp/runtime/src/z_Linux_asm.S                              | 1 +
 11 files changed, 20 insertions(+)

diff --git a/compiler-rt/lib/asan/asan_rtl_x86_64.S b/compiler-rt/lib/asan/asan_rtl_x86_64.S
index 9c5289856d8ae..5ee830d3afc5e 100644
--- a/compiler-rt/lib/asan/asan_rtl_x86_64.S
+++ b/compiler-rt/lib/asan/asan_rtl_x86_64.S
@@ -5,6 +5,7 @@
 #include "sanitizer_common/sanitizer_platform.h"
 
 .file "asan_rtl_x86_64.S"
+.att_syntax
 
 #define NAME(n, reg, op, s, i) n##_##op##_##i##_##s##_##reg
 
diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
index d1e532813aa24..79a45d9143b40 100644
--- a/compiler-rt/lib/builtins/assembly.h
+++ b/compiler-rt/lib/builtins/assembly.h
@@ -337,4 +337,8 @@
 #endif
 #endif
 
+#if defined(__i386__) || defined(__amd64__)
+.att_syntax
+#endif
+
 #endif // COMPILERRT_ASSEMBLY_H
diff --git a/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S b/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S
index 9804e8d7cecaa..a5379d39c6e79 100644
--- a/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S
+++ b/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S
@@ -30,6 +30,7 @@
 
 .section .text
 .file "hwasan_setjmp_x86_64.S"
+.att_syntax
 
 .global ASM_WRAPPER_NAME(setjmp)
 ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(setjmp))
diff --git a/compiler-rt/lib/orc/elfnix_tls.x86-64.S b/compiler-rt/lib/orc/elfnix_tls.x86-64.S
index b3e0bef008674..da202127bdbf3 100644
--- a/compiler-rt/lib/orc/elfnix_tls.x86-64.S
+++ b/compiler-rt/lib/orc/elfnix_tls.x86-64.S
@@ -13,6 +13,7 @@
 
 // The content of this file is x86_64-only
 #if defined(__x86_64__)
+.att_syntax
 
 #define REGISTER_SAVE_SPACE_SIZE        512
 
diff --git a/compiler-rt/lib/orc/sysv_reenter.x86-64.S b/compiler-rt/lib/orc/sysv_reenter.x86-64.S
index 0a36280f1d1f8..99615c0468b9a 100644
--- a/compiler-rt/lib/orc/sysv_reenter.x86-64.S
+++ b/compiler-rt/lib/orc/sysv_reenter.x86-64.S
@@ -12,6 +12,7 @@
 
 // The content of this file is x86_64-only
 #if defined(__x86_64__)
+.att_syntax
 
 // Save all GRPS except %rsp.
 // This value is also subtracted from %rsp below, despite the fact that %rbp
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S
index c633014e2daa8..5ef090c003dc5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S
@@ -2,6 +2,8 @@
 
 #include "sanitizer_common/sanitizer_asm.h"
 
+.att_syntax
+
 .comm _ZN14__interception10real_vforkE,4,4
 .globl ASM_WRAPPER_NAME(vfork)
 ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S
index 5500f817aec58..9c85407fe022b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S
@@ -2,6 +2,8 @@
 
 #include "sanitizer_common/sanitizer_asm.h"
 
+.att_syntax
+
 .comm _ZN14__interception10real_vforkE,8,8
 .globl ASM_WRAPPER_NAME(vfork)
 ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S b/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
index f848be9dd46c3..8b9b706a822df 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
@@ -3,6 +3,8 @@
 
 #include "sanitizer_common/sanitizer_asm.h"
 
+.att_syntax
+
 #if !defined(__APPLE__)
 .section .text
 #else
diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S
index 5d71d2cf61ad9..1ab4c43b673b4 100644
--- a/libunwind/src/UnwindRegistersRestore.S
+++ b/libunwind/src/UnwindRegistersRestore.S
@@ -25,6 +25,8 @@
 #if !defined(__USING_SJLJ_EXCEPTIONS__)
 
 #if defined(__i386__)
+.att_syntax
+
 DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_x86_jumpto)
 #
 # extern "C" void __libunwind_Registers_x86_jumpto(Registers_x86 *);
@@ -69,6 +71,7 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_x86_jumpto)
   # skip gs
 
 #elif defined(__x86_64__) && !defined(__arm64ec__)
+.att_syntax
 
 DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_x86_64_jumpto)
 #
diff --git a/libunwind/src/UnwindRegistersSave.S b/libunwind/src/UnwindRegistersSave.S
index fe3ba7842619f..31a177f4a0df4 100644
--- a/libunwind/src/UnwindRegistersSave.S
+++ b/libunwind/src/UnwindRegistersSave.S
@@ -25,6 +25,7 @@
 #if !defined(__USING_SJLJ_EXCEPTIONS__)
 
 #if defined(__i386__)
+.att_syntax
 
 #
 # extern int __unw_getcontext(unw_context_t* thread_state)
@@ -109,6 +110,7 @@ DEFINE_LIBUNWIND_FUNCTION("#__unw_getcontext")
   .text
 
 #elif defined(__x86_64__)
+.att_syntax
 
 #
 # extern int __unw_getcontext(unw_context_t* thread_state)
diff --git a/openmp/runtime/src/z_Linux_asm.S b/openmp/runtime/src/z_Linux_asm.S
index ec4d762742a53..89359759fcb42 100644
--- a/openmp/runtime/src/z_Linux_asm.S
+++ b/openmp/runtime/src/z_Linux_asm.S
@@ -18,6 +18,7 @@
 #include "kmp_config.h"
 
 #if KMP_ARCH_X86 || KMP_ARCH_X86_64
+.att_syntax
 
 # if defined(__ELF__) && defined(__CET__) && defined(__has_include)
 # if __has_include(<cet.h>)



More information about the llvm-commits mailing list