MaskRay added a comment.

In D92633#2433108 <https://reviews.llvm.org/D92633#2433108>, @tmsriram wrote:

> You said : "The name -mpie-copy-relocations is misleading [1] and does not 
> capture the idea that this option can actually apply to all of 
> -fno-pic,-fpie, ..."
>
> Could you please clarify why this option needs to apply to -fno-pic?  Here is 
> what I tried with trunk clang:

If the user wants to guarantee no copy relocations in -fno-pic code, they can 
theoretically apply -fno-direct-access-external-data to use a GOT indirection.
This is not implemented, though.

> extern int var;
> int get() { return var; }
>
> $ clang -S foo.c -o -
> ....
>       movl    var, %eax
>       popq    %rbp
> ...
>
> With -fno-pic,  this will never need to use -mpie-copy-relocations at all, so 
> this case is not relevant right?  Did I miss anything?

-fno-pic code can only be used with -no-pie links (position-dependent 
executables) If var is not defined in the linked executable, it will have a 
copy relocation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92633/new/

https://reviews.llvm.org/D92633

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

Reply via email to