public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [binutils] libctf: Remove undefined functions from ver. map
@ 2023-12-28 19:10 Nicholas Vinson
       [not found] ` <87bk828z6q.fsf@gentoo.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Nicholas Vinson @ 2023-12-28 19:10 UTC (permalink / raw)
  To: binutils; +Cc: Nicholas Vinson

The functions ctf_label_set(), ctf_label_get(), ctf_arc_open(), ctf_fdopen(),
ctf_open(), ctf_bfdopen(), and ctf_bfdopen_ctfsect() are not defined. Their
inclusion in libctf/libctf.ver causes clang/llvm LTO optimizatiosn to fail with
error messages similar to

    error: version script assignment of LIBCTF_1.0 to symbol ctf_label_set
    failed: symbol not defined

This patch fixes the issue by removing the symbol names from libctf/libctf.ver

Fixes Gentoo bug 914640 (https://bugs.gentoo.org/914640)

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 libctf/libctf.ver | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/libctf/libctf.ver b/libctf/libctf.ver
index 0ff825d033b..08e1b27341f 100644
--- a/libctf/libctf.ver
+++ b/libctf/libctf.ver
@@ -80,9 +80,6 @@ LIBCTF_1.0 {
 	ctf_enum_name;
 	ctf_enum_value;
 
-	ctf_label_set;
-	ctf_label_get;
-
 	ctf_label_topmost;
 	ctf_label_info;
 
@@ -139,7 +136,6 @@ LIBCTF_1.0 {
 
 	ctf_arc_write;
 	ctf_arc_write_fd;
-	ctf_arc_open;
 	ctf_arc_bufopen;
 	ctf_arc_close;
 	ctf_arc_open_by_name;
@@ -165,10 +161,6 @@ LIBCTF_1.0 {
 	ctf_link_shuffle_syms;
 	ctf_link_write;
 
-	ctf_fdopen;                             /* libctf only.  */
-	ctf_open;                               /* libctf only.  */
-	ctf_bfdopen;                            /* libctf only.  */
-	ctf_bfdopen_ctfsect;                    /* libctf only.  */
     local:
 	*;
 };
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [binutils] libctf: Remove undefined functions from ver. map
       [not found] ` <87bk828z6q.fsf@gentoo.org>
@ 2024-02-27 15:05   ` Nick Alcock
  2024-02-28  0:32     ` Nicholas Vinson
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Alcock @ 2024-02-27 15:05 UTC (permalink / raw)
  To: Sam James; +Cc: Nicholas Vinson, binutils

On 27 Feb 2024, Sam James said:

> Nicholas Vinson <nvinson234@gmail.com> writes:
>
>> The functions ctf_label_set(), ctf_label_get(), ctf_arc_open(), ctf_fdopen(),
>> ctf_open(), ctf_bfdopen(), and ctf_bfdopen_ctfsect() are not defined. Their
>> inclusion in libctf/libctf.ver causes clang/llvm LTO optimizatiosn to fail with
>> error messages similar to

This is definitely not right. They *are* defined, but only for some
libraries built from this version script. You can't just take them out.

