bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/13245] PREVAILING_DEF reported too often.


From: cryptooctoploid at gmail dot com
Subject: [Bug gold/13245] PREVAILING_DEF reported too often.
Date: Sun, 02 Oct 2011 13:01:38 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=13245

--- Comment #5 from Octoploid <cryptooctoploid at gmail dot com> 2011-10-02 
13:01:38 UTC ---
What about the following naive patch?

diff --git a/gold/plugin.cc b/gold/plugin.cc
index b5880a1..d999254 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -889,10 +889,10 @@ Pluginobj::get_symbol_resolution_info(int nsyms,
             res = LDPR_RESOLVED_EXEC;
           else if (lsym->object()->pluginobj() == this)
            {
-             if (is_referenced_from_outside(lsym))
-               res = LDPR_PREVAILING_DEF;
-             else if (is_visible_from_outside(lsym))
+             if (is_visible_from_outside(lsym))
                res = ldpr_prevailing_def_ironly_exp;
+             else if (is_referenced_from_outside(lsym))
+               res = LDPR_PREVAILING_DEF;
              else
                res = LDPR_PREVAILING_DEF_IRONLY;
            }
@@ -910,10 +910,10 @@ Pluginobj::get_symbol_resolution_info(int nsyms,
             res = LDPR_PREEMPTED_REG;
           else if (lsym->object() == static_cast<const Object*>(this))
            {
-             if (is_referenced_from_outside(lsym))
-               res = LDPR_PREVAILING_DEF;
-             else if (is_visible_from_outside(lsym))
+             if (is_visible_from_outside(lsym))
                res = ldpr_prevailing_def_ironly_exp;
+             else if (is_referenced_from_outside(lsym))
+               res = LDPR_PREVAILING_DEF;
              else
                res = LDPR_PREVAILING_DEF_IRONLY;
            }


It fixes the issue:

 % gcc t2.C --shared -o t2.so -fPIC -L ./ -lt -flto --save-temps
[Leaving LTRANS /tmp/ccHFvJ09.args]
[Leaving LTRANS t2.so.ltrans.out]
[Leaving LTRANS /tmp/ccwhzNf0.args]
[Leaving LTRANS t2.so.ltrans0.o]

 % < t2.res
1
t2.o 3
164 e040fa02d1822684 PREVAILING_DEF_IRONLY_EXP _Z4testv
172 e040fa02d1822684 PREVAILING_DEF_IRONLY_EXP _Z5test2v
176 e040fa02d1822684 RESOLVED_DYN _Z5test3v

 % nm -CD t2.so
                 w _Jv_RegisterClasses
                 w test()
000000000000056c T test2()
                 U test3()
0000000000001898 A __bss_start
                 w __cxa_finalize
                 w __gmon_start__
0000000000001898 A _edata
000000000000189c A _end
0000000000000584 T _fini
00000000000004a0 T _init

It also survived bootstrap-lto of gcc and an "-flto -fno-fat-lto-objects" build
of Firefox.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]