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>
This commit is contained in:
Florian Weimer 2021-06-29 22:17:05 +02:00
parent 9dc7dc5708
commit 3640654575
3 changed files with 13 additions and 13 deletions

View File

@ -54,8 +54,13 @@ tests-special += $(objpfx)db-symbols.out
include ../Rules include ../Rules
$(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \ $(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \
$(common-objpfx)libc.so $(objpfx)libc.symlist-private
LC_ALL=C $(READELF) -W -D -s $(filter %.so,$^) | $(AWK) -f $< > $@; \ LC_ALL=C $(AWK) -f $^ > $@; \
$(evaluate-test) $(evaluate-test)
$(objpfx)db-symbols.v.i: db-symbols.awk $(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 $@

View File

@ -1,5 +1,5 @@
# This script processes the output of 'readelf -W -D -s' on the libc.so # This script processes the libc.so abilist (with GLIBC_PRIVATE
# we've just built. It checks for all the symbols used in td_symbol_list. # symbols included). It checks for all the symbols used in td_symbol_list.
BEGIN { BEGIN {
%define DB_MAIN_VARIABLE(name) /* Nothing. */ %define DB_MAIN_VARIABLE(name) /* Nothing. */
@ -12,18 +12,14 @@ BEGIN {
in_symtab = 0; in_symtab = 0;
} }
/Symbol table for image/ { in_symtab=1; next } /^GLIBC_PRIVATE / {
NF == 0 { in_symtab=0; next } seen[$2] = 1
}
!in_symtab { next }
NF >= 8 && $7 != "UND" { seen[$NF] = 1 }
END { END {
status = 0; status = 0;
for (s in required) { for (s in required) {
s = s "@@GLIBC_PRIVATE"
if (s in seen) print s, "ok"; if (s in seen) print s, "ok";
else { else {
status = 1; status = 1;
@ -33,7 +29,6 @@ END {
any = ""; any = "";
for (s in th_unique) { for (s in th_unique) {
s = s "@@GLIBC_PRIVATE"
if (s in seen) { if (s in seen) {
any = s; any = s;
break; break;

View File

@ -55,7 +55,7 @@ $2 == "g" || $2 == "w" && (NF == 7 || NF == 8) {
# caused STV_HIDDEN symbols to appear in .dynsym, though that is useless. # caused STV_HIDDEN symbols to appear in .dynsym, though that is useless.
if (NF > 7 && $7 == ".hidden") next; if (NF > 7 && $7 == ".hidden") next;
if (version == "GLIBC_PRIVATE") next; if (version == "GLIBC_PRIVATE" && !include_private) next;
desc = ""; desc = "";
if (type == "D" && ($4 == ".tbss" || $4 == ".tdata")) { if (type == "D" && ($4 == ".tbss" || $4 == ".tdata")) {