[LLVMdev] File reading in LLVM 2.8
Abhirup Ghosh
abhirupju at gmail.com
Sun Jan 16 23:10:41 PST 2011
Hi,
I am new to LLVM. I am trying to read a plain text file in a llvm
pass. But getting an error -
llvm[0]: Linking Release Loadable Module LLVMHello.so
/usr/bin/ld: /home/abhirup/llvm/llvm2.8_Install/llvm-2.8/lib/Transforms/Hello/Release/Hello.o:
relocation R_X86_64_PC32 against undefined symbol `(anonymous
namespace)::Hello::update_sec_read(char const*)' can not be used when
making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
I have used simple ifstream code -
void update_sec_read (const char* Filename)
{
std::ifstream In(Filename);
if (!In.good()) {
errs() << "couldn't load file '" << Filename << "'!\n";
return;
}
while (In) {
}
}
Can anyone please help me out?
- Abhirup Ghosh
M. Tech
Department of Computer Science & Engg.
IIT, Bombay,
Mumbai, India
email - abhirupju at gmail.com , abhirup at cse.iitb.ac.in
More information about the llvm-dev
mailing list