Skip to content

Conversation

@tambry
Copy link
Contributor

@tambry tambry commented Nov 6, 2025

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

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

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

This enables building LLVM with `-mllvm -x86-asm-syntax=intel` in one's Clang config files
(i.e. a global preference for Intel syntax).
@tambry tambry self-assigned this Nov 6, 2025
@tambry tambry requested review from a team as code owners November 6, 2025 18:15
@llvmbot llvmbot added libc++abi libc++abi C++ Runtime Library. Not libc++. libunwind labels Nov 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 6, 2025

@llvm/pr-subscribers-libcxxabi

@llvm/pr-subscribers-libunwind

Author: Raul Tambre (tambry)

Changes

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

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


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

2 Files Affected:

  • (modified) libcxxabi/test/native/x86_64/lpstart-zero.pass.sh.s (+1)
  • (modified) libunwind/test/remember_state_leak.pass.sh.s (+1)
diff --git a/libcxxabi/test/native/x86_64/lpstart-zero.pass.sh.s b/libcxxabi/test/native/x86_64/lpstart-zero.pass.sh.s
index e18134cf88639..7f1da22971223 100644
--- a/libcxxabi/test/native/x86_64/lpstart-zero.pass.sh.s
+++ b/libcxxabi/test/native/x86_64/lpstart-zero.pass.sh.s
@@ -23,6 +23,7 @@
 ## The exception table is modified to use udata4 encoding for LPStart and
 ## sdata4 encoding for call sites.
 
+	.att_syntax
 	.text
 	.globl	main                            # -- Begin function main
 	.p2align	4, 0x90
diff --git a/libunwind/test/remember_state_leak.pass.sh.s b/libunwind/test/remember_state_leak.pass.sh.s
index 63beb7e4701ec..d3335cf82290b 100644
--- a/libunwind/test/remember_state_leak.pass.sh.s
+++ b/libunwind/test/remember_state_leak.pass.sh.s
@@ -38,6 +38,7 @@
 
     SIZEOF_UNWIND_EXCEPTION = 32
 
+    .att_syntax
     .text
 callback:
     xorl    %eax, %eax

@ldionne ldionne merged commit afc8368 into llvm:main Nov 8, 2025
80 of 82 checks passed
@nico
Copy link
Contributor

nico commented Nov 8, 2025

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

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

FYI: Just -masm=intel should work too, no need for relying on an internal mllvm flag.

@tambry
Copy link
Contributor Author

tambry commented Nov 9, 2025

@nico Unfortunately that also changes the default syntax for asm() blocks in code, which is untenable as too much existing software is written lacking an explicit declaration and assuming AT&T syntax. I haven't tried but I'm fairly certain LLVM itself wouldn't build like that either.

-mllvm -x86-asm-syntax=intel, as you can see, isn't ideal either due to changing the default syntax for standalone assembly files to Intel. Ideally I'd just like to change Clang's output syntax when using clang -S. But alas, this is the closest and the internals seem quite intertwined so fixing the few affected cases in LLVM tests is much easier (and one could argue that being explicit is better anyway).

@nico
Copy link
Contributor

nico commented Nov 10, 2025

Ah, good point. Having separate toggles for input and output would be nice.

The asm flag handling is generally a bit confused. #85668 (comment) has some more notes on it. If I remember correctly, the code for it wasn't all that difficult, it just needs someone to apply some care to it :)

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

Labels

libc++abi libc++abi C++ Runtime Library. Not libc++. libunwind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants