[llvm-bugs] [Bug 35653] New: Incorrect relocation for no PLT PIC code without optimization

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 13 13:18:48 PST 2017


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

            Bug ID: 35653
           Summary: Incorrect relocation for no PLT PIC code without
                    optimization
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: compnerd at compnerd.org
                CC: llvm-bugs at lists.llvm.org

$ bin/clang -target x86_64-unknown-linux-gnu -fomit-frame-pointer
-mstack-alignment=8 -fno-plt -fPIC -x c -S - -o - <<< '
void f(void);
void g(void) { return f(); }
'
        .text
        .file   "-"
        .globl  g                       # -- Begin function g
        .p2align        4, 0x90
        .type   g, at function
g:                                      # @g
        .cfi_startproc
# %bb.0:                                # %entry
        callq   f
        retq
.Lfunc_end0:
        .size   g, .Lfunc_end0-g
        .cfi_endproc
                                        # -- End function

        .ident  "clang version 6.0.0 (http://llvm.org/git/clang.git
efe67fdaf10325b04b6a6af538bed43eea8103a1) (http://llvm.org/git/llvm.git
bcf3bed73b8653dcce398f7d64dbb4e78a0746f2)"
        .section        ".note.GNU-stack","", at progbits

$ bin/clang -target x86_64-unknown-linux-gnu -fomit-frame-pointer
-mstack-alignment=8 -O1 -fno-plt -fPIC -x c -S - -o - <<< '
void f(void);
void g(void) { return f(); }
'
        .text
        .file   "-"
        .globl  g                       # -- Begin function g
        .p2align        4, 0x90
        .type   g, at function
g:                                      # @g
        .cfi_startproc
# %bb.0:                                # %entry
        jmpq    *f at GOTPCREL(%rip)       # TAILCALL
.Lfunc_end0:
        .size   g, .Lfunc_end0-g
        .cfi_endproc
                                        # -- End function

        .ident  "clang version 6.0.0 (http://llvm.org/git/clang.git
efe67fdaf10325b04b6a6af538bed43eea8103a1) (http://llvm.org/git/llvm.git
bcf3bed73b8653dcce398f7d64dbb4e78a0746f2)"
        .section        ".note.GNU-stack","", at progbits

Note that we generate `callq f` rather than `callq *f at GOTPCREL(%rip)`.

-- 
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/20171213/53cd88ae/attachment.html>


More information about the llvm-bugs mailing list