Skip to content

Conversation

@tambry
Copy link
Contributor

@tambry tambry commented Nov 9, 2025

Files using the Intel syntax typically explicitly specify it. Do the same for the few relevant files 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).

Prior art: #164453 #166818

@llvmbot
Copy link
Member

llvmbot commented Nov 9, 2025

@llvm/pr-subscribers-bolt

Author: Raul Tambre (tambry)

Changes

Files using the Intel syntax typically explicitly specify it. Do the same for the few relevant files 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).

Prior art: #164453 #166818


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

4 Files Affected:

  • (modified) bolt/test/runtime/X86/Inputs/basic-instrumentation.s (+1)
  • (modified) bolt/test/runtime/X86/Inputs/internalcall.S (+1)
  • (modified) bolt/test/runtime/X86/Inputs/pie-exceptions-failed-split.s (+1)
  • (modified) bolt/test/runtime/X86/exceptions-lpstart-zero.s (+1)
diff --git a/bolt/test/runtime/X86/Inputs/basic-instrumentation.s b/bolt/test/runtime/X86/Inputs/basic-instrumentation.s
index 388d2cdbd085b..c28fa2210d256 100644
--- a/bolt/test/runtime/X86/Inputs/basic-instrumentation.s
+++ b/bolt/test/runtime/X86/Inputs/basic-instrumentation.s
@@ -1,3 +1,4 @@
+  .att_syntax
   .globl main
   .type main, %function
 main:
diff --git a/bolt/test/runtime/X86/Inputs/internalcall.S b/bolt/test/runtime/X86/Inputs/internalcall.S
index 775a67122d2d7..18f7914ef65ec 100644
--- a/bolt/test/runtime/X86/Inputs/internalcall.S
+++ b/bolt/test/runtime/X86/Inputs/internalcall.S
@@ -1,6 +1,7 @@
 // This is reduced test case for BOLT containing an internal call based on
 // GetCoreDump (from google core dumper).
 
+  .att_syntax
   .text
   .globl getCallback
   .type getCallback, %function
diff --git a/bolt/test/runtime/X86/Inputs/pie-exceptions-failed-split.s b/bolt/test/runtime/X86/Inputs/pie-exceptions-failed-split.s
index 5195d298b1bbe..fd12c26750b2c 100644
--- a/bolt/test/runtime/X86/Inputs/pie-exceptions-failed-split.s
+++ b/bolt/test/runtime/X86/Inputs/pie-exceptions-failed-split.s
@@ -49,6 +49,7 @@
 #			return !throw_test(argc, argv);
 #		}
 
+	.att_syntax
 	.text
 	.file	"exceptions-failed-split.cpp"
 	.globl	_Z3bari                         # -- Begin function _Z3bari
diff --git a/bolt/test/runtime/X86/exceptions-lpstart-zero.s b/bolt/test/runtime/X86/exceptions-lpstart-zero.s
index b487ff0fa2f59..1e377ea26cfd0 100644
--- a/bolt/test/runtime/X86/exceptions-lpstart-zero.s
+++ b/bolt/test/runtime/X86/exceptions-lpstart-zero.s
@@ -21,6 +21,7 @@
 # The exception table was modified with udata4 LPStartEncoding and sdata4
 # CallSiteEncoding.
 
+	.att_syntax
 	.text
 	.globl	main                            # -- Begin function main
 	.p2align	4, 0x90

Copy link
Contributor

@maksfb maksfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adjusting BOLT tests. I'm surprised only a few needed a change since we use AT&T syntax everywhere.

I wonder if it will be easier to set proper flags in lit.local.cfg?

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

`-masm=att` is insufficient as it doesn't override a specification of `-mllvm -x86-asm-syntax`.
@tambry
Copy link
Contributor Author

tambry commented Nov 18, 2025

