[llvm-dev] Executing code changed with LLVM

Holland Vosijk via llvm-dev llvm-dev at lists.llvm.org
Sat May 18 11:01:47 PDT 2019


Thanks a lot for the response. Upon using g++ or gcc with -lstdc++ flag I
get the original error I was getting without the "--relocation-model=pic"
flag for llc.i.e

/usr/bin/ld: output.o: relocation R_X86_64_32 against `.rodata.str1.1' can
not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status

Is there another way I can try to save the modified program to a file and
then execute it? Without using "llc" maybe?

On Sat, May 18, 2019 at 8:05 PM Tim Northover <t.p.northover at gmail.com>
wrote:

> On Sat, 18 May 2019 at 13:28, Holland Vosijk via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > 5. Tried it by giving "--relocation-model=pic" flag to llc command. But
> if i run gcc command after that I get so many "undefined reference to"
> errors like:
>
> The std::* errors are because you need to link against libstdc++. If
> you invoked GCC as "g++" I think it would automatically do that, or
> you could manually add -lstdc++.
>
> I'm not sure about the rpc::* errors though. The only librpc.so I can
> find on Debian (in the sinfo package) does not contain those symbols,
> so maybe you have an alternative version that you need to build to go
> with your source and make sure it's the one found by ld.
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190518/a0cde4e7/attachment.html>


More information about the llvm-dev mailing list