Issue 81458
Summary For -fno-PIC faced error "relocation R_X86_64_32 cannot be used against local symbol".
Labels new issue
Assignees
Reporter amdrajesh
    The following error is seen with "hello world" program when "-fno-PIC" option is specified:
ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
```
>>> defined in /tmp/hello-581b6c.o
>>> referenced by hello.c
>>>               /tmp/hello-581b6c.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Please find details as follows:

Change ID: ffab5a089b1e94b3305fbdfdf1547b751121c090


```
$ cat -n hello.c
     1  #include<stdio.h>
     2  int main()
     3  {
 4          printf("Hello World\n");
     5
     6          return 0;
     7  }
     8

$ clang hello.c -fno-PIC
ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
>>> defined in /tmp/hello-581b6c.o
>>> referenced by hello.c
>>>               /tmp/hello-581b6c.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to