[Lldb-commits] [lldb] [NFCI][lldb][test][asm] Enable AT&T syntax explicitly (PR #172358)
Raul Tambre via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 15 11:50:15 PST 2025
https://github.com/tambry created https://github.com/llvm/llvm-project/pull/172358
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: 14c69497b31038b37c273417f43bd2cfe169c86f
>From 00b6d4521c0968dcfc3283c95c78c799408a3319 Mon Sep 17 00:00:00 2001
From: Raul Tambre <raul at tambre.ee>
Date: Mon, 15 Dec 2025 20:41:02 +0200
Subject: [PATCH] [NFCI][lldb][test][asm] Enable AT&T syntax explicitly
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: 14c69497b31038b37c273417f43bd2cfe169c86f
---
.../Python/lldbsuite/test/make/Makefile.rules | 15 +++++++++++++++
lldb/test/Shell/helper/toolchain.py | 5 +++++
2 files changed, 20 insertions(+)
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)]
More information about the lldb-commits
mailing list