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: unassignedb...@nondot.org
          Reporter: ales.hraba...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to