[llvm-bugs] [Bug 35463] New: X86: Stack probe symbol has wrong linkage while compiling a shared object

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 29 07:43:26 PST 2017


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

            Bug ID: 35463
           Summary: X86: Stack probe symbol has wrong linkage while
                    compiling a shared object
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Target Description Classes
          Assignee: unassignedbugs at nondot.org
          Reporter: ales.hrabalik at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19485
  --> https://bugs.llvm.org/attachment.cgi?id=19485&action=edit
Nasty hack that fixes the issue for us

We build ELF objects on Windows. Everything seemed to be working fine until we
compiled some code that uses dynamic stack allocation, and tried to link it
into a shared library (executable linking works fine). Here is a minimal
example that produces the error we observed:

// minimal example -- commands //
clang++ --target=x86_64-pc-windows-elf -c foo.cpp
ld.lld -shared foo.o -o foo

// minimal example -- foo.cpp //
int foo(int x) {
    void *p = __builtin_alloca( x );
    return (int)p;
}

// minimal example -- lld error //
D:\build\llvm-install-release\bin\ld.lld.exe: error: can't create dynamic
relocation R_X86_64_PC32 against symbol: __chkstk in readonly segment;
recompile object files with -fPIC
>>> defined in foo.o
>>> referenced by foo.cpp
>>>               foo.o:(foo(int))

We have tracked the bug to X86FrameLowering.cpp. Attached is a small, nasty
hack that fixes the problem for us. It is probably not a good solution, but the
library links now.

-- 
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/20171129/ee8d7c42/attachment-0001.html>


More information about the llvm-bugs mailing list