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

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 19 04:23:01 PDT 2021


            Bug ID: 51535
           Summary: why gotpcrel is generated after llvm 12?
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: kamleshbhalui at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

Consider below testcase 

$cat test.ll

@arr = common global [8 x i8] zeroinitializer

define void @foo() {
  call void @bar(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @arr, i64 0,
i64 0))
  ret void

declare void @bar(i8*)

$./clang test.ll -c -Xassembler -mrelax-relocations=no -mno-relax-all -S
warning: overriding the module target triple with x86_64-unknown-linux-gnu
1 warning generated.
$ cat test.s
        .file   "test.ll"
        .globl  foo                             # -- Begin function foo
        .p2align        4, 0x90
        .type   foo, at function
foo:                                    # @foo
# %bb.0:                                # %entry
        pushq   %rax
        .cfi_def_cfa_offset 16
        movq    arr at GOTPCREL(%rip), %rdi
        callq   bar at PLT
        popq    %rax
        .cfi_def_cfa_offset 8
        .size   foo, .Lfunc_end0-foo
                                        # -- End function
        .type   arr, at object                     # @arr
        .comm   arr,8,1
        .section        ".note.GNU-stack","", at progbits
        .addrsig_sym bar
        .addrsig_sym arr

As can be seen above GOTPCREL is generated for non pic code.

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/cf2d4940/attachment.html>

More information about the llvm-bugs mailing list