>> Fixes Gentoo bug 914640 (https://bugs.gentoo.org/914640)
>>
>> Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
>> ---
>>  libctf/libctf.ver | 8 --------
>>  1 file changed, 8 deletions(-)
>
> [CCing a possible reviewer.]
>
>>
>> diff --git a/libctf/libctf.ver b/libctf/libctf.ver
>> index 0ff825d033b..08e1b27341f 100644
>> --- a/libctf/libctf.ver
>> +++ b/libctf/libctf.ver
>> @@ -80,9 +80,6 @@ LIBCTF_1.0 {
>>  	ctf_enum_name;
>>  	ctf_enum_value;
>>  
>> -	ctf_label_set;
>> -	ctf_label_get;
>> -
>>  	ctf_label_topmost;
>>  	ctf_label_info;
>
> Can you explain each of these? Were they ever in binutils/libctf
> (possible typos) or did they get removed?

The ctf_label things are historical artifacts from the Solaris days used
by their old stabs-based deduplicator. Some of the code remains, and I
have hopes of repurposing much of it and the unused CTF file format
section for a better way of encoding child dicts with conflicting types
in them in the future, but ctf_label_{set,get} appear to have been
nonexistent for as long as I've had anything to do with libctf. They
should be removed from ctf-api.h too.

>>  
>> @@ -139,7 +136,6 @@ LIBCTF_1.0 {
>>  
>>  	ctf_arc_write;
>>  	ctf_arc_write_fd;
>> -	ctf_arc_open;
>>  	ctf_arc_bufopen;
>>  	ctf_arc_close;
>>  	ctf_arc_open_by_name;
>> @@ -165,10 +161,6 @@ LIBCTF_1.0 {
>>  	ctf_link_shuffle_syms;
>>  	ctf_link_write;
>>  
>> -	ctf_fdopen;                             /* libctf only.  */
>> -	ctf_open;                               /* libctf only.  */
>> -	ctf_bfdopen;                            /* libctf only.  */
>> -	ctf_bfdopen_ctfsect;                    /* libctf only.  */
>>      local:
>>  	*;
>>  };

These are definitely used, and exist -- as the comments note, some of
them exist only in libctf.so, not in libctf-nobfd.so.

lld is not the first linker to complain about missing symbols: recent
Solaris linkers do as well, so we arranged to mark such symbols as
/* libctf only. */ so that they can be removed from the version script
used to link ctf-nobfd.so (see libctf/configure.ac for the code that
does that). But here too we have a bug: ctf_arc_open is in
ctf-open-bfd.c, thus is not found in libctf-nobfd.so: it should be at
the end of the version script like all other such symbols and marked as
/* libctf only. */ as well. 

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [binutils] libctf: Remove undefined functions from ver. map
  2024-02-27 15:05   ` Nick Alcock
@ 2024-02-28  0:32     ` Nicholas Vinson
  2024-02-28 18:14       ` Nick Alcock
  0 siblings, 1 reply; 7+ messages in thread
From: Nicholas Vinson @ 2024-02-28  0:32 UTC (permalink / raw)
  To: Nick Alcock, Sam James; +Cc: binutils

On 2/27/24 10:05, Nick Alcock wrote:
> On 27 Feb 2024, Sam James said:
> 
>> Nicholas Vinson <nvinson234@gmail.com> writes:
>>
>>> The functions ctf_label_set(), ctf_label_get(), ctf_arc_open(), ctf_fdopen(),
>>> ctf_open(), ctf_bfdopen(), and ctf_bfdopen_ctfsect() are not defined. Their
>>> inclusion in libctf/libctf.ver causes clang/llvm LTO optimizatiosn to fail with
>>> error messages similar to
> 
> This is definitely not right. They *are* defined, but only for some
> libraries built from this version script. You can't just take them out.
> 

Could you point me to the definitions for ctf_label_set() and 
ctf_label_get() ?

Using `git log -G` I found the declarations, but no definitions, in the 
following commits:

139633c307eb6f5746ea04f94a0b6382e51bccb9
0b11474080800192797236e30857a42818f5560d
87279e3cef5b2c54f4a01962cf9dcea38664a336
6dbf2b734063522b4f3d7403ce7a2b436802b839

I do find definitions for the other so the other symbols, so I'll find a 
different way to handle those symbols in the version file.

>>> Fixes Gentoo bug 914640 (https://bugs.gentoo.org/914640)
>>>
>>> Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
>>> ---
>>>   libctf/libctf.ver | 8 --------
>>>   1 file changed, 8 deletions(-)
>>
>> [CCing a possible reviewer.]
>>
>>>
>>> diff --git a/libctf/libctf.ver b/libctf/libctf.ver
>>> index 0ff825d033b..08e1b27341f 100644
>>> --- a/libctf/libctf.ver
>>> +++ b/libctf/libctf.ver
>>> @@ -80,9 +80,6 @@ LIBCTF_1.0 {
>>>   	ctf_enum_name;
>>>   	ctf_enum_value;
>>>   
>>> -	ctf_label_set;
>>> -	ctf_label_get;
>>> -
>>>   	ctf_label_topmost;
>>>   	ctf_label_info;
>>
>> Can you explain each of these? Were they ever in binutils/libctf
>> (possible typos) or did they get removed?
> 
> The ctf_label things are historical artifacts from the Solaris days used
> by their old stabs-based deduplicator. Some of the code remains, and I
> have hopes of repurposing much of it and the unused CTF file format
> section for a better way of encoding child dicts with conflicting types
> in them in the future, but ctf_label_{set,get} appear to have been
> nonexistent for as long as I've had anything to do with libctf. They
> should be removed from ctf-api.h too.
> 
>>>   
>>> @@ -139,7 +136,6 @@ LIBCTF_1.0 {
>>>   
>>>   	ctf_arc_write;
>>>   	ctf_arc_write_fd;
>>> -	ctf_arc_open;
>>>   	ctf_arc_bufopen;
>>>   	ctf_arc_close;
>>>   	ctf_arc_open_by_name;
>>> @@ -165,10 +161,6 @@ LIBCTF_1.0 {
>>>   	ctf_link_shuffle_syms;
>>>   	ctf_link_write;
>>>   
>>> -	ctf_fdopen;                             /* libctf only.  */
>>> -	ctf_open;                               /* libctf only.  */
>>> -	ctf_bfdopen;                            /* libctf only.  */
>>> -	ctf_bfdopen_ctfsect;                    /* libctf only.  */
>>>       local:
>>>   	*;
>>>   };
> 
> These are definitely used, and exist -- as the comments note, some of
> them exist only in libctf.so, not in libctf-nobfd.so.
> 
> lld is not the first linker to complain about missing symbols: recent
> Solaris linkers do as well, so we arranged to mark such symbols as
> /* libctf only. */ so that they can be removed from the version script
> used to link ctf-nobfd.so (see libctf/configure.ac for the code that
> does that). But here too we have a bug: ctf_arc_open is in
> ctf-open-bfd.c, thus is not found in libctf-nobfd.so: it should be at
> the end of the version script like all other such symbols and marked as
> /* libctf only. */ as well.
> 

I'll take a look.

Thanks,
Nicholas Vinson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [binutils] libctf: Remove undefined functions from ver. map
  2024-02-28  0:32     ` Nicholas Vinson
@ 2024-02-28 18:14       ` Nick Alcock
  2024-03-01  1:49         ` Nicholas Vinson
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Alcock @ 2024-02-28 18:14 UTC (permalink / raw)
  To: Nicholas Vinson; +Cc: Sam James, binutils

On 28 Feb 2024, Nicholas Vinson told this:

> On 2/27/24 10:05, Nick Alcock wrote:
>> On 27 Feb 2024, Sam James said:
>> 
>>> Nicholas Vinson <nvinson234@gmail.com> writes:
>>>
>>>> The functions ctf_label_set(), ctf_label_get(), ctf_arc_open(), ctf_fdopen(),
>>>> ctf_open(), ctf_bfdopen(), and ctf_bfdopen_ctfsect() are not defined. Their
>>>> inclusion in libctf/libctf.ver causes clang/llvm LTO optimizatiosn to fail with
>>>> error messages similar to
>> This is definitely not right. They *are* defined, but only for some
>> libraries built from this version script. You can't just take them out.
>
> Could you point me to the definitions for ctf_label_set() and ctf_label_get() ?

Those two are long dead and gone and should indeed be removed from the
.ver script. (I wonder why Solaris's linker, which is just as picky
about version scripts referencing only symbols that actually exist,
never warned me about this.)

> I do find definitions for the other so the other symbols, so I'll find
> a different way to handle those symbols in the version file.

Commenting them as /* libctf only. */ should be enough, I think. Only
one symbol seems to be missing, ctf_arc_open. The others are already
properly marked and should already be being excluded from the .ver
script for libctf_nobfd.so.)

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [binutils] libctf: Remove undefined functions from ver. map
  2024-02-28 18:14       ` Nick Alcock
@ 2024-03-01  1:49         ` Nicholas Vinson
  2024-03-01 17:46           ` Nick Alcock
  0 siblings, 1 reply; 7+ messages in thread
From: Nicholas Vinson @ 2024-03-01  1:49 UTC (permalink / raw)
  To: Nick Alcock; +Cc: Sam James, binutils



On 2/28/24 13:14, Nick Alcock wrote:
> On 28 Feb 2024, Nicholas Vinson told this:
> 
>> On 2/27/24 10:05, Nick Alcock wrote:
>>> On 27 Feb 2024, Sam James said:
>>>
>>>> Nicholas Vinson <nvinson234@gmail.com> writes:
>>>>
>>>>> The functions ctf_label_set(), ctf_label_get(), ctf_arc_open(), ctf_fdopen(),
>>>>> ctf_open(), ctf_bfdopen(), and ctf_bfdopen_ctfsect() are not defined. Their
>>>>> inclusion in libctf/libctf.ver causes clang/llvm LTO optimizatiosn to fail with
>>>>> error messages similar to
>>> This is definitely not right. They *are* defined, but only for some
>>> libraries built from this version script. You can't just take them out.
>>
>> Could you point me to the definitions for ctf_label_set() and ctf_label_get() ?
> 
> Those two are long dead and gone and should indeed be removed from the
> .ver script. (I wonder why Solaris's linker, which is just as picky
> about version scripts referencing only symbols that actually exist,
> never warned me about this.)
> 
>> I do find definitions for the other so the other symbols, so I'll find
>> a different way to handle those symbols in the version file.
> 
> Commenting them as /* libctf only. */ should be enough, I think. Only
> one symbol seems to be missing, ctf_arc_open. The others are already
> properly marked and should already be being excluded from the .ver
> script for libctf_nobfd.so.)
> 

I see what you're talking about in libctf/configure.ac. However, it's 
protected by a `test -n "$decommented_version_script"` check. Because 
ld.lld does not understand `-B local`, that variable remains empty and 
the lines in the version file containing /* libctf only.  */ are not 
removed.

Thanks,
Nicholas Vinson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [binutils] libctf: Remove undefined functions from ver. map
  2024-03-01  1:49         ` Nicholas Vinson
@ 2024-03-01 17:46           ` Nick Alcock
  2024-03-02  3:36             ` Nicholas Vinson
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Alcock @ 2024-03-01 17:46 UTC (permalink / raw)
  To: Nicholas Vinson; +Cc: Sam James, binutils

On 1 Mar 2024, Nicholas Vinson spake thusly:

>
>
> On 2/28/24 13:14, Nick Alcock wrote:
>> On 28 Feb 2024, Nicholas Vinson told this:
>> 
>>> On 2/27/24 10:05, Nick Alcock wrote:
>>>> On 27 Feb 2024, Sam James said:
>>>>
>>>>> Nicholas Vinson <nvinson234@gmail.com> writes:
>>>>>
>>>>>> The functions ctf_label_set(), ctf_label_get(), ctf_arc_open(), ctf_fdopen(),
>>>>>> ctf_open(), ctf_bfdopen(), and ctf_bfdopen_ctfsect() are not defined. Their
>>>>>> inclusion in libctf/libctf.ver causes clang/llvm LTO optimizatiosn to fail with
>>>>>> error messages similar to
>>>> This is definitely not right. They *are* defined, but only for some
>>>> libraries built from this version script. You can't just take them out.
>>>
>>> Could you point me to the definitions for ctf_label_set() and ctf_label_get() ?
>> Those two are long dead and gone and should indeed be removed from the
>> .ver script. (I wonder why Solaris's linker, which is just as picky
>> about version scripts referencing only symbols that actually exist,
>> never warned me about this.)
>> 
>>> I do find definitions for the other so the other symbols, so I'll find
>>> a different way to handle those symbols in the version file.
>> Commenting them as /* libctf only. */ should be enough, I think. Only
>> one symbol seems to be missing, ctf_arc_open. The others are already
>> properly marked and should already be being excluded from the .ver
>> script for libctf_nobfd.so.)
>> 
>
> I see what you're talking about in libctf/configure.ac. However, it's protected by a `test -n "$decommented_version_script"` check.
> Because ld.lld does not understand `-B local`, that variable remains empty and the lines in the version file containing /* libctf
> only.  */ are not removed.

Aha! GNU ld doesn't support that option either. This test was meant to
detect Solaris ld, which supports version scripts with similar "no
undefined symbols" limitations to what lld seems to here. I'd suggest
that configure test needs augmenting to catch lld as well when this flag
is provided (so specifying $LDFLAGS in whatever test you carry out).

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [binutils] libctf: Remove undefined functions from ver. map
  2024-03-01 17:46           ` Nick Alcock
@ 2024-03-02  3:36             ` Nicholas Vinson
  0 siblings, 0 replies; 7+ messages in thread
From: Nicholas Vinson @ 2024-03-02  3:36 UTC (permalink / raw)
  To: Nick Alcock; +Cc: Sam James, binutils

On 3/1/24 12:46, Nick Alcock wrote:
> On 1 Mar 2024, Nicholas Vinson spake thusly:
> 
>>
>>
>> On 2/28/24 13:14, Nick Alcock wrote:
>>> On 28 Feb 2024, Nicholas Vinson told this:
>>>
>>>> On 2/27/24 10:05, Nick Alcock wrote:
>>>>> On 27 Feb 2024, Sam James said:
>>>>>
>>>>>> Nicholas Vinson <nvinson234@gmail.com> writes:
>>>>>>
>>>>>>> The functions ctf_label_set(), ctf_label_get(), ctf_arc_open(), ctf_fdopen(),
>>>>>>> ctf_open(), ctf_bfdopen(), and ctf_bfdopen_ctfsect() are not defined. Their
>>>>>>> inclusion in libctf/libctf.ver causes clang/llvm LTO optimizatiosn to fail with
>>>>>>> error messages similar to
>>>>> This is definitely not right. They *are* defined, but only for some
>>>>> libraries built from this version script. You can't just take them out.
>>>>
>>>> Could you point me to the definitions for ctf_label_set() and ctf_label_get() ?
>>> Those two are long dead and gone and should indeed be removed from the
>>> .ver script. (I wonder why Solaris's linker, which is just as picky
>>> about version scripts referencing only symbols that actually exist,
>>> never warned me about this.)
>>>
>>>> I do find definitions for the other so the other symbols, so I'll find
>>>> a different way to handle those symbols in the version file.
>>> Commenting them as /* libctf only. */ should be enough, I think. Only
>>> one symbol seems to be missing, ctf_arc_open. The others are already
>>> properly marked and should already be being excluded from the .ver
>>> script for libctf_nobfd.so.)
>>>
>>
>> I see what you're talking about in libctf/configure.ac. However, it's protected by a `test -n "$decommented_version_script"` check.
>> Because ld.lld does not understand `-B local`, that variable remains empty and the lines in the version file containing /* libctf
>> only.  */ are not removed.
> 
> Aha! GNU ld doesn't support that option either. This test was meant to
> detect Solaris ld, which supports version scripts with similar "no
> undefined symbols" limitations to what lld seems to here. I'd suggest
> that configure test needs augmenting to catch lld as well when this flag
> is provided (so specifying $LDFLAGS in whatever test you carry out).
> 
I'm considering this thread closed. I have a new patch that solves the 
problem. I'll post it soon.

Thanks,
Nicholas Vinson

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-02  3:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-28 19:10 [binutils] libctf: Remove undefined functions from ver. map Nicholas Vinson
     [not found] ` <87bk828z6q.fsf@gentoo.org>
2024-02-27 15:05   ` Nick Alcock
2024-02-28  0:32     ` Nicholas Vinson
2024-02-28 18:14       ` Nick Alcock
2024-03-01  1:49         ` Nicholas Vinson
2024-03-01 17:46           ` Nick Alcock
2024-03-02  3:36             ` Nicholas Vinson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).