Close the extension for lib functions?

Why some library functions (such as strcpy,strncpy,etc.) are extended in .bc file?
How to keep the originally forms of these library functions in .bc file?


- Xia

What do you mean by 'extended', and the 'originally forms'?


These come from the library: llvm/runtime/GCCLibraries/libc/

If you don't want them, just go into that directory, delete the functions
you don't want, run make clean and make install (in that directory), and
they should be gone.


My interpretation (correct me I'm wrong Xia) is that he wants the calls to
strcpy, but we are inlining implementations of some of these library
functions at link-time.

If this is the case Xia, you can do what I said and take them out of the
LLVM libc.bc file, which will prevent inlining from happening.



    New to LLVM and I want to try some sample programs and build on them.
Any pointers to where I can find small projects ?


It depends on what you are looking for. If you're looking for examples of
C++ code that manipulates LLVM code, there are lots of things in the
source tree depending on what you want to do (browse around in tine
llvm/lib tree). If you have specific questions, this list is a great
place to ask.

If you're looking for sample programs to compile with LLVM and see what
they look like, check out the llvm/test/Programs hierarchy. It is filled
with tons of programs of various sizes that do all sorts of things. If
you are looking for small programs, check out test/Programs/SingleSource/,
and specifically Benchmarks/Shootout has a bunch of small programs. If
you're looking for larger programs, the MultiSource directory contains
various applications and benchmark suites that may be of interest.

In any of the test/Programs directories, if you type 'make' in a
directory, it will recurse to any subdirectories. In any application
directory it will build the application with LLVM (native, JIT, and C
backend) and the native compiler, execute the results and diff the

If you want to just build the LLVM bytecode without executing the
programs, you can use the 'make bytecode' target to avoid executing the
programs. In any case, the end LLVM result for a program will be named
"Output/programname.llvm.bc" in a directory. You can use llvm-dis to
inspect the LLVM instructions for it that way.

Another thing to point out is that you can download random applications
and compile them with LLVM too. Usually 'configure CC=llvmgcc
CXX=llvmg++; make' is all you need.