[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


https://bugs.llvm.org/show_bug.cgi?id=51535

            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() {
entry:
  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
[-Woverride-module]
1 warning generated.
$ cat test.s
        .text
        .file   "test.ll"
        .globl  foo                             # -- Begin function foo
        .p2align        4, 0x90
        .type   foo, at function
foo:                                    # @foo
        .cfi_startproc
# %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
        retq
.Lfunc_end0:
        .size   foo, .Lfunc_end0-foo
        .cfi_endproc
                                        # -- End function
        .type   arr, at object                     # @arr
        .comm   arr,8,1
        .section        ".note.GNU-stack","", at progbits
        .addrsig
        .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