linker plugin api limitation
Rafael Espíndola
rafael.espindola@gmail.com
Thu Mar 3 19:49:00 GMT 2016
An updated patch with changelog is attached.
Cheers,
Rafael
On 3 March 2016 at 14:19, Cary Coutant <ccoutant@gmail.com> wrote:
>> The bug is in gold. It is handling every symbol provided by the plugin
>> as defined when handling --start-lib/--end-lib members.
>>
>> Something like the attached patch should fix it.
>
> + if (sym.def != LDPK_DEF && sym.def != LDPK_WEAKDEF &&
> + sym.def != LDPK_COMMON)
> + continue;
>
> When breaking expressions, the operator should be placed at the
> beginning of the next line. Also, it would read better to have each
> condition on its own line if the line must be broken.
>
> I have a slight preference for inverting the condition:
>
> if (sym.def == LDPK_UNDEF || sym.def == LDPK_WEAKUNDEF)
> continue;
>
> There are fewer conditions to check, and if we ever add another LDPK_
> value, I think it's more likely that it'd be a kind of DEF than a kind
> of UNDEF. It also more closely mirrors the code in
> Sized_relobj_file::do_should_include_member().
>
> This is OK with that change. Thanks!
>
> -cary
-------------- next part --------------
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 53c1ceb..c6aae71 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-03 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
+
+ * plugin.cc (do_should_include_member): Ignore LDPK_UNDEF and
+ LDPK_WEAKUNDEF symbols.
+
2016-02-26 Egor Kochetov <egor.kochetov@intel.com>
Cary Coutant <ccoutant@gmail.com>
diff --git a/gold/plugin.cc b/gold/plugin.cc
index c01e4cd..0d6c5ce 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -1155,6 +1155,8 @@ Sized_pluginobj<size, big_endian>::do_should_include_member(
for (int i = 0; i < this->nsyms_; ++i)
{
const struct ld_plugin_symbol& sym = this->syms_[i];
+ if (sym.def == LDPK_UNDEF || sym.def == LDPK_WEAKUNDEF)
+ continue;
const char* name = sym.name;
Symbol* symbol;
Archive::Should_include t = Archive::should_include_member(symtab,
More information about the Binutils
mailing list