-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[NFCI][asm][i386/x86-64] Enable AT&T syntax explicitly #164453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@llvm/pr-subscribers-libunwind @llvm/pr-subscribers-compiler-rt-sanitizer Author: Raul Tambre (tambry) ChangesImplementation 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 No functional change intended. Full diff: https://github.com/llvm/llvm-project/pull/164453.diff 11 Files Affected:
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>)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libunwind changes look good. Please wait for approval from a sanitizer maintainer
You can use clang -masm=intel
instead of -mllvm -x86-asm-syntax=intel
@MaskRay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sanitizer changes LGTM
I believe this patch is leading to this build error on our builders (https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8700376349587788321/overview):
Not sure where the |
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.