[llvm-dev] llc tool followed by g++ : Abnormal behavior while compiling assembly to object file

Mahesh Attarde via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 23 02:51:01 PDT 2018


Hi
 I am executing following steps to convert assembly to object code.

llc -march=x86-64 -filetype=asm  input.ll -o input.s
g++ -g -c -o input.s --input.o

inshort
ll --> llc --> .s -->g++ -->obj

original source was something like this

{
    printf(" **** %s ****",str);
}

input.s turn out to be

movq .str at GOTPCREL(%rip),%rdi
movq .str.1 at GOTPCREL(%rip),%rsi
xorl  %eax,%eax
movq %rdi,%r14
callq printf at PLT


While at Runtime

mov  0x0(%rip),%rdi
mov  0x0(%rip),%rsi
xor  %eax,%eax
mov %rdi,%r14
callq printf at PLT

Not really sure what happened here?
I was expecting at runtime offset for str and str.1 to be different.
I could really use some help to determine if this is bug?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180423/1105d1c6/attachment.html>


More information about the llvm-dev mailing list