[PATCH 2/3] libctf: Add comment for conditionally def'd sym

Nicholas Vinson nvinson234@gmail.com
Sat Mar 2 05:00:00 GMT 2024


Removing the symbols ctf_label_set() and ctf_label_get() from
libctf/libctf.ver revealed the following errors when trying to link with
ld.lld-17:

ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_arc_open' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_fdopen' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_open' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen' failed: symbol not defined
ld.lld: error: version script assignment of 'LIBCTF_1.0' to symbol 'ctf_bfdopen_ctfsect' failed: symbol not defined

This patch fixes the issue by appending the comment
'/* libctf only.  */' to the ctf_arc_open() entry in libctf/libctf.ver.
The other error messages point to symbols that are already properly
annotated.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 libctf/configure.ac | 3 ++-
 libctf/libctf.ver   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libctf/configure.ac b/libctf/configure.ac
index e4e430615bd..0494a537e78 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -258,7 +258,8 @@ AC_CACHE_CHECK([for linker versioning flags], [ac_cv_libctf_version_script],
    CFLAGS="$CFLAGS -fPIC"
    AC_LINK_IFELSE([AC_LANG_SOURCE([[int ctf_foo (void) { return 0; }
 				    int main (void) { return ctf_foo(); }]])],
-		  [ac_cv_libctf_version_script="-Wl,--version-script='$srcdir/libctf.ver'"],
+		  [ac_cv_libctf_version_script="-Wl,--version-script"
+		   decommented_version_script=t],
 		  [])
    LDFLAGS="$old_LDFLAGS"
 
diff --git a/libctf/libctf.ver b/libctf/libctf.ver
index a685c4e3b9f..990251395ab 100644
--- a/libctf/libctf.ver
+++ b/libctf/libctf.ver
@@ -136,7 +136,7 @@ LIBCTF_1.0 {
 
 	ctf_arc_write;
 	ctf_arc_write_fd;
-	ctf_arc_open;
+	ctf_arc_open;                           /* libctf only.  */
 	ctf_arc_bufopen;
 	ctf_arc_close;
 	ctf_arc_open_by_name;
-- 
2.43.2



More information about the Binutils mailing list