[Lldb-commits] [lldb] 423919d - [NFCI][lldb][test][asm] Enable AT&T syntax explicitly (#166770)

via lldb-commits lldb-commits at lists.llvm.org
Sun Dec 14 13:54:29 PST 2025


Author: Raul Tambre
Date: 2025-12-14T23:54:25+02:00
New Revision: 423919d31f4b55f22b09cd5066534f7c91e71d4b

URL: https://github.com/llvm/llvm-project/commit/423919d31f4b55f22b09cd5066534f7c91e71d4b
DIFF: https://github.com/llvm/llvm-project/commit/423919d31f4b55f22b09cd5066534f7c91e71d4b.diff

LOG: [NFCI][lldb][test][asm] Enable AT&T syntax explicitly (#166770)

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).

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/make/Makefile.rules
    lldb/test/API/functionalities/disassembler-variables/Makefile
    lldb/test/API/functionalities/disassembler-variables/d_original_example.s
    lldb/test/API/functionalities/disassembler-variables/live_across_call.s
    lldb/test/API/functionalities/disassembler-variables/loop_reg_rotate.s
    lldb/test/API/functionalities/disassembler-variables/regs_fp_params.s
    lldb/test/API/functionalities/disassembler-variables/regs_int_params.s
    lldb/test/API/functionalities/disassembler-variables/regs_mixed_params.s
    lldb/test/API/functionalities/disassembler-variables/seed_reg_const_undef.s
    lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_GNU_call_site-DW_AT_low_pc.s
    lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
    lldb/test/Shell/SymbolFile/DWARF/x86/Inputs/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu2.s
    lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
    lldb/test/Shell/Unwind/Inputs/eh-frame-augment-noop.s
    lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-abort.s
    lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-val-offset.s
    lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind.s
    lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
    lldb/test/Shell/Unwind/Inputs/prefer-debug-over-eh-frame.s
    lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
    lldb/test/Shell/Unwind/Inputs/trap_frame_sym_ctx.s
    lldb/test/Shell/Unwind/Inputs/unwind-plan-dwarf-dump.s
    lldb/test/Shell/helper/toolchain.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 55dbd3934860f..1b967219134d8 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -320,6 +320,13 @@ 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)
+	CFLAGS += -mllvm -x86-asm-syntax=att
+	CXXFLAGS += -mllvm -x86-asm-syntax=att
+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/API/functionalities/disassembler-variables/Makefile b/lldb/test/API/functionalities/disassembler-variables/Makefile
index 3d4bcd22fa653..0b6a8cc6bb297 100644
--- a/lldb/test/API/functionalities/disassembler-variables/Makefile
+++ b/lldb/test/API/functionalities/disassembler-variables/Makefile
@@ -19,7 +19,7 @@ dummy_main.c:
 
 # Assemble .s → .o using the configured compiler.
 %.o: %.s
-	$(CC) -c -x assembler $< -o $@
+	$(CC) $(CFLAGS) -c -x assembler $< -o $@
 
 # Default target: build all .o fixtures and the dummy exe.
 .PHONY: all

diff  --git a/lldb/test/API/functionalities/disassembler-variables/d_original_example.s b/lldb/test/API/functionalities/disassembler-variables/d_original_example.s
index c38742cfc683e..8824d4c81fa2c 100644
--- a/lldb/test/API/functionalities/disassembler-variables/d_original_example.s
+++ b/lldb/test/API/functionalities/disassembler-variables/d_original_example.s
@@ -1,6 +1,6 @@
 /* Original C (for context):
 * #include <stdio.h>
-* 
+*
 * int main(int argc, char **argv) {
 *   for (int i = 1; i < argc; ++i)
 *     puts(argv[i]);
@@ -8,6 +8,7 @@
 * }
 */
 	.file	"d_original_example.c"
+	.att_syntax
 	.text
 	.globl	main                            # -- Begin function main
 	.p2align	4

diff  --git a/lldb/test/API/functionalities/disassembler-variables/live_across_call.s b/lldb/test/API/functionalities/disassembler-variables/live_across_call.s
index cd9f08afe6fdc..4bdf68cbbebb4 100644
--- a/lldb/test/API/functionalities/disassembler-variables/live_across_call.s
+++ b/lldb/test/API/functionalities/disassembler-variables/live_across_call.s
@@ -1,7 +1,7 @@
 /* Original C (for context):
 * // Declare a real external call so the compiler must respect ABI clobbers.
 * extern int leaf(int) __attribute__((noinline));
-* 
+*
 * __attribute__((noinline))
 * int live_across_call(int x) {
 *   volatile int a = x;                // a starts in a GPR (from arg)
@@ -12,6 +12,7 @@
 * }
 */
 	.file	"live_across_call.c"
