public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] nptl_db: Re-use the ELF-to-abilist converter for ABI checking
@ 2021-06-29 20:17 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2021-06-29 20:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3640654575bef7b56840fbadc1a6d6180ea011a7

commit 3640654575bef7b56840fbadc1a6d6180ea011a7
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Jun 29 22:17:05 2021 +0200

    nptl_db: Re-use the ELF-to-abilist converter for ABI checking
    
    The previous approach uses readelf -DWs, which does not produce
    a stable output format (older binutils versions do not include
    symbol version information).  This commit re-uses scripts/abilist.awk
    with a tweak to include GLIBC_PRIVATE symbols.  This awk script
    is based on objdump -T output, which appears to be stable over time.
    
    Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>

Diff:
---
 nptl_db/Makefile       |  9 +++++++--
 nptl_db/db-symbols.awk | 15 +++++----------
 scripts/abilist.awk    |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/nptl_db/Makefile b/nptl_db/Makefile
index c04aa6140a..8ad4f90e84 100644
--- a/nptl_db/Makefile
+++ b/nptl_db/Makefile
@@ -54,8 +54,13 @@ tests-special += $(objpfx)db-symbols.out
 include ../Rules
 
 $(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \
-			 $(common-objpfx)libc.so
-	LC_ALL=C $(READELF) -W -D -s $(filter %.so,$^) | $(AWK) -f $< > $@; \
+			 $(objpfx)libc.symlist-private
+	LC_ALL=C $(AWK) -f $^ > $@; \
 	$(evaluate-test)
 
 $(objpfx)db-symbols.v.i: db-symbols.awk
+
+$(objpfx)libc.symlist-private: $(..)scripts/abilist.awk \
+  $(common-objpfx)libc.dynsym
+	LC_ALL=C $(AWK) -v include_private=1 -f $^ > $@T
+	mv -f $@T $@
diff --git a/nptl_db/db-symbols.awk b/nptl_db/db-symbols.awk
index fe90d3b435..67034c3e89 100644
--- a/nptl_db/db-symbols.awk
+++ b/nptl_db/db-symbols.awk
@@ -1,5 +1,5 @@
-# This script processes the output of 'readelf -W -D -s' on the libc.so
-# we've just built.  It checks for all the symbols used in td_symbol_list.
+# This script processes the libc.so abilist (with GLIBC_PRIVATE
+# symbols included).  It checks for all the symbols used in td_symbol_list.
 
 BEGIN {
 %define DB_MAIN_VARIABLE(name) /* Nothing. */
@@ -12,18 +12,14 @@ BEGIN {
    in_symtab = 0;
 }
 
-/Symbol table for image/ { in_symtab=1; next }
-NF == 0 { in_symtab=0; next }
-
-!in_symtab { next }
-
-NF >= 8 && $7 != "UND" { seen[$NF] = 1 }
+/^GLIBC_PRIVATE / {
+    seen[$2] = 1
+}
 
 END {
   status = 0;
 
   for (s in required) {
-    s = s "@@GLIBC_PRIVATE"
     if (s in seen) print s, "ok";
     else {
       status = 1;
@@ -33,7 +29,6 @@ END {
 
   any = "";
   for (s in th_unique) {
-    s = s "@@GLIBC_PRIVATE"
     if (s in seen) {
       any = s;
       break;
diff --git a/scripts/abilist.awk b/scripts/abilist.awk
index a43400d5b4..24a34ccbed 100644
--- a/scripts/abilist.awk
+++ b/scripts/abilist.awk
@@ -55,7 +55,7 @@ $2 == "g" || $2 == "w" && (NF == 7 || NF == 8) {
   # caused STV_HIDDEN symbols to appear in .dynsym, though that is useless.
   if (NF > 7 && $7 == ".hidden") next;
 
-  if (version == "GLIBC_PRIVATE") next;
+  if (version == "GLIBC_PRIVATE" && !include_private) next;
 
   desc = "";
   if (type == "D" && ($4 == ".tbss" || $4 == ".tdata")) {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-29 20:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 20:17 [glibc] nptl_db: Re-use the ELF-to-abilist converter for ABI checking Florian Weimer

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).