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: unassignedb...@nondot.org
          Reporter: kamleshbha...@gmail.com
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, pengfei.w...@intel.com,
                    spatel+l...@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,@function
foo:                                    # @foo
        .cfi_startproc
# %bb.0:                                # %entry
        pushq   %rax
        .cfi_def_cfa_offset 16
        movq    arr@GOTPCREL(%rip), %rdi
        callq   bar@PLT
        popq    %rax
        .cfi_def_cfa_offset 8
        retq
.Lfunc_end0:
        .size   foo, .Lfunc_end0-foo
        .cfi_endproc
                                        # -- End function
        .type   arr,@object                     # @arr
        .comm   arr,8,1
        .section        ".note.GNU-stack","",@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to