[LLVMbugs] [Bug 22115] New: PPC32: Base pointer clobbered with -fPIC

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 7 03:44:44 PST 2015


            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: unassignedclangbugs at nondot.org
          Reporter: marcus at mc.pp.se
                CC: llvmbugs at cs.uiuc.edu
    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

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;

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


instead of the correct


Attaching assembler code generated by clang.

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/20150107/b836709b/attachment.html>

More information about the llvm-bugs mailing list