mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 06:20:06 +00:00
* scripts/abilist.awk: Produce a more compact format, divided into
stanzas for each version set, the set name listed only once. * scripts/extract-abilist.awk: New file. * scripts/merge-abilist.awk: New file. * Makerules (check-abi-%, update-abi-%): New pattern rules. (update-abi, check-abi): New targets. * Makefile (+subdir_targets): Add subdir_{check,update}-abi. * Makerules (%.symlist): Use LC_ALL=C when running awk script.
This commit is contained in:
parent
b27b002d5b
commit
c823a4d21b
12
ChangeLog
12
ChangeLog
@ -1,5 +1,17 @@
|
||||
2002-12-23 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* scripts/abilist.awk: Produce a more compact format, divided into
|
||||
stanzas for each version set, the set name listed only once.
|
||||
* scripts/extract-abilist.awk: New file.
|
||||
* scripts/merge-abilist.awk: New file.
|
||||
* Makerules (check-abi-%, update-abi-%): New pattern rules.
|
||||
(update-abi, check-abi): New targets.
|
||||
* Makefile (+subdir_targets): Add subdir_{check,update}-abi.
|
||||
|
||||
2002-12-19 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* Makerules (%.symlist): Use LC_ALL=C when running awk script.
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/brk.c (__brk): Cast result of
|
||||
INTERNAL_SYSCALL.
|
||||
|
||||
|
2
Makefile
2
Makefile
@ -61,7 +61,7 @@ endif # $(AUTOCONF) = no
|
||||
+subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
|
||||
subdir_clean subdir_distclean subdir_realclean \
|
||||
tests xtests subdir_lint.out \
|
||||
subdir_distinfo \
|
||||
subdir_update-abi subdir_check-abi subdir_distinfo \
|
||||
subdir_echo-headers subdir_echo-distinfo \
|
||||
subdir_install \
|
||||
subdir_testclean \
|
||||
|
38
Makerules
38
Makerules
@ -1130,20 +1130,52 @@ ifeq ($(versioning),yes)
|
||||
# This is handy for checking against existing library binaries.
|
||||
|
||||
%.symlist: $(..)scripts/abilist.awk %.dynsym
|
||||
$(AWK) -f $^ > $@T
|
||||
LC_ALL=C $(AWK) -f $^ > $@T
|
||||
mv -f $@T $@
|
||||
|
||||
%.dynsym: %.so
|
||||
$(OBJDUMP) --dynamic-syms $< > $@T
|
||||
mv -f $@T $@
|
||||
|
||||
tests: $(patsubst %.so,$(objpfx)%.symlist,$(install-lib.so-versioned))
|
||||
vpath %.symlist $(objpfx) $(common-objpfx)
|
||||
check-abi-%: $(..)scripts/extract-abilist.awk $(common-objpfx)config.make \
|
||||
%.abilist %.symlist
|
||||
LC_ALL=C \
|
||||
$(AWK) -f $< \
|
||||
-v 'config=$(config-machine)-$(config-vendor)-$(config-os)' \
|
||||
$(filter %.abilist,$^) \
|
||||
| diff -pu0 - $(filter %.symlist,$^)
|
||||
|
||||
update-abi-%: $(..)scripts/merge-abilist.awk %.abilist %.symlist
|
||||
ifndef update-abi-config
|
||||
@echo 'Run $(MAKE) $@ update-abi-config=REGEXP'; exit 2
|
||||
else
|
||||
LC_ALL=C $(AWK) -v config=$(update-abi-config) -f $^ > $*.abilist.new
|
||||
mv -f $*.abilist.new $*.abilist
|
||||
@echo '*** Now check $*.abilist changes for correctness ***'
|
||||
endif
|
||||
|
||||
.PHONY: update-abi check-abi
|
||||
update-abi: $(patsubst %.so,update-abi-%,$(install-lib.so-versioned))
|
||||
check-abi: $(patsubst %.so,check-abi-%,$(install-lib.so-versioned))
|
||||
ifdef subdir
|
||||
subdir_check-abi: check-abi
|
||||
subdir_update-abi: update-abi
|
||||
else
|
||||
check-abi: subdir_check-abi
|
||||
update-abi: subdir_update-abi
|
||||
endif
|
||||
|
||||
# Enable this well all the .abilist files are in place.
|
||||
#tests: check-abi
|
||||
generated += $(install-lib.so-versioned:.so=.symlist)
|
||||
|
||||
ifeq ($(subdir),elf)
|
||||
tests: $(common-objpfx)libc.symlist
|
||||
check-abi: check-abi-libc
|
||||
update-abi: update-abi-libc
|
||||
common-generated += libc.symlist
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
.PHONY: TAGS
|
||||
|
@ -1,8 +1,6 @@
|
||||
# This awk script processes the output of objdump --dynamic-syms
|
||||
# into a simple format that should not change when the ABI is not changing.
|
||||
|
||||
BEGIN { outpipe = "sort" }
|
||||
|
||||
# Normalize columns.
|
||||
/^[0-9a-fA-F]+ / { sub(/ /, " - ") }
|
||||
|
||||
@ -13,7 +11,7 @@ $4 == "*UND*" { next }
|
||||
$2 == "l" { next }
|
||||
|
||||
$2 == "g" || $2 == "w" && NF == 7 {
|
||||
weak = ($2 == "w") ? "weak" : "strong";
|
||||
weak = $2;
|
||||
type = $3;
|
||||
size = $5;
|
||||
sub(/^0*/, "", size);
|
||||
@ -25,24 +23,36 @@ $2 == "g" || $2 == "w" && NF == 7 {
|
||||
if (version == "GLIBC_PRIVATE") next;
|
||||
|
||||
if (type == "D" && $4 == ".tbss") {
|
||||
print symbol, version, weak, "TLS", size | outpipe;
|
||||
type = "T";
|
||||
}
|
||||
else if (type == "D" && $4 == ".opd") {
|
||||
print symbol, version, weak, "FDESC" | outpipe;
|
||||
type = "O";
|
||||
size = "";
|
||||
}
|
||||
else if (type == "DO" && $4 == "*ABS*") {
|
||||
print symbol, version, weak, "ABS" | outpipe;
|
||||
type = "A";
|
||||
size = "";
|
||||
}
|
||||
else if (type == "DO") {
|
||||
print symbol, version, weak, "DATA", size | outpipe;
|
||||
type = "D";
|
||||
}
|
||||
else if (type == "DF") {
|
||||
print symbol, version, weak, "FUNC" | outpipe;
|
||||
type = "F";
|
||||
size = "";
|
||||
}
|
||||
else {
|
||||
print symbol, version, weak, "UNEXPECTED", type, $4, $5;
|
||||
print symbol, version, weak, "?", type, $4, $5;
|
||||
next;
|
||||
}
|
||||
|
||||
desc = " " symbol " " (weak == "w" ? tolower(type) : type) size;
|
||||
|
||||
if (version in versions) {
|
||||
versions[version] = versions[version] "\n" desc;
|
||||
}
|
||||
else {
|
||||
versions[version] = desc;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
@ -52,3 +62,43 @@ NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
|
||||
{
|
||||
print "Don't grok this line:", $0
|
||||
}
|
||||
|
||||
END {
|
||||
nverlist = 0;
|
||||
for (version in versions) {
|
||||
if (nverslist == 0) {
|
||||
verslist = version;
|
||||
nverslist = 1;
|
||||
continue;
|
||||
}
|
||||
split(verslist, s, "\n");
|
||||
if (version < s[1]) {
|
||||
verslist = version;
|
||||
for (i = 1; i <= nverslist; ++i) {
|
||||
verslist = verslist "\n" s[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
verslist = s[1];
|
||||
for (i = 2; i <= nverslist; ++i) {
|
||||
if (version < s[i]) break;
|
||||
verslist = verslist "\n" s[i];
|
||||
}
|
||||
verslist = verslist "\n" version;
|
||||
for (; i <= nverslist; ++i) {
|
||||
verslist = verslist "\n" s[i];
|
||||
}
|
||||
}
|
||||
++nverslist;
|
||||
}
|
||||
|
||||
split(verslist, order, "\n");
|
||||
for (i = 1; i <= nverslist; ++i) {
|
||||
version = order[i];
|
||||
|
||||
print version;
|
||||
outpipe = "sort";
|
||||
print versions[version] | outpipe;
|
||||
close(outpipe);
|
||||
}
|
||||
}
|
||||
|
44
scripts/extract-abilist.awk
Normal file
44
scripts/extract-abilist.awk
Normal file
@ -0,0 +1,44 @@
|
||||
# awk script to extract a config-specific .symlist file from a merged file.
|
||||
# This must be passed run with awk -v config=TUPLE to specify the configuration
|
||||
# tuple we will match. The merged file contains stanzas in the form:
|
||||
# GLIBC_x.y regexp...
|
||||
# function F
|
||||
# variable D 0x4
|
||||
# Each regexp is matched against TUPLE, and only matching stanzas go
|
||||
# into the output, with the regexp list removed. The result matches the
|
||||
# original .symlist file from abilist.awk that was fed into merge-abilist.awk.
|
||||
|
||||
BEGIN {
|
||||
outpipe = "";
|
||||
}
|
||||
|
||||
/^ / { if (!ignore) print | outpipe; next; }
|
||||
|
||||
{
|
||||
for (i = 2; i <= NF; ++i) {
|
||||
regex = "^" $i "$";
|
||||
if (match(config, regex) != 0) {
|
||||
if ($1 != version) {
|
||||
if (outpipe != "") {
|
||||
close(outpipe);
|
||||
}
|
||||
version = $1;
|
||||
print version;
|
||||
outpipe = "sort";
|
||||
}
|
||||
ignore = 0;
|
||||
next;
|
||||
}
|
||||
}
|
||||
ignore = 1;
|
||||
next;
|
||||
}
|
||||
|
||||
END {
|
||||
if (outpipe == "") {
|
||||
print "No stanza matched", config > "/dev/stderr";
|
||||
exit 2;
|
||||
}
|
||||
else
|
||||
close(outpipe);
|
||||
}
|
129
scripts/merge-abilist.awk
Normal file
129
scripts/merge-abilist.awk
Normal file
@ -0,0 +1,129 @@
|
||||
# awk script to merge a config-specific .symlist file with others.
|
||||
# The input files should be an existing .abilist file, and a .symlist file.
|
||||
# This must be passed run with awk -v config=REGEXP to specify a regexp
|
||||
# matching configuration tuples for which the .symlist input defines an ABI.
|
||||
# The result merges all duplicate occurrences of any symbol in a version set
|
||||
# into a stanza listing the regexps matching configurations that contain it.
|
||||
|
||||
/^[^ ]/ {
|
||||
if (NF < 2 && config == "") {
|
||||
print "BAD LINE:", $0 > "/dev/stderr";
|
||||
exit 2;
|
||||
}
|
||||
|
||||
if (NF < 2) {
|
||||
current = $1 ":" config;
|
||||
}
|
||||
else {
|
||||
current = $1 ":" $2;
|
||||
for (i = 3; i <= NF; ++i) {
|
||||
current = current "," $1 ":" $i;
|
||||
}
|
||||
}
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
{
|
||||
if ($0 in seen) {
|
||||
seen[$0] = seen[$0] "\n" current;
|
||||
}
|
||||
else {
|
||||
seen[$0] = current;
|
||||
}
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
END {
|
||||
for (line in seen) {
|
||||
split(seen[line], setlist, "\n");
|
||||
for (i in setlist) {
|
||||
split(setlist[i], configs, ",");
|
||||
for (j in configs) {
|
||||
split(configs[j], temp, ":");
|
||||
version = temp[1];
|
||||
conf = temp[2];
|
||||
|
||||
if ((version,conf) in have) continue;
|
||||
have[version,conf] = 1;
|
||||
|
||||
if (version in confs) {
|
||||
split(confs[version], c, " ");
|
||||
if (conf < c[1]) {
|
||||
confs[version] = conf;
|
||||
for (k = 1; k <= nconfs[version]; ++k) {
|
||||
confs[version] = confs[version] " " c[k];
|
||||
}
|
||||
}
|
||||
else {
|
||||
confs[version] = c[1];
|
||||
for (k = 2; k <= nconfs[version]; ++k) {
|
||||
if (conf < c[k]) break;
|
||||
confs[version] = confs[version] " " c[k];
|
||||
}
|
||||
confs[version] = confs[version] " " conf;
|
||||
for (; k <= nconfs[version]; ++k) {
|
||||
confs[version] = confs[version] " " c[k];
|
||||
}
|
||||
}
|
||||
++nconfs[version];
|
||||
}
|
||||
else {
|
||||
confs[version] = conf;
|
||||
nconfs[version] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (idx in have) delete have[idx];
|
||||
|
||||
for (version in confs) {
|
||||
idx = version " " confs[version];
|
||||
if (idx in final) {
|
||||
final[idx] = final[idx] "\n" line;
|
||||
}
|
||||
else {
|
||||
final[idx] = line;
|
||||
}
|
||||
delete confs[version];
|
||||
delete nconfs[version];
|
||||
}
|
||||
}
|
||||
|
||||
nstanzas = 0;
|
||||
for (stanza in final) {
|
||||
if (nstanzas == 0) {
|
||||
stanzas = stanza;
|
||||
nstanzas = 1;
|
||||
continue;
|
||||
}
|
||||
split(stanzas, s, "\n");
|
||||
if (stanza < s[1]) {
|
||||
stanzas = stanza;
|
||||
for (i = 1; i <= nstanzas; ++i) {
|
||||
stanzas = stanzas "\n" s[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
stanzas = s[1];
|
||||
for (i = 2; i <= nstanzas; ++i) {
|
||||
if (stanza < s[i]) break;
|
||||
stanzas = stanzas "\n" s[i];
|
||||
}
|
||||
stanzas = stanzas "\n" stanza;
|
||||
for (; i <= nstanzas; ++i) {
|
||||
stanzas = stanzas "\n" s[i];
|
||||
}
|
||||
}
|
||||
++nstanzas;
|
||||
}
|
||||
|
||||
split(stanzas, order, "\n");
|
||||
for (i = 1; i <= nstanzas; ++i) {
|
||||
stanza = order[i];
|
||||
print stanza;
|
||||
outpipe = "sort";
|
||||
print final[stanza] | outpipe;
|
||||
close(outpipe);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user