adopting llvm binary utilities in toolchains
play

Adopting LLVM Binary Utilities in Toolchains Jordan Rupprecht - PowerPoint PPT Presentation

Euro LLVM 2019 Proprietary + Confidential Adopting LLVM Binary Utilities in Toolchains Jordan Rupprecht rupprecht@google.com Euro LLVM 2019 Why? 1. Toolchains are expensive! a. Already build one for Clang + LLD b. Code, build, test,


  1. Euro LLVM 2019 Proprietary + Confidential Adopting LLVM Binary Utilities in Toolchains Jordan Rupprecht rupprecht@google.com

  2. Euro LLVM 2019 Why? 1. Toolchains are expensive! a. Already build one for Clang + LLD b. Code, build, test, deploy, and debug miscompiles just once! 2. LLVM everywhere a. Native supporu for LLVM bitcode embedded anywhere

  3. Euro LLVM 2019 Testing 1. Plug it in and see what breaks! # This fails, as expected, and # complains loudly. a. Great for catching obvious $ llvm-readelf --xyz foo failures b. Not great for subtle issues # This "succeeds" but used to have # bug and create a bad object file. # It manifests as strange runtime # failures. $ llvm-objcopy --localize-hidden foo

  4. Euro LLVM 2019 Testing 1. Plug it in and see what breaks! $ objcopy -B foo ... objcopy: architecture foo 2. Use another binutils test suite unknown a. Free test coverage! b. But noisy results. $ llvm-objcopy -B foo ... llvm-objcopy: error: Invalid architecture: 'foo'

  5. Euro LLVM 2019 Testing 1. Plug it in and see what breaks! 2. Use another binutils test suite 3. Manual testing a. :(

  6. Euro LLVM 2019 Everything is broken! 1. Flags and formatuing Different alias meanings $ readelf -s => --symbols $ llvm-readelf -s => --sections $ size foo | cut -f 2 text \t data \t bss \t ... 23616 \t 1472 \t 1336 \t ... $ llvm-size foo | cut -f 2 text data bss ... 23616 1472 1336 ...

  7. Euro LLVM 2019 Everything is broken! 1. Flags and formatuing – llvm-ar: doesn't create thin archives correctly (in kernel builds) 2. Broken features – llvm-size: miscalculated sizes (!) – llvm-symbolizer (addr2line): requires stdin input – llvm-objcopy/llvm-strip: lots of catching up to do – ...

  8. Euro LLVM 2019 Everything is broken! 1. Flags and formatuing # GNU ar uses -M and silently ignores rcs $ ar rcs -M < mri_script.txt 2. Broken features $ llvm-ar rcs -M < mri_script.txt 3. Incompatibilities we want llvm-ar: error: Cannot mix -M and other options # GNU accepts any non-ambiguous prefix $ readelf --seg foo $ llvm-readelf --segments foo # -s removes more in llvm-strip; we need # an additional llvm flag, --keep-section $ strip -s foo $ llvm-strip -s --keep-section=.bar foo

  9. Euro LLVM 2019 Conclusion Everything is now … less broken? Switched! ar, c++fjlt (llvm-cxxfjlt), nm, Try it out! Contribute patches or fjle size, strings bugs! Very soon! addr2line (llvm-symbolizer), objdump, readelf Great progress, but not yet objcopy, strip

  10. Euro LLVM 2019 Proprietary + Confidential Thanks! Jordan Rupprecht rupprecht@google.com Questions? Suggestions? Come to the BoF at 4:15pm today, or the round table at 2pm tomorrow.

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