https://sourceware.org/bugzilla/show_bug.cgi?id=16650

            Bug ID: 16650
           Summary: PREVAILING_DEF / PREVAILING_DEF_IRONLY_EXP mix-up
           Product: binutils
           Version: 2.25 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ian at airs dot com
          Reporter: markus at trippelsdorf dot de
                CC: ccoutant at google dot com

With the following file from the gcc test-suite:

markus@x4 tmp % cat 20090302_0.C
struct Foo {
  bool Mumble();
  static void Bar() { if (foo_->Mumble()) foo_ = 0; }
  static void Baz() { Bar(); }
  static Foo *foo_;
};
void Unused() { Foo::Bar(); Foo::Baz(); }

I get with gold:

markus@x4 tmp % ld -v
GNU gold (GNU Binutils 2.24.51.20140218) 1.11

markus@x4 tmp % g++ --save-temps -fPIC -flto -r -nostdlib 20090302_0.C

markus@x4 tmp % cat 20090302_0.res
1
20090302_0.o 5
181 aadbdfab9720df19 PREVAILING_DEF _ZN3Foo3BarEv
184 aadbdfab9720df19 PREVAILING_DEF _ZN3Foo3BazEv
187 aadbdfab9720df19 PREVAILING_DEF _Z6Unusedv
203 aadbdfab9720df19 UNDEF _ZN3Foo4foo_E
200 aadbdfab9720df19 UNDEF _ZN3Foo6MumbleEv

ld.bfd gives the correct resolution:

markus@x4 tmp % ld -v
GNU ld (GNU Binutils) 2.24.51.20140218
markus@x4 tmp % g++ --save-temps -fPIC -flto -r -nostdlib 20090302_0.C

markus@x4 tmp % cat 20090302_0.res
1
20090302_0.o 5
181 5195e340d5f136e PREVAILING_DEF_IRONLY_EXP _ZN3Foo3BarEv
184 5195e340d5f136e PREVAILING_DEF_IRONLY_EXP _ZN3Foo3BazEv
187 5195e340d5f136e PREVAILING_DEF_IRONLY_EXP _Z6Unusedv
203 5195e340d5f136e UNDEF _ZN3Foo4foo_E
200 5195e340d5f136e UNDEF _ZN3Foo6MumbleEv

The PREVAILING_DEF resolution (instead of PREVAILING_DEF_IRONLY_EXP) that gold
produces leads to missed optimizations in gcc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to