1 / 6

Using the Clang Integrated Assembler to Compile the Linux Kernel

Using the Clang Integrated Assembler to Compile the Linux Kernel. Bryce Adelstein-Lelbach , Louisiana State University. What is the Integrated Assembler?. The Integrated Assembler (IA) is an assembler built in to the Clang compiler driver N ot a separate binary like the GNU Assembler (GAS)

gaye
Download Presentation

Using the Clang Integrated Assembler to Compile the Linux Kernel

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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: registeruint64_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, glibcand most dynamic linkers stellar.cct.lsu.edu

More Related