Skip to content

Commit b7337a8

Browse files
committed
[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).
1 parent bf2653e commit b7337a8

23 files changed

+36
-5
lines changed

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,13 @@ ifeq "$(MAKE_GMODULES)" "YES"
315315
CXXFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
316316
endif
317317

318+
# Our files use x86 AT&T assembly throughout.
319+
# Enable it explicitly so any local Clang preference for Intel syntax gets overriden.
320+
ifeq ($(CC_TYPE), clang)
321+
CFLAGS += -mllvm -x86-asm-syntax=att
322+
CXXFLAGS += -mllvm -x86-asm-syntax=att
323+
endif
324+
318325
CFLAGS += $(CFLAGS_EXTRAS)
319326
CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS)
320327
# Copy common options to the linker flags (dwarf, arch. & etc).

lldb/test/API/functionalities/disassembler-variables/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dummy_main.c:
1919

2020
# Assemble .s → .o using the configured compiler.
2121
%.o: %.s
22-
$(CC) -c -x assembler $< -o $@
22+
$(CC) $(CFLAGS) -c -x assembler $< -o $@
2323

2424
# Default target: build all .o fixtures and the dummy exe.
2525
.PHONY: all

lldb/test/API/functionalities/disassembler-variables/d_original_example.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/* Original C (for context):
22
* #include <stdio.h>
3-
*
3+
*
44
* int main(int argc, char **argv) {
55
* for (int i = 1; i < argc; ++i)
66
* puts(argv[i]);
77
* return 0;
88
* }
99
*/
1010
.file "d_original_example.c"
11+
.att_syntax
1112
.text
1213
.globl main # -- Begin function main
1314
.p2align 4

lldb/test/API/functionalities/disassembler-variables/live_across_call.s

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Original C (for context):
22
* // Declare a real external call so the compiler must respect ABI clobbers.
33
* extern int leaf(int) __attribute__((noinline));
4-
*
4+
*
55
* __attribute__((noinline))
66
* int live_across_call(int x) {
77
* volatile int a = x; // a starts in a GPR (from arg)
@@ -12,6 +12,7 @@
1212
* }
1313
*/
1414
.file "live_across_call.c"
15+
.att_syntax
1516
.text
1617
.globl live_across_call # -- Begin function live_across_call
1718
.p2align 4

lldb/test/API/functionalities/disassembler-variables/loop_reg_rotate.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* int loop_reg_rotate(int n, int seed) {
44
* volatile int acc = seed; // keep as a named local
55
* int i = 0, j = 1, k = 2; // extra pressure but not enough to spill
6-
*
6+
*
77
* for (int t = 0; t < n; ++t) {
88
* // Mix uses so the allocator may reshuffle regs for 'acc'
99
* acc = acc + i;
@@ -13,12 +13,13 @@
1313
* acc = acc + k;
1414
* i ^= acc; j += acc; k ^= j;
1515
* }
16-
*
16+
*
1717
* asm volatile("" :: "r"(acc));
1818
* return acc + i + j + k;
1919
* }
2020
*/
2121
.file "loop_reg_rotate.c"
22+
.att_syntax
2223
.text
2324
.globl loop_reg_rotate # -- Begin function loop_reg_rotate
2425
.p2align 4

lldb/test/API/functionalities/disassembler-variables/regs_fp_params.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* return a + b + c + d + e + f;
66
* }*/
77
.file "regs_fp_params.c"
8+
.att_syntax
89
.text
910
.globl regs_fp_params # -- Begin function regs_fp_params
1011
.p2align 4

lldb/test/API/functionalities/disassembler-variables/regs_int_params.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* }
99
*/
1010
.file "regs_int_params.c"
11+
.att_syntax
1112
.text
1213
.globl regs_int_params # -- Begin function regs_int_params
1314
.p2align 4

lldb/test/API/functionalities/disassembler-variables/regs_mixed_params.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
.file "regs_mixed_params.c"
1313
.file 0 "." "regs_mixed_params.c" md5 0x73c4bda40238ae460aaecb3a6a2603cf
14+
.att_syntax
1415
.text
1516
.globl regs_mixed_params # -- Begin function regs_mixed_params
1617
.p2align 4

lldb/test/API/functionalities/disassembler-variables/seed_reg_const_undef.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
.file "seed_reg_const_undef.c"
13+
.att_syntax
1314
.text
1415
.globl main # -- Begin function main
1516
.p2align 4

lldb/test/Shell/SymbolFile/DWARF/x86/DW_TAG_GNU_call_site-DW_AT_low_pc.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# return 0;
2828
# }
2929

30+
.att_syntax
3031
.text
3132
.Ltext0:
3233
.type b, @function

0 commit comments

Comments
 (0)