[llvm-bugs] [Bug 26226] New: -fstack-protector fails to link on powerpc64le linux

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 20 17:01:38 PST 2016


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

            Bug ID: 26226
           Summary: -fstack-protector fails to link on powerpc64le linux
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: timshen91 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Example:
  // clang++ -target powerpc64le-unknown-linux-gnu -fstack-protector a.cc
  int main() {
    char arr[2048];
    arr[2048+15] = 0;

    return 0;
  }

Linker complains undefined reference to `__stack_chk_guard'.

In fact, glibc stores stack_guard not as a global/TLS variable, but a data
member in TCB:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/nptl/tls.h;h=0e889bc122c9bf91bae1adf43977e9e04c1e5595;hb=HEAD#l99

x86 suffered from the same issue, and then was fixed by:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20100705/103635.html

The fix specifies an address space (which finally turns into fs/gs access) and
hard code the offset to indicate the location of the stack guard.

How do we fix this? Do we use the same address space trick?

Thanks!

-- 
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/20160121/b5225793/attachment.html>


More information about the llvm-bugs mailing list