http://llvm.org/bugs/show_bug.cgi?id=22115

            Bug ID: 22115
           Summary: PPC32: Base pointer clobbered with -fPIC
           Product: clang
           Version: 3.5
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 13646
  --> http://llvm.org/bugs/attachment.cgi?id=13646&action=edit
Output from clang -fPIC -S for foo.c

clang uses R30 as a pointer to a compilation-unit specific constant pool, but
does not save it in either the caller or callee in cross-compilation-unit
calls.

If the following example:

--8<-- foo.c --8<--
#include <stdio.h>

int foo()
{
  fprintf(stderr, "Two\n");
  return 0;
}

void dummy()
{
  fprintf(stderr, "Gotcha\n");
}
--8<-- bar.c --8<--
#include <stdio.h>
extern int foo(void);

int bar()
{
  fprintf(stderr, "One\n");
  int r = foo();
  fprintf(stderr, "Three\n");
  return r;
}
--8<--

is compiled with -fPIC, the output printed by bar() becomes

One
Two
Gothca

instead of the correct

One
Two
Three

Attaching assembler code generated by clang.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to