Skip to content

Conversation

@tambry
Copy link
Contributor

@tambry tambry commented Dec 15, 2025

Implementation files using the Intel syntax typically explicitly specify it. Do the same for the few files using AT&T syntax.
This enables building LLVM with -mllvm -x86-asm-syntax=intel in one's Clang config files (i.e. a global preference for Intel syntax).

Unreverts: 14c6949

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

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

Unreverts: 14c6949
@tambry tambry self-assigned this Dec 15, 2025
@tambry tambry requested a review from JDevlieghere as a code owner December 15, 2025 19:50
@llvmbot llvmbot added the lldb label Dec 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 15, 2025

@llvm/pr-subscribers-lldb

Author: Raul Tambre (tambry)

Changes

Implementation files using the Intel syntax typically explicitly specify it. Do the same for the few files using AT&T syntax.
This enables building LLVM with -mllvm -x86-asm-syntax=intel in one's Clang config files (i.e. a global preference for Intel syntax).

Unreverts: 14c6949


Full diff: https://github.com/llvm/llvm-project/pull/172358.diff

2 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (+15)
  • (modified) lldb/test/Shell/helper/toolchain.py (+5)
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 55dbd3934860f..a0d40ab868874 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -180,21 +180,27 @@ else
 	# amd64, x86_64, x64 -> 64
 	ifeq "$(ARCH)" "amd64"
 		override ARCH := $(subst amd64,64,$(ARCH))
+		IS_X86 := 1
 	endif
 	ifeq "$(ARCH)" "x86_64"
 		override ARCH := $(subst x86_64,64,$(ARCH))
+		IS_X86 := 1
 	endif
 	ifeq "$(ARCH)" "x64"
 		override ARCH := $(subst x64,64,$(ARCH))
+		IS_X86 := 1
 	endif
 	ifeq "$(ARCH)" "x86"
 		override ARCH := $(subst x86,32,$(ARCH))
+		IS_X86 := 1
 	endif
 	ifeq "$(ARCH)" "i386"
 		override ARCH := $(subst i386,32,$(ARCH))
+		IS_X86 := 1
 	endif
 	ifeq "$(ARCH)" "i686"
 		override ARCH := $(subst i686,32,$(ARCH))
+		IS_X86 := 1
 	endif
 	ifeq "$(ARCH)" "powerpc"
 		override ARCH := $(subst powerpc,32,$(ARCH))
@@ -320,6 +326,15 @@ ifeq "$(MAKE_GMODULES)" "YES"
 	CXXFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
 endif
 
+# Our files use x86 AT&T assembly throughout.
+# Enable it explicitly so any local Clang preference for Intel syntax gets overriden.
+ifeq ($(CC_TYPE), clang)
+	ifeq ($(IS_X86), 1)
+		CFLAGS += -mllvm -x86-asm-syntax=att
+		CXXFLAGS += -mllvm -x86-asm-syntax=att
+	endif
+endif
+
 CFLAGS += $(CFLAGS_EXTRAS)
 CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS)
 # Copy common options to the linker flags (dwarf, arch. & etc).
diff --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py
index 0c8c39d37e089..66664561a249d 100644
--- a/lldb/test/Shell/helper/toolchain.py
+++ b/lldb/test/Shell/helper/toolchain.py
@@ -242,6 +242,11 @@ def use_support_substitutions(config):
     # The clang module cache is used for building inferiors.
     host_flags += ["-fmodules-cache-path={}".format(config.clang_module_cache)]
 
+    # Our files use x86 AT&T assembly throughout.
+    # Enable it explicitly so any local Clang preference for Intel syntax gets overriden.
+    if "x86-registered-target" in config.available_features:
+        host_flags += ["-mllvm", "-x86-asm-syntax=att"]
+
     if config.cmake_sysroot:
         host_flags += ["--sysroot={}".format(config.cmake_sysroot)]
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants