Document for Apple Clang Assembler

Please tell me where I can find the documents for Apple Clang ARM assembler?

After I compiled my C source code to ARM assembly code using Apple Clang, it of course generated a lot of ARM assembly code (GNU syntax), but for some of them I can't find related documents, for example the .build_version directive.

The generated ARM assembly code is here:

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	str	w8, [sp, #16]                   ; 4-byte Folded Spill
	stur	wzr, [x29, #-4]
                                        ; implicit-def: $x8

...

	add	sp, sp, #64
	ret
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"a + b = %d\r\n"

.subsections_via_symbols

Replies

AFAIK Apple doesn’t have documentation that covers things at this level. Your best bet is to look in the LLVM documentation itself. Sadly, I couldn’t find any specific documentation for the Clang integrated assembler )-:

With regarding .build_version specifically, it seems to be a Darwin-specific mechanism to set the LC_BUILD_VERSION load command. A quick ’net search unearthed this:

https://reviews.llvm.org/D121868

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Thanks for replying, maybe I should try this on Linux not macOS :)

Add a Comment