llvm

ld: warning: section __DATA/__objc_imageinfo__DATA has unexpectedly large size

天涯浪子 提交于 2019-12-14 04:18:42
问题 Does anyone know what this warning means? It is followed by the error: Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1 This is an Xcode project for the iPad. I only see this when I compile for the simulator, not the device. I have linked a static library (*.a) to this project and that is where I think this is failing. Also, it used to run on the simulator without an issue and I am not sure what changed. All of the compiler output:

Function boundary identification using libclang

有些话、适合烂在心里 提交于 2019-12-14 03:52:48
问题 I am learning to parse C++ files using Python + libclang with the help of this very informative (but slightly outdated) tutorial by Eli Bendersky. My objective is to parse C++ files and identify the function boundaries for functions present in those file. I am expecting to build a python dictionary of this form: {<func_name>:(<func_start_loc>, <func_end_loc>), ...} To this end, I am able to get the function name (using cursor.spelling for AST nodes that are of CursorKind.FUNCTION_DECL or

clang segfaults when compiling LLVM IR

安稳与你 提交于 2019-12-14 03:08:45
问题 I am trying to compile a LLVM IR file. However, when I try to compile it, I get this stack trace: warning: overriding the module target triple with x86_64-pc-linux-gnu [-Woverride-module] #0 0x00007f415c9179fa llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1+0x8549fa) #1 0x00007f415c915c76 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1+0x852c76) #2 0x00007f415c915dab (/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1

LLVM cmake install cannot find DIA SDK

ε祈祈猫儿з 提交于 2019-12-14 02:13:35
问题 I'm trying to build the LLVM install with cmake but it is giving me an error about the LLVM_ENABLE_DIA_SDK. I managed to build LLVM before without PDB's but I am trying to get started with libclang so I need the PDB. Cmake gives me the following error: CMake Error at cmake/config-ix.cmake:482 (message): DIA SDK not found. If you have both VS 2012 and 2013 installed, you may need to uninstall the former and re-install the latter afterwards. Call Stack (most recent call first): CMakeLists.txt

Is it possible to run clang with llc flags

 ̄綄美尐妖づ 提交于 2019-12-14 02:01:09
问题 Is there a way to run the clang and add llc flags ? I want to use "-print-after-all", "-print-before-all", "-debug-only" ... without having to use the .bc file in between. 回答1: Additional arguments can be passed to LLVM's option parser with -mllvm . For your scenario this would look something like this: clang [...] -mllvm -print-after-all 来源: https://stackoverflow.com/questions/37700766/is-it-possible-to-run-clang-with-llc-flags

How can I see printf output when evaluating an expression using the `expr` command in lldb?

依然范特西╮ 提交于 2019-12-14 01:26:08
问题 Let us say that I have a function in a C program test.c like this: #include <stdio.h> char* foo = "test"; void print_foo(void) { printf("%s", foo); } main() { } I compile and run test.c like this: gcc -g -o test test.c chmod 755 test && lldb -s <(echo "b main\nr") test However, if I then run expr print_foo() no string output occurs: (lldb) expr print_foo() (lldb) 回答1: STDOUT is line buffered. You haven't emitted a newline yet. Try calling (lldb) expr (void) fflush(0) and you should see the

How to run LLVM interpreter with a shared library?

爱⌒轻易说出口 提交于 2019-12-13 14:34:23
问题 I have mylib.c file which has some functions. I want to use those functions from my .c file as external ones in compiled llvm code. I'm playing with LLVM interpreter ( lli-4.0 ) and I wonder how can I tell lli to use functions from my .c file? 回答1: lli has a -load argument so you compile your C file to a dynamic library and then just do lli -load path-to-your-dynamic-library .... 来源: https://stackoverflow.com/questions/44189232/how-to-run-llvm-interpreter-with-a-shared-library

llvm::DIInstruction getFilename returns filename with a directory, I just want the filename

混江龙づ霸主 提交于 2019-12-13 14:34:21
问题 I'm trying to get debugging metadata from an llvm Instruction using the DILocation class. However, when I query the DILocation for the filename where the instruction came from, I get a filename with a directory tagged onto the front. I though it would return just the file and the entire directory path should be retrieved via a call to getDirectory(). For example, instead of XMain_0.c I end up with pbg/XMain_0.c I compiled my bitcode like this: XMain_0.o: pbg/XMain_0.c $(CC) <snip> -c pbg

Xcode 4.2 Code Coverage

主宰稳场 提交于 2019-12-13 12:05:03
问题 I started to use Xcode 4.2 and i have problems with generating code coverage. Xcode 4.2 does not include the GCC 4.2 compiler, but it was replaced with the LLVM GCC 4.2 compiler. The first one was needed to generate code coverage in the previous version of Xcode. I followed the 'tutorial' on CoverStory website, but this results in the following: a) when i do all steps, no coverage files. b) when i link the libprofile_rt.dylib to my project, the test which should fail, do not fail anymore. Did

How to use the LLVM library to write an assembler

耗尽温柔 提交于 2019-12-13 09:13:35
问题 I want to write a simple assembler for x86/arm. Since implementing all instructions would be cumbersome, I figuered I could use the LLVM project without using LLVM IR . llvm-mc seems to have exactly that feature: $ echo "addl %eax, %ebx" | llvm-mc -show-encoding -show-inst However I can't find any resources that explain how to use the MC in C++ code. I woulde have expected something similar to: MCBuilder builder = X86::MCBuilder::create(rwx_memory_loc); builder.AddInst("add", EAX, ECX);