On 5/4/22 14:32, Alexander Monakov wrote: > On Wed, 4 May 2022, Martin Liška wrote: > >> The patch is a follow-up of the discussion we've got in: >> https://gcc.gnu.org/pipermail/gcc-patches/2022-May/593901.html >> >> Mold linker would appreciate knowing in advance if get_symbols_v3 is supported >> by a GCC plug-in or not. >> >> Ready to be installed? > > Quick note: if the linker is supposed to check for presence of this symbol > via dlsym(), I expect it won't work as-is since lto-plugin.map hides every > symbol except 'onload'. Oh, good point! Changing that, I get now: $ nm ./lto-plugin/.libs/liblto_plugin.so | grep v3 0000000000015008 D supports_get_symbols_v3 > > (also it might be nicer to reword the comment to say 'Presence of the following > symbols is used for ...', because you're leaving the value as 'false'). Sure. I'm also changing it's default value. Sending v2. Cheers, Martin > > Alexander > >> Thanks, >> Martin >> >> lto-plugin/ChangeLog: >> >> * lto-plugin.c (supports_get_symbols_v3): Add symbol. >> --- >> lto-plugin/lto-plugin.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c >> index 47378435612..049f3841d5b 100644 >> --- a/lto-plugin/lto-plugin.c >> +++ b/lto-plugin/lto-plugin.c >> @@ -1554,3 +1554,8 @@ onload (struct ld_plugin_tv *tv) >> >> return LDPS_OK; >> } >> + >> +/* The following symbols are used for dynamic detection of plug-in features >> + from linker side. */ >> + >> +bool supports_get_symbols_v3;