porting llvm to a new os
play

Porting LLVM to a new OS Kai Nacke 31 January 2016 LLVM devroom @ - PowerPoint PPT Presentation

Porting LLVM to a new OS Kai Nacke 31 January 2016 LLVM devroom @ FOSDEM16 Porting LLVM There are two possible goals Run LLVM tools on OS Generate code for OS / CPU architecture Mission is to run LLVM on previously unsupported


  1. Porting LLVM to a new OS Kai Nacke 31 January 2016 LLVM devroom @ FOSDEM‘16

  2. Porting LLVM • There are two possible goals – Run LLVM tools on OS – Generate code for OS / CPU architecture • Mission is to run LLVM on previously unsupported OS and adding code generation for the OS • Adding a new CPU architecture is a major task – Not considered here 31 January 2016 Kai Nacke | Porting LLVM to a new OS 2

  3. A very brief look on AIX • OS for mission critial tasks • A UNIX OS, supports System V and BSD APIs • Runs on POWER architecture – Already a target for LLVM • Good software support – Native toolchain – Major Open Source Software available 31 January 2016 Kai Nacke | Porting LLVM to a new OS 3

  4. Toolchain • Prerequisites for LLVM are available – gcc, cmake, gmake , … – Use this toolchain • GNU tools use as and ld from OS – Expect different command line options • Not every package works out of the box – Python 2.7.x is missing => compile yourself – cmake 3.x had problems => use cmake 2.8.x 31 January 2016 Kai Nacke | Porting LLVM to a new OS 4

  5. Compile LLVM • First compiler run identifies code problems – Missing endian definitions – Wrong path handling code choosen • Linking fails because of unsupported options – Updates to the cmake modules necessary • Still problems with ThreadPool code – Needs more investigation 31 January 2016 Kai Nacke | Porting LLVM to a new OS 5

  6. Running LLVM on AIX • All LLVM tools are compiled and run • Results of test suite are similar to Linux/PPC • Still no code generation for AIX 31 January 2016 Kai Nacke | Porting LLVM to a new OS 6

  7. Code Generation • LLVM misses code generation for AIX • You can‘t use the Linux/PPC ELF-based tools – Binary format is XCOFF – Textual assembler is different • Idea is to tweak assembler generation and use external assembler to create object file 31 January 2016 Kai Nacke | Porting LLVM to a new OS 7

  8. XCOFF • XCOFF is an extended COFF format • Basically it adds the TOC concept to COFF • Major differences to COFF – No PE header – Smallest adressable unit is csect – A csect always has a storage class associated • Assembler text uses .csect 31 January 2016 Kai Nacke | Porting LLVM to a new OS 8

  9. Partial Class Hierarchy … changed <<uses>> AsmPrinter MCAsmInfo UsesAIXSectionDirective <<uses>> <<uses>> usesAIXSectionDirective() MCSection PPCAsmPrinter MCAsmInfoCOFF changed new MCSectionCOFF new PPCAIXAsmPrinter MCAsmInfoXCOFF <<instantiates>> changed new MCObjectFileInfo PPCAsmInfoXCOFF <<uses>> changed Triple 31 January 2016 Kai Nacke | Porting LLVM to a new OS 9

  10. Implementation • Outputs .section as .csect – Required lot of changes • Makes storage class part of section name – Only a hack • Use raw text output for missing op‘s • Relocation syntax requires more work 31 January 2016 Kai Nacke | Porting LLVM to a new OS 10

  11. Summary / Outlook • First patches submitted • Work on relocation syntax required – Needed for „ Hello World“ application • Working approach • Next step is dumping of XCOFF files 31 January 2016 Kai Nacke | Porting LLVM to a new OS 11

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend