[LLVMdev] llvmc for PIC16

Sanjiv Gupta sanjiv.gupta at microchip.com
Wed Jul 1 10:02:28 PDT 2009

I found out the problem. Looks like I can not rely on argv[0] to contain 
the full path of the executable always.
Can I rely on:
 static Path GetMainExecutable(const char *argv0, void *MainAddr);

is it Cross-platform?
What to pass for second parameter here. C++ forbids taking address of 
"main", and the "Main" of CompilerDriver is in a shared object here.

- Sanjiv

Sanjiv Gupta wrote:
> The driver behaves differently when I run it by specifying absolute path 
> than when I run it with relative path.
> See example
> Relative:
> i00202 at ubuntu:/tmp$ mcc16 --save-temps -dry-run  hello.c./clang-cc -I 
> ./include -triple=pic16- -emit-llvm-bc hello.c -o hello.bc-pqDR1Y
> llvm-ld -link-as-library hello.bc-pqDR1Y -o tmp.bc-M1Rwip
> llc -march=pic16 -f tmp.bc-M1Rwip -o tmp.s-DcVczP
> gpasm -I ./inc tmp.s-DcVczP -o tmp.o
> mplink /k ./lkr /l ./lkr tmp.o -o a.out
> Absolute:
> i00202 at ubuntu:/tmp$ /home/i00202/projects/llvm/Debug/bin/mcc16 
> --save-temps -dry-run  hello.c
> /home/i00202/projects/llvm/Debug/bin/clang-cc -I 
> /home/i00202/projects/llvm/Debug/include -triple=pic16- -emit-llvm-bc 
> hello.c -o hello.bc-iqtUNP
> llvm-ld -link-as-library hello.bc-iqtUNP -o tmp.bc-6pjc0L
> llc -march=pic16 -f tmp.bc-6pjc0L -o tmp.s-RYXucI
> gpasm -I /home/i00202/projects/llvm/Debug/inc tmp.s-RYXucI -o tmp.o
> mplink /k /home/i00202/projects/llvm/Debug/lkr /l 
> /home/i00202/projects/llvm/Debug/lkr tmp.o -o a.out
> With absolute path it is able to find my headers, libs correctly but not 
> with relative.
> While debugging with ddd, the ddd always printed full paths for headers etc.
> - Sanjiv
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list