Home Can you make a ".a" static lib with both gcc and clang's IR code?
Reply: 0

Can you make a ".a" static lib with both gcc and clang's IR code?

Arthur2e5
1#
Arthur2e5 Published in 2018-01-13 08:41:20Z

Both gcc and clang implement link-time optimization by allowing object files (.o) to not only contain the machine's target code, but also intermediate representations (GIMPLE or LLVM bitcode) used by the compilers themselves. Those object files can be packed into static archives and made ready for static linking.

The norm with those lto-capable archives is that they are made "fat" by including both the normal machine code (so they can work like normal ones) and the IR. But is it possible to make a "very fat" archive with multiple types of IRs and make the compilers recognize those respective IRs? Here are a few challenges:

  • Both compilers seem to recommend modified versions of ar to make sure the IR gets included and indexed. gcc has gcc-ar (plugin), and clang has llvm-ar.
  • Clang does not produce "fat" archives. In fact its bitcode object files cannot be interpreted by standard GNU tools.
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295063 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO