• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版8a1285a1a3048f77abc56be3ff2f83a782506a04 (tree)
时间2019-05-17 23:38:14
作者Alan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

PR24567, assertion failure in ldlang.c:6868 when compiling with -flto

As the existing comment said: "a common ought to be overridden by a
def in a -flto object". This patch makes the code actually do that,
rather than allowing a normal object file common to override a -flto
defined symbol.

PR 24567
* plugin.c (plugin_notice): Do not let a common symbol override
a non-common definition in IR.

(cherry picked from commit af4fa23fba220c1b26bb3c8a7996b406dcc181cc)

更改概述

差异

--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
1+2019-05-17 Alan Modra <amodra@gmail.com>
2+
3+ PR 24567
4+ * plugin.c (plugin_notice): Do not let a common symbol override
5+ a non-common definition in IR.
6+
17 2019-04-24 H.J. Lu <hongjiu.lu@intel.com>
28
39 PR ld/24458
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -1316,30 +1316,36 @@ plugin_notice (struct bfd_link_info *info,
13161316 ref = TRUE;
13171317 }
13181318
1319- /* Otherwise, it must be a new def. */
1320- else
1319+
1320+ /* A common symbol should be merged with other commons or
1321+ defs with the same name. In particular, a common ought
1322+ to be overridden by a def in a -flto object. In that
1323+ sense a common is also a ref. */
1324+ else if (bfd_is_com_section (section))
13211325 {
1322- /* Ensure any symbol defined in an IR dummy BFD takes on a
1323- new value from a real BFD. Weak symbols are not normally
1324- overridden by a new weak definition, and strong symbols
1325- will normally cause multiple definition errors. Avoid
1326- this by making the symbol appear to be undefined. */
1327- if (((h->type == bfd_link_hash_defweak
1328- || h->type == bfd_link_hash_defined)
1329- && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
1330- || (h->type == bfd_link_hash_common
1331- && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner)))
1326+ if (h->type == bfd_link_hash_common
1327+ && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner))
13321328 {
13331329 h->type = bfd_link_hash_undefweak;
13341330 h->u.undef.abfd = sym_bfd;
13351331 }
1332+ ref = TRUE;
1333+ }
13361334
1337- /* A common symbol should be merged with other commons or
1338- defs with the same name. In particular, a common ought
1339- to be overridden by a def in a -flto object. In that
1340- sense a common is also a ref. */
1341- if (bfd_is_com_section (section))
1342- ref = TRUE;
1335+ /* Otherwise, it must be a new def.
1336+ Ensure any symbol defined in an IR dummy BFD takes on a
1337+ new value from a real BFD. Weak symbols are not normally
1338+ overridden by a new weak definition, and strong symbols
1339+ will normally cause multiple definition errors. Avoid
1340+ this by making the symbol appear to be undefined. */
1341+ else if (((h->type == bfd_link_hash_defweak
1342+ || h->type == bfd_link_hash_defined)
1343+ && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
1344+ || (h->type == bfd_link_hash_common
1345+ && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner)))
1346+ {
1347+ h->type = bfd_link_hash_undefweak;
1348+ h->u.undef.abfd = sym_bfd;
13431349 }
13441350
13451351 if (ref)