google / ml-compiler-opt

Infrastructure for Machine Learning Guided Optimization (MLGO) in LLVM.
Apache License 2.0
630 stars 93 forks source link

Fix extract_ir.py for macos. #260

Closed jacob-hegna closed 1 year ago

jacob-hegna commented 1 year ago

For whatever reason, the section names for .llvmcmd and .llvmbc are different on macos. One problem is that macos uses macho object files instead of elf, so in addition to the section names there are segment names that need to be specified. The other problem is that regardless of the segments, the section names are different. This patch makes the segment name configurable by a flag, and gives sensible defaults for linux + documentation for macos.