tmsriram added a comment. In D92633#2433979 <https://reviews.llvm.org/D92633#2433979>, @MaskRay wrote:
> 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. Thanks for explaining. I know that by default (i.e. no-pic and no-pie), copy relocations will be used for external data accesses. So, you are saying that you are adding a mechanism to disable copy relocations for the no-pic/no-pie case too. Is there a need for this, purely a question. I know that copy relocations are frowned upon so maybe there was a feature request. If so, citing that would make it more clear. Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92633/new/ https://reviews.llvm.org/D92633 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
