Situation
Enviroment
Arch Linux x86-64 (4.2.3-1-ARCH)
GCC
gcc (GCC) 5.2.0
Command
gcc -Wall -g -o asm_printf asm_printf.s
Error
/usr/bin/ld: /tmp/cct4fa.o: Relocation R_X86_64_32S against '.data' can not be used when making a shared object; recompile with -fPIC /tmp/cct4fa.o:err adding symbols: Bad value collect2: error: ld returned 1 exit status
Code
.section .data msg: .asciz "Printf In Assembly!!\n" .section .text .globl main main: pushq $msg call printf addq $8 %esp pushq $0 call exit
Question
I tried to use gcc
to compile the program in the above Code section using the command in the above Command section and ended up with a error in the Error Section.
Note that I am not compiling a shared library.
- What is this error?
- How do i fix this?