@maksfb A vast majority of the tests don't use the Clang frontend to compile assembly so they're not affected. Across the whole LLVM codebase only a few tens of changes have been necessary (~30'ish).

I've switched to passing -mllvm -x86-asm-syntax=att explicitly in the lit local config and removed the explicit annotations per your preference.
Worth noting that #167234 would add these to all LLVM MC generated outputs going forward for better interoperability, and not just only for Intel. Explicit annotations would track somewhat better with that and is what the fixes elsewhere went with. To me that also seems cleaner than passing a x86-specific flag on all architectures, ignoring some accidental breakages while the explicit syntax output change hopefully gets merged and propagates.

@github-actions
Copy link

🐧 Linux x64 Test Results

  • 579 tests passed
  • 36 tests skipped

Copy link
Contributor

@maksfb maksfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Setting flags via config will prevent future failures for newly added tests.

@tambry tambry merged commit 58d9e47 into llvm:main Nov 19, 2025
10 checks passed
@tambry tambry deleted the bolt_test_att branch November 19, 2025 07:41
@peterwaller-arm
Copy link
Contributor

@tambry @maksfb @paschalis-mpeis - this appears to break tests unless the x86 backend is enabled as a part of LLVM_TARGETS_TO_BUILD. Can we entertain a revert or is there another way forward?

The argument is defined in an x86 target module:

static cl::opt<AsmWriterFlavorTy> X86AsmSyntax(
"x86-asm-syntax", cl::init(ATT), cl::Hidden,
cl::desc("Select the assembly style for input"),
cl::values(clEnumValN(ATT, "att", "Emit AT&T-style assembly"),
clEnumValN(Intel, "intel", "Emit Intel-style assembly")));

(e.g. tests now fail if -DLLVM_TARGETS_TO_BUILD=AArch64 is supplied to cmake):

******************* TEST 'BOLT :: timers.c' FAILED ********************
...
# .---command stderr------------
# | clang (LLVM option parsing): Unknown command line argument '-x86-asm-syntax=att'.  Try: 'clang (LLVM option parsing) --help'
# | clang (LLVM option parsing): Did you mean '--asan-stack=att'?
# `-----------------------------
# error: command failed with exit status: 1

@maksfb
Copy link
Contributor

maksfb commented Nov 25, 2025

Let me put up a fix.

maksfb added a commit to maksfb/llvm-project that referenced this pull request Nov 25, 2025
Enabling AT&T syntax for all tests is broken when X86 target is not
enabled as reported in llvm#167225.
@pawosm-arm
Copy link
Contributor

pawosm-arm commented Nov 25, 2025

FYI, enabling X86 targeting on AArch64 just leads to another test case failing:

# .---command stderr------------
# | build/bolt/test/X86/register-fragments-bolt-symbols.s:46:15: error: CHECK-SYMS: expected string not found in input
# | # CHECK-SYMS: l F .text [[#]] chain
# |               ^
# | <stdin>:8:62: note: scanning from here
# | 0000000000400080 l F .text.cold 0000000000000026 chain.cold.0
# |                                                              ^
# | <stdin>:9:18: note: possible intended match here
# | 0000000000400000 l F .text 000000000000003c chain
# |                  ^
# |
# | Input file: <stdin>
# | Check file: build/bolt/test/X86/register-fragments-bolt-symbols.s
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# |             1:
# |             2: build/stage/product_build/tools/bolt/test/X86/Output/register-fragments-bolt-symbols.s.tmp.bolt: file format elf64-x86-64
# |             3:
# |             4: SYMBOL TABLE:
# |             5: 0000000000000000 l df *ABS* 0000000000000000 chain.s
# |             6: 0000000000001258 l F .bolt.org.text 0000000000000001 chain
# |             7: 0000000000001258 l d .bolt.org.text 0000000000000000 .bolt.org.text
# |             8: 0000000000400080 l F .text.cold 0000000000000026 chain.cold.0
# | check:46'0                                                                  X error: no match found
# |             9: 0000000000400000 l F .text 000000000000003c chain
# | check:46'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:46'1                      ?                                 possible intended match
# |            10: 0000000000000000 l d .comment 0000000000000000 .comment
# | check:46'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            11: 0000000000000200 l d .interp 0000000000000000 .interp
# | check:46'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            12: 0000000000002310 l .dynamic 0000000000000000 .hidden _DYNAMIC
# | check:46'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            13: 0000000000000000 l df *ABS* 0000000000000000 bolt-pseudo.o
# | check:46'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            14: 00000000004000c0 l F .text.cold 0000000000000022 dummy.cold.0
# | check:46'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

@maksfb
Copy link
Contributor

maksfb commented Nov 25, 2025

FYI, enabling X86 targeting on AArch64 just leads to another test case failing:

Thanks - I'll take a look. Can you try #169541 meanwhile?

maksfb added a commit that referenced this pull request Nov 25, 2025
Enabling AT&T syntax for all tests is broken when X86 target is not
enabled as reported in #167225.
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
This enables building LLVM with `-mllvm -x86-asm-syntax=intel` in one's
Clang config files (i.e. a global preference for Intel syntax).

`-masm=att` is insufficient as it doesn't override a specification of `-mllvm -x86-asm-syntax`.
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Nov 26, 2025
This enables building LLVM with `-mllvm -x86-asm-syntax=intel` in one's
Clang config files (i.e. a global preference for Intel syntax).

`-masm=att` is insufficient as it doesn't override a specification of `-mllvm -x86-asm-syntax`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants