This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ld test failure on ARM GNU/Linux


On Sun, 9 Apr 2000, Philip Blundell wrote:

> selective4 is failing on arm-linux targets because B::foo is not discarded 
> from the output file.
> 
> Does anybody have time to look into this?

Preferably someone who knows C++ well.  This problem isn't specific to
arm/linux, it happens with x86 too, as I reported in January.  You need a
fairly recent gcc that supports -ffunction-sections -fdata-sections
-fvtable-gc -fno-exceptions -fno-rtti, otherwise these tests aren't even
run.  gcc-2.7.2 is too old.

The question boils down to:  Are the comments correct in the
following?  If so, then ld/testsuite/ld-selective/selective.exp is in
error.  The test fails due to finding foo__1B, and the comments seem to
indicate that foo_1B should indeed be kept.

struct A
{
  virtual void foo();
  virtual void bar();
};

void A::foo() { }                       // keep
void A::bar() { }                       // loose

struct B : public A
{
  virtual void foo();
};

void B::foo() { }                       // keep

void _start() __asm__("_start");        // keep

A a;                                    // keep
B b;
A *getme() { return &a; }               // keep

void _start()
{
  getme()->foo();
}

// In addition, keep A's virtual table.

// We'll wind up keeping `b' and thus B's virtual table because
// `a' and `b' are both referenced from the constructor function.

extern "C" void __main() { }


-- 
Linuxcare.  Support for the Revolution.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]