Re: [PATCH] lto: Set resolution to LDPR_PREVAILING_DEF for non-IR common symbol
Alan Modra <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Aug 27, 2026 at 04:31:43PM +0800, H.J. Lu wrote:
> Since size or alignment of common symbol may be overridden by another
> common symbol, set symbol resolution to LDPR_PREVAILING_DEF, instead of
> LDPR_RESOLVED_EXEC, for common symbol in regular object when seeing an
> undefined or common symbol from an IR object.
>
> PR ld/34570
> * plugin.c (get_symbols): Set resolution to LDPR_PREVAILING_DEF
> for common symbol in regular object.
> * testsuite/ld-plugin/pr34570a.c: New file.
> * testsuite/ld-plugin/pr34570a.d: Likewise.
> * testsuite/ld-plugin/pr34570b.c: Likewise.
> * testsuite/ld-plugin/pr34570b.d: Likewise.
> * testsuite/ld-plugin/pr34570c.c: Likewise.
> * testsuite/ld-plugin/pr34570c.d: Likewise.
OK. Would you please also apply the following along with your patch,
if you agree that this comment is incorrect regarding "or common" and
therefore confusing and unnecessary given the earlier comment.
diff --git a/ld/plugin.c b/ld/plugin.c
index 1cf5c915b00..e221e414db5 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -871,8 +871,6 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms,
res = LDPR_PREEMPTED_REG;
else if (owner_sec->owner == abfd)
res = LDPR_PREVAILING_DEF_IRONLY;
-
- /* Was originally def, weakdef, or common, but has been pre-empted. */
else if (is_ir_dummy_bfd (owner_sec->owner))
res = LDPR_PREEMPTED_IR;
else
--
Alan Modra