[llvm-bugs] [Bug 32906] New: fatal error with "-mcmodel=medium -fpic" for global pointers

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 3 04:08:40 PDT 2017


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

            Bug ID: 32906
           Summary: fatal error with "-mcmodel=medium -fpic" for global
                    pointers
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: elad2.cohen at intel.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18399
  --> https://bugs.llvm.org/attachment.cgi?id=18399&action=edit
Generated .ll file (clang tst.c -S -emit-llvm -mcmodel=medium -fpic

The following code crashes when compiling with top-of-trunc clang using
"-mcmodel=medium -fpic":

> cat tst.c
void foo(int *);
int *x;

int main() {
  foo(x);
  return 0;
}

> clang tst.c -c -mcmodel=medium -fpic
fatal error: error in backend: 32 bit reloc applied to a field with a different
size

With gcc this code compiles successfully.


The error is given during assembly:
> clang tst.c -S -mcmodel=medium -fpic
> clang tst.s
tst.s:19:2: error: 32 bit reloc applied to a field with a different size
        movabsq $x at GOTPCREL, %rax
        ^

Generated .ll and .s files are attached.

-- 
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/20170503/9daeb1f4/attachment-0001.html>


More information about the llvm-bugs mailing list