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

            Bug ID: 17111
           Summary: missing nop after branch
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Testcase:

  class Base {
  protected:
    Base() {}

  public:
    virtual ~Base();
    virtual void BaseMethod() {}
  };

  struct Derived : public Base {
    ~Derived() {
      DerivedMethod();
    }

    void DerivedMethod();

    virtual void BaseMethod();
  };

  void Derived::DerivedMethod() {}
  void Derived::BaseMethod() {}

The bug is in the assembly generated for the destructor. Here's a snippet:

  .Ltmp4:
         std 5, 120(31)
         bl _ZN7Derived13DerivedMethodEv
  .Ltmp5:
         b .LBB4_1

That doesn't leave enough space for the linker to insert the TOC reload when
resolving the R_PPC64_REL24 relocation. There needs to be a nop after the
branch+link instruction.

Reproduce with:

  clang -target powerpc64-pc-linux-gnu -fpic testcase.cc -S -o -

Ultimately the symptom is a failure when linking:

  error: call lacks nop, can't restore toc; recompile with -fPIC

-- 
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