[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).
This commit is contained in:
Raul Tambre 2025-12-14 23:54:25 +02:00 committed by GitHub
parent bebc28a0ac
commit 423919d31f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 36 additions and 5 deletions

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -8,6 +8,7 @@
* }
*/
.file "regs_int_params.c"
.att_syntax
.text
.globl regs_int_params # -- Begin function regs_int_params
.p2align 4

View File

@ -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

View File

@ -10,6 +10,7 @@
*/
.file "seed_reg_const_undef.c"
.att_syntax
.text
.globl main # -- Begin function main
.p2align 4

View File

@ -27,6 +27,7 @@
# return 0;
# }
.att_syntax
.text
.Ltext0:
.type b, @function

View File

@ -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"

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.file "inlinevar2.c"
.globl other # -- Begin function other

View File

@ -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,@function

View File

@ -2,6 +2,7 @@
# augmentation machinery should detect that no augmentation is needed and use
# eh_frame directly.
.att_syntax
.text
.globl foo
foo:

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.globl asm_main
asm_main:

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.globl bar
bar:

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.globl bar
bar:

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.type bar, @function

View File

@ -1,3 +1,4 @@
.att_syntax
.cfi_sections .eh_frame, .debug_frame
.text
.globl bar

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.globl asm_main
asm_main:

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.globl bar
bar:

View File

@ -1,3 +1,4 @@
.att_syntax
.text
.globl main
.type main, @function

View File

@ -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)]