[llvm-bugs] [Bug 51535] why gotpcrel is generated after llvm 12?

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 19 11:00:20 PDT 2021


Fangrui Song <i at maskray.me> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |i at maskray.me
         Resolution|---                         |INVALID

--- Comment #3 from Fangrui Song <i at maskray.me> ---
In principle the compiler can use GOT in -fno-pic mode. It is even desired to
do so for undefined symbols. For defined symbols, omitting GOT whenever
possible is fine.

@arr = common dso_local global [8 x i8] zeroinitializer
  movabsq $arr, %rdi

@arr = common dso_preemptable global [8 x i8] zeroinitializer
  movq    arr at GOTPCREL(%rip), %rdi

Clang correctly sets dso_local/dso_preemptable. If your frontend wants to use
absolute relocations, please set dso_local explicitly.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210819/9d325eea/attachment.html>

More information about the llvm-bugs mailing list