我正在尝试运行这个LLVM instrumentation项目,但是我只能在Linux下加载instrumentation优化。
我已经在OSX上编译并安装了LLVM 3.2和Clang 3.2,并且在Linux上有相同的版本。
当我尝试在Linux中运行时:
command opt -load ./obj/llvminstrument/libllvminstrument.so -help |grep instrum
-insert-edge-profiling - Insert instrumentation for edge profiling
-insert-gcov-profiling - Insert instrumentation for GCOV profiling
-insert-optimal-edge-profiling - Insert optimal instrumentation for edge profiling
-insert-path-profiling - Insert instrumentation for Ball-Larus path profiling
-instrument_block - Injects block instrumentation instructions
-instrument_function - Injects function instrumentation instructions
-instrument_prepare - Prepares instrumentation instructions
相同的命令,在OSX中:
command opt -load ./obj/llvminstrument/libllvminstrument.dylib -help |grep instrum │········
opt: CommandLine Error: Argument 'track-memory' defined more than once! │········
opt: CommandLine Error: Argument 'debug-buffer-size' defined more than once! │········
opt: CommandLine Error: Argument 'print-all-options' defined more than once! │········
opt: CommandLine Error: Argument 'print-options' defined more than once! │········
opt: CommandLine Error: Argument 'print-after-all' defined more than once! │········
opt: CommandLine Error: Argument 'print-before-all' defined more than once! │········
opt: CommandLine Error: Argument 'track-memory' defined more than once! │········
opt: CommandLine Error: Argument 'debug-buffer-size' defined more than once! │········
opt: CommandLine Error: Argument 'print-all-options' defined more than once! │········
opt: CommandLine Error: Argument 'print-options' defined more than once! │········
opt: CommandLine Error: Argument 'print-after-all' defined more than once! │········
opt: CommandLine Error: Argument 'print-before-all' defined more than once! │········
-insert-edge-profiling - Insert instrumentation for edge profiling │········
-insert-gcov-profiling - Insert instrumentation for GCOV profiling │········
-insert-optimal-edge-profiling - Insert optimal instrumentation for edge profiling │········
-insert-path-profiling - Insert instrumentation for Ball-Larus path profiling
我不知道如何解决这个问题,但问题是你将几个核心LLVM库静态地链接到仪表dylib中,这种方式与opt驱动程序"打开"的方式不兼容。因此,当您打开它时,您将获得各种命令行参数的重复全局变量。这可能与LLVM关系不大,更多的是与OS X上使用的特定构建过程有关,它们对符号可见性和/或共享链接与静态链接的默认值不同。