add libc.so comparision tool and add dirname bug to the buglist
authornsz <nsz@port70.net>
Mon, 8 Oct 2012 16:30:45 +0000 (18:30 +0200)
committernsz <nsz@port70.net>
Mon, 8 Oct 2012 16:30:45 +0000 (18:30 +0200)
data/posix2008.bugs
so_cmp.sh [new file with mode: 0755]

index 0aef44e..86edc8f 100644 (file)
@@ -11,3 +11,5 @@ http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_kill.html
 restrict in wcpncpy prototype is at the wrong place
 wchar_t *wcpncpy(wchar_t restrict *ws1, const wchar_t *restrict ws2, size_t n);
 
+http://pubs.opengroup.org/onlinepubs/9699919799/functions/dirname.html
+dirname of "usr/" is not specified clearly (it could be "" or "." based on the specs)
diff --git a/so_cmp.sh b/so_cmp.sh
new file mode 100755 (executable)
index 0000000..49882d0
--- /dev/null
+++ b/so_cmp.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+export LC_ALL=C
+
+D=data
+M=/lib
+G=/lib
+
+# list symbol info in tab separated format:
+# name versioning type visibility addr size Ndx lib
+syms() {
+       readelf -W -d -s $1 |awk -v lib=$1 '
+/^ *[0-9]*:/ && $5 != "LOCAL" && $7 !~ /UND|ABS/ {
+       sub(/@/," @")
+       ver = $9
+       if ($10)
+               ver = ver " " $10
+       print $8 "\t" ver "\t" $4 "\t" $5 "\t" $2 "\t" $3 "\t" $7 "\t" lib
+}' | sort |uniq
+}
+
+# all symbol info
+syms $M/libc.so >$D/so_syms_musl
+while read lib
+do
+       syms $G/$lib
+done <<EOF | sort >$D/so_syms_glibc
+libanl.so.1
+libc.so.6
+libcidn.so.1
+libcrypt.so.1
+libdl.so.2
+libm.so.6
+libnsl.so.1
+libnss_compat.so.2
+libnss_dns.so.2
+libnss_files.so.2
+libnss_hesiod.so.2
+libnss_nis.so.2
+libnss_nisplus.so.2
+libpthread.so.0
+libresolv.so.2
+librt.so.1
+libutil.so.1
+EOF
+
+# symbol name only
+awk -F'\t' '{print $1}' $D/so_syms_glibc |uniq >$D/so_syms_glibc_1
+awk -F'\t' '{print $1}' $D/so_syms_musl |uniq >$D/so_syms_musl_1
+
+# difference between musl and glibc symbols
+diff $D/so_syms_glibc_1 $D/so_syms_musl_1 >$D/so_syms_1.diff
+sed -n '/^< /s/< //p' $D/so_syms_1.diff >$D/so_syms_glibc_1_extra
+sed -n '/^> /s/> //p' $D/so_syms_1.diff >$D/so_syms_musl_1_extra
+
+# select symbol info of extra symbols only
+selsym() {
+       awk -v syms=$1 '
+BEGIN {
+       while (getline < syms == 1)
+               a[$1] = a[$1] $0 "\n"
+}
+{printf("%s",a[$1])}
+' $2
+}
+selsym $D/so_syms_glibc $D/so_syms_glibc_1_extra >$D/so_syms_glibc_extra
+selsym $D/so_syms_musl $D/so_syms_musl_1_extra >$D/so_syms_musl_extra