+	.att_syntax
 	.text
 	.globl	live_across_call                # -- Begin function live_across_call
 	.p2align	4

diff  --git a/lldb/test/API/functionalities/disassembler-variables/loop_reg_rotate.s b/lldb/test/API/functionalities/disassembler-variables/loop_reg_rotate.s
index c01e2b28fd2be..c35116551baab 100644
--- a/lldb/test/API/functionalities/disassembler-variables/loop_reg_rotate.s
+++ b/lldb/test/API/functionalities/disassembler-variables/loop_reg_rotate.s
@@ -3,7 +3,7 @@
 * int loop_reg_rotate(int n, int seed) {
 *   volatile int acc = seed;    // keep as a named local
 *   int i = 0, j = 1, k = 2;    // extra pressure but not enough to spill
-* 
+*
 *   for (int t = 0; t < n; ++t) {
 *     // Mix uses so the allocator may reshuffle regs for 'acc'
 *     acc = acc + i;
@@ -13,12 +13,13 @@
 *     acc = acc + k;
 *     i ^= acc; j += acc; k ^= j;
 *   }
-* 
+*
 *   asm volatile("" :: "r"(acc));
 *   return acc + i + j + k;
 * }
 */
 	.file	"loop_reg_rotate.c"
+	.att_syntax
 	.text
 	.globl	loop_reg_rotate                 # -- Begin function loop_reg_rotate
 	.p2align	4

diff  --git a/lldb/test/API/functionalities/disassembler-variables/regs_fp_params.s b/lldb/test/API/functionalities/disassembler-variables/regs_fp_params.s
index 502ab151e0c5b..86863d4902357 100644
--- a/lldb/test/API/functionalities/disassembler-variables/regs_fp_params.s
+++ b/lldb/test/API/functionalities/disassembler-variables/regs_fp_params.s
@@ -5,6 +5,7 @@
 *   return a + b + c + d + e + f;
 * }*/
 	.file	"regs_fp_params.c"
+	.att_syntax
 	.text
 	.globl	regs_fp_params                  # -- Begin function regs_fp_params
 	.p2align	4

diff  --git a/lldb/test/API/functionalities/disassembler-variables/regs_int_params.s b/lldb/test/API/functionalities/disassembler-variables/regs_int_params.s
index 0b2a60e2b4d5f..c44e3c3d85558 100644
--- a/lldb/test/API/functionalities/disassembler-variables/regs_int_params.s
+++ b/lldb/test/API/functionalities/disassembler-variables/regs_int_params.s
@@ -8,6 +8,7 @@
 * }
 */
 	.file	"regs_int_params.c"
+	.att_syntax
 	.text
 	.globl	regs_int_params                 # -- Begin function regs_int_params
 	.p2align	4

diff  --git a/lldb/test/API/functionalities/disassembler-variables/regs_mixed_params.s b/lldb/test/API/functionalities/disassembler-variables/regs_mixed_params.s
index 691180b42f249..1c25af1f570ee 100644
--- a/lldb/test/API/functionalities/disassembler-variables/regs_mixed_params.s
+++ b/lldb/test/API/functionalities/disassembler-variables/regs_mixed_params.s
@@ -11,6 +11,7 @@
 */
 	.file	"regs_mixed_params.c"
 	.file	0 "." "regs_mixed_params.c" md5 0x73c4bda40238ae460aaecb3a6a2603cf
+	.att_syntax
 	.text
 	.globl	regs_mixed_params               # -- Begin function regs_mixed_params
 	.p2align	4

diff  --git a/lldb/test/API/functionalities/disassembler-variables/seed_reg_const_undef.s b/lldb/test/API/functionalities/disassembler-variables/seed_reg_const_undef.s
index f85b8a712cbb2..4e3d64d57cd13 100644
--- a/lldb/test/API/functionalities/disassembler-variables/seed_reg_const_undef.s
+++ b/lldb/test/API/functionalities/disassembler-variables/seed_reg_const_undef.s
@@ -10,6 +10,7 @@
 */
 
 	.file	"seed_reg_const_undef.c"
+	.att_syntax
 	.text
 	.globl	main                            # -- Begin function main
 	.p2align	4

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_GNU_call_site-DW_AT_low_pc.s b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_GNU_call_site-DW_AT_low_pc.s
index c6e5ccda5f2ef..24a64bdd5aa67 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_GNU_call_site-DW_AT_low_pc.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_GNU_call_site-DW_AT_low_pc.s
@@ -27,6 +27,7 @@
 #   return 0;
 # }
 
+	.att_syntax
 	.text
 .Ltext0:
 	.type	b, @function

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
index e64cd176c6302..7c583f6bf59c4 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
@@ -24,6 +24,7 @@
 # CHECK: inlinevar.h:2: (int) var = {{.*}}
 # Unfixed LLDB did show only: (int) var = {{.*}}
 
