2013-03-18 73 views
5

我试图运行这个LLVM instrumentation project,但我只能在Linux下加载检测优化。LLVM:在OSX上优化加载失败

我在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 

回答

1

我不知道如何解决这个问题,但问题是,你”将几个核心LLVM库静态链接到instrumentation dylib中,这种方式与opt驱动程序“不兼容”。因此,当你打开它时,你会得到各种命令行参数的重复全局变量。这可能与LLVM很少有关,而与OS X上使用的特定构建过程有关的更多默认值有不同的符号可见性和/或共享与静态链接的默认值。