Download presentation
Presentation is loading. Please wait.
Published byHomer Blankenship Modified over 9 years ago
1
Using the Clang Integrated Assembler to Compile the Linux Kernel Bryce Adelstein-Lelbach, Louisiana State University
2
What is the Integrated Assembler? The Integrated Assembler (IA) is an assembler built in to the Clang compiler driver – Not a separate binary like the GNU Assembler (GAS) Supports all platforms that Clang supports Largely compatible with GAS Benefits – Clang-style diagnostics for assembly – Faster compile times – No temporary assembly files stellar.cct.lsu.edu
3
IA Issues IA rejects ambiguous inline x86 assembly that GAS accepts IA has no support for 16-bit mode on x86 IA has no support for switching assembly modes on x86 (e.g..code16,.code32,.code64 ) IA does not support GCC-style explicit register variables (ERVs) IA uses ARM Unified Assembly Language (UAL), and does not support GAS's ARM assembly extensions stellar.cct.lsu.edu
4
Ambiguous x86 Inline Assembly GAS is more lenient about accepting inline x86 assembly that is ambiguous. For example: __asm__("add %al, (%rax)"); __asm__("addw $4, (%rax)"); __asm__("add $4, (%rax)"); Discussion: how should we fix this? – Can someone give me an example of when the more explicit form would be bad? stellar.cct.lsu.edu
5
16-bit Mode/Mode Switching LLVM has no x86-16 backend – Essential for compiling kernel boot code, bootloaders, etc GAS.code16,.code32,.code64 directives – These directives tell GAS what type of assembly to output Longer term project – Discussion: Could this be accomplished in a GSoC? stellar.cct.lsu.edu
6
Explicit Register Variables Places a variable into a specific hardware register. Example: register uint64_t sp __asm__("%rsp"); Compiler must exclude these registers from register allocation while the variable is in scope Used to access the stack pointer in the kernel – A possible solution for this use case would be to add __builtin_stack_pointer() to Clang and GCC. Also used in Xen, glibc and most dynamic linkers stellar.cct.lsu.edu
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.