+	.att_syntax
 	.text
 	.file	"inlinevar1.c"
 	.file	1 "" "./inlinevarother.h"

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/Inputs/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu2.s b/lldb/test/Shell/SymbolFile/DWARF/x86/Inputs/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu2.s
index 6a8dfa3eb63f3..6758a900f9b90 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/Inputs/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu2.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/Inputs/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu2.s
@@ -1,3 +1,4 @@
+	.att_syntax
 	.text
 	.file	"inlinevar2.c"
 	.globl	other                       # -- Begin function other

diff  --git a/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s b/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
index a7b5431a7afaf..d89366c15eca9 100644
--- a/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
+++ b/lldb/test/Shell/Unwind/Inputs/basic-block-sections-with-dwarf.s
@@ -8,6 +8,7 @@
 # using the frame pointer register and the are deliberately adjusting the stack
 # pointer to test that we're using the correct unwind row.
 
+        .att_syntax
         .text
 
         .type   baz, at function

diff  --git a/lldb/test/Shell/Unwind/Inputs/eh-frame-augment-noop.s b/lldb/test/Shell/Unwind/Inputs/eh-frame-augment-noop.s
index 2bcf534f04fcf..cb2f8358bac9b 100644
--- a/lldb/test/Shell/Unwind/Inputs/eh-frame-augment-noop.s
+++ b/lldb/test/Shell/Unwind/Inputs/eh-frame-augment-noop.s
@@ -2,6 +2,7 @@
 # augmentation machinery should detect that no augmentation is needed and use
 # eh_frame directly.
 
+        .att_syntax
         .text
         .globl  foo
 foo:

diff  --git a/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-abort.s b/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-abort.s
index 95099ce42d3f5..670c97e5dd0bf 100644
--- a/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-abort.s
+++ b/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-abort.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .text
         .globl  asm_main
 asm_main:

diff  --git a/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-val-offset.s b/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-val-offset.s
index 273921cc9c549..2ec991033e262 100644
--- a/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-val-offset.s
+++ b/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind-val-offset.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .text
         .globl  bar
 bar:

diff  --git a/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind.s b/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind.s
index d83551483dd31..dd0b5de7004df 100644
--- a/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind.s
+++ b/lldb/test/Shell/Unwind/Inputs/eh-frame-dwarf-unwind.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .text
         .globl  bar
 bar:

diff  --git a/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s b/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
index 29decefad5e51..71782601b3c53 100644
--- a/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
+++ b/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .text
 
         .type   bar, @function

diff  --git a/lldb/test/Shell/Unwind/Inputs/prefer-debug-over-eh-frame.s b/lldb/test/Shell/Unwind/Inputs/prefer-debug-over-eh-frame.s
index c9b7a785c3410..29f65fe4afbc2 100644
--- a/lldb/test/Shell/Unwind/Inputs/prefer-debug-over-eh-frame.s
+++ b/lldb/test/Shell/Unwind/Inputs/prefer-debug-over-eh-frame.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .cfi_sections .eh_frame, .debug_frame
         .text
         .globl  bar

diff  --git a/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s b/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
index dd4453c64b88a..1ef46bd5d2460 100644
--- a/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
+++ b/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .text
         .globl  asm_main
 asm_main:

diff  --git a/lldb/test/Shell/Unwind/Inputs/trap_frame_sym_ctx.s b/lldb/test/Shell/Unwind/Inputs/trap_frame_sym_ctx.s
index 50ede2d34d38d..f35a60b7e809e 100644
--- a/lldb/test/Shell/Unwind/Inputs/trap_frame_sym_ctx.s
+++ b/lldb/test/Shell/Unwind/Inputs/trap_frame_sym_ctx.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .text
         .globl  bar
 bar:

diff  --git a/lldb/test/Shell/Unwind/Inputs/unwind-plan-dwarf-dump.s b/lldb/test/Shell/Unwind/Inputs/unwind-plan-dwarf-dump.s
index 6030affd09d20..d3ec4fd8fa41d 100644
--- a/lldb/test/Shell/Unwind/Inputs/unwind-plan-dwarf-dump.s
+++ b/lldb/test/Shell/Unwind/Inputs/unwind-plan-dwarf-dump.s
@@ -1,3 +1,4 @@
+        .att_syntax
         .text
         .globl  main
         .type   main, @function

diff  --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py
index 0c8c39d37e089..dd8ca48b7d76e 100644
--- a/lldb/test/Shell/helper/toolchain.py
+++ b/lldb/test/Shell/helper/toolchain.py
@@ -242,6 +242,10 @@ 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.
+    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