abi-compliance-checker
abi-compliance-checker copied to clipboard
illumos/Solaris support
Are there any chance to see illumos support in the checker? Binutils are available here, however, using elfdump could be more preferable.
Possible.
Does abi-compliance-checker --test
work on illumos?
Please post errors here if any.
Thank you.
$ abi-compliance-checker --test
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
verifying detectable C library changes
ERROR: can't compile libsample_c v.1: 'libsample_c/libsample.v1/build-log.txt'
$ cat libsample_c/libsample.v1/build-log.txt
libsample.c: In function 'returnTypeBecameConst':
libsample.c:13:64: warning: incompatible implicit declaration of built-in function 'malloc'
char* returnTypeBecameConst(int param) { return (char*)malloc(256); }
^
libsample.c: In function 'returnTypeBecameConst2':
libsample.c:14:65: warning: incompatible implicit declaration of built-in function 'malloc'
char* returnTypeBecameConst2(int param) { return (char*)malloc(256); }
^
libsample.c: In function 'returnTypeBecameConst3':
libsample.c:15:65: warning: incompatible implicit declaration of built-in function 'malloc'
char* returnTypeBecameConst3(int param) { return (char*)malloc(256); }
^
libsample.c: In function 'returnTypeBecameVolatile':
libsample.c:16:67: warning: incompatible implicit declaration of built-in function 'malloc'
char* returnTypeBecameVolatile(int param) { return (char*)malloc(256); }
^
Text relocation remains referenced
against symbol offset in file
.rodata.cst4 (section) 0x1bb /var/tmp//ccc8aqmW.o
.rodata.cst4 (section) 0x1f5 /var/tmp//ccc8aqmW.o
.rodata.cst4 (section) 0x226 /var/tmp//ccc8aqmW.o
malloc 0x28 /var/tmp//ccc8aqmW.o
malloc 0x3d /var/tmp//ccc8aqmW.o
malloc 0x52 /var/tmp//ccc8aqmW.o
malloc 0x67 /var/tmp//ccc8aqmW.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: error: ld returned 1 exit status
I don't see -fPIC -DPIC in Makefile:
$ cat Makefile
all:
gcc -shared libsample.c -o libsample.so -g -Og
test:
gcc test.c -Wl,libsample.so -o test
clean:
rm test libsample.so
If I add these options to /usr/share/abi-compliance-checker/modules/Internals/RegTests.pm , I see $ abi-compliance-checker --testUsing GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
verifying detectable C library changes preparation, please wait ... Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86) ERROR: Not implemented yet ERROR: analysis has failed
Please check the commit 9c87bdb91c373e11e9cf218122e245387e66530f. Do you have any objdump in the system?
Also please consider using https://github.com/lvc/abi-dumper (makes use of eu-readelf from Elfutils) utility to extract ABI dumps from debug-info of compared objects and then compare them by abi-compliance-checker.
Thank you.
Looks better. I have binutils.
$ abi-compliance-checker --test
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
verifying detectable C library changes
preparation, please wait ...
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
checking header(s) 1.0 ...
ERROR: some errors occurred when compiling headers
ERROR: see log for details:
/export/home/alp/tmp/logs/libsample_c/1.0/log.txt
checking header(s) 2.0 ...
ERROR: some errors occurred when compiling headers
ERROR: see log for details:
/export/home/alp/tmp/logs/libsample_c/2.0/log.txt
comparing ABIs ...
comparing APIs ...
creating compatibility report ...
result: INCOMPATIBLE (Binary: 52.3%, Source: 23%)
total "Binary" compatibility problems: 86, warnings: 49
total "Source" compatibility problems: 36, warnings: 52
see detailed report:
compat_reports/libsample_c/1.0_to_2.0/compat_report.html
ERROR: analysis has failed
In logs/libsample_c/1.0/log.txt I see:
// add includes
#include "/export/home/alp/tmp/libsample_c/libsample.v1/libsample.h"
The GCC parameters:
gcc -fdump-translation-unit -fkeep-inline-functions -c -x c++-header -fpermissive -w "/tmp/g0w9Uwlb66/dump1.h" -I/export/home/alp/tmp/libsample_c/libsample.v1
In file included from /tmp/g0w9Uwlb66/dump1.h:3:0:
/export/home/alp/tmp/libsample_c/libsample.v1/libsample.h:340:31: error: expected primary-expression before ‘int’
int testCppKeywords1(int class, int virtual, int (*new)(int));
^
/export/home/alp/tmp/libsample_c/libsample.v1/libsample.h:340:42: error: expected primary-expression before ‘int’
int testCppKeywords1(int class, int virtual, int (*new)(int));
^
/export/home/alp/tmp/libsample_c/libsample.v1/libsample.h:340:55: error: expected primary-expression before ‘int’
int testCppKeywords1(int class, int virtual, int (*new)(int));
In logs/libsample_c/2.0/log.txt:
The GCC parameters:
gcc -fdump-translation-unit -fkeep-inline-functions -c -x c++-header -fpermissive -w "/tmp/g0w9Uwlb66/dump2.h" -I/export/home/alp/tmp/libsample_c/libsample.v2
In file included from /tmp/g0w9Uwlb66/dump2.h:3:0:
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:352:31: error: expected primary-expression before ‘int’
int testCppKeywords1(int class, int virtual);
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:352:42: error: expected primary-expression before ‘int’
int testCppKeywords1(int class, int virtual);
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:353:43: error: declaration of ‘operator,’ as non-function
int testCppKeywords2(int operator, int other);
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:353:45: error: expected ‘)’ before ‘int’
int testCppKeywords2(int operator, int other);
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:353:45: error: expected initializer before ‘int’
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:354:35: error: expected ‘)’ before ‘operator’
int testCppKeywords3(int operator);
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:354:35: error: expected initializer before ‘operator’
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:355:22: error: expected type-specifier before ‘(’ token
int operator(int class, int this);
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:356:14: error: expected unqualified-id before ‘delete’
int delete(int virtual, int* this);
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:358:23: error: two or more data types in declaration of ‘type name’
int bool: 8;
^
/export/home/alp/tmp/libsample_c/libsample.v2/libsample.h:366:22: error: expected unqualified-id before ‘delete’
void delete() {
Report itself can be seen here: http://buildzone.oi-build.r61.net/compat/compat_report.html Will check on some real library a bit later.
Hello,
Thank you for quick response. I've improved support for Solaris in 31007a47094495e4e63edc5a226241ca3811701d. Also added -fPIC -DPIC
options to compile tests. Please update and try -test
again. The tool should run both C and C++ tests this time.
Thank you.
Hello. Seems to be even better (now I patched it to use exuberant-ctags):
--- abi-compliance-checker-31007a47094495e4e63edc5a226241ca3811701d/abi-compliance-checker.pl 2016-10-26 12:35:37.000000000 +0300
+++ abi-compliance-checker-31007a47094495e4e63edc5a226241ca3811701d/abi-compliance-checker.pl 2016-10-26 23:05:49.408976703 +0300
@@ -8170,6 +8170,13 @@
printMsg("WARNING", "can't find \'ectags\' program");
}
}
+ if($OSgroup eq "solaris")
+ { # use exuberant-ctags on OI
+ $CTags = get_CmdPath("exuberant-ctags");
+ if(not $CTags) {
+ printMsg("WARNING", "can't find \'exuberant-ctags\' program");
+ }
+ }
if(not $CTags) {
$CTags = get_CmdPath("ctags");
}
Unfortunately, it's highly OpenIndiana-specific (we have at least 4 different ctag executables). The output now is:
$ abi-compliance-checker --test
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
verifying detectable C library changes
preparation, please wait ...
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
checking header(s) 1.0 ...
Checking the code for C++ keywords
Using C++ compatibility mode
checking header(s) 2.0 ...
Checking the code for C++ keywords
Using C++ compatibility mode
comparing ABIs ...
comparing APIs ...
creating compatibility report ...
result: INCOMPATIBLE (Binary: 51.7%, Source: 23.9%)
total "Binary" compatibility problems: 86, warnings: 51
total "Source" compatibility problems: 38, warnings: 52
see detailed report:
compat_reports/libsample_c/1.0_to_2.0/compat_report.html
result: SUCCESS (124 problems found)
verifying detectable C++ library changes
preparation, please wait ...
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
checking header(s) 1.0 ...
checking header(s) 2.0 ...
comparing ABIs ...
comparing APIs ...
creating compatibility report ...
result: INCOMPATIBLE (Binary: 49.3%, Source: 23.9%)
total "Binary" compatibility problems: 140, warnings: 68
total "Source" compatibility problems: 78, warnings: 45
see detailed report:
compat_reports/libsample_cpp/1.0_to_2.0/compat_report.html
result: SUCCESS (218 problems found)
Reports can be found here: http://buildzone.oi-build.r61.net/compat/compat_reports/
Now I've tried on libXfont (update from 1.4.9 to 1.5.2), I know it's incompatible, as some symbols were removed. Unfortunately, abi-compliance-checker didn't detect it.
$ cat NEW.xml
<version>
1.5.2
</version>
<headers>
/export/home/alp/srcs/tests/oi-userland/components/x11/libXfont/build/prototype/i386/usr/include
</headers>
<include_paths>
/usr/include/xorg
</include_paths>
<libs>
/export/home/alp/srcs/tests/oi-userland/components/x11/libXfont/build/prototype/i386/usr/lib/xorg
</libs>
$ cat OLD.xml
cat OLD.xml
<version>
1.4.9
</version>
<headers>
/export/home/alp/srcs/oi-userland/components/x11/libXfont/build/prototype/i386/usr/include
</headers>
<include_paths>
/usr/include/xorg
</include_paths>
<libs>
/export/home/alp/srcs/oi-userland/components/x11/libXfont/build/prototype/i386/usr/lib/xorg
</libs>
$ objdump -t ~/srcs/oi-userland/components/x11/libXfont/build/prototype/i386/usr/lib/xorg/libXfont.so|grep SnfSetFormat
00026730 g F .text 0000003e SnfSetFormat
$ objdump -t ~/srcs/tests/oi-userland/components/x11/libXfont/build/prototype/i386/usr/lib/xorg/libXfont.so|grep SnfSetFormat
# nothing here
From logs/Xfont/1.4.9/log.txt and logs/Xfont/1.5.3/log.txt I see that sample program compilation failed, as not all symbols in include files were found. As for report itself, it shows verdict compatible: http://buildzone.oi-build.r61.net/lXfont.html
Alexander,
Please run this case with additional -test-dump -debug
options and share somewhere archive with ./debug/
and ./abi_dumps/
directories for debugging what is going wrong.
Thank you.
$ abi-compliance-checker -test-dump -debug
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
verifying detectable C library changes
executing perl /usr/bin/abi-compliance-checker -l libsample_c -old libsample_c/v1.xml -new libsample_c/v2.xml -cxx-incompatible -lang C -use-dumps -debug
preparation, please wait ...
running perl /usr/bin/abi-compliance-checker -dump libsample_c/v1.xml -l libsample_c -lang C -debug
running perl /usr/bin/abi-compliance-checker -dump libsample_c/v2.xml -l libsample_c -lang C -debug
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
checking header(s) 2.0 ...
checking header(s) 1.0 ...
ERROR: some errors occurred when compiling headers
ERROR: see log for details:
/export/home/alp/tmp/1/logs/libsample_c/2.0/log.txt
ERROR: some errors occurred when compiling headers
ERROR: see log for details:
/export/home/alp/tmp/1/logs/libsample_c/1.0/log.txt
creating library ABI dump ...
creating library ABI dump ...
dump path: abi_dumps/libsample_c/libsample_c_1.0.abi.tar.gz
dump path: abi_dumps/libsample_c/libsample_c_2.0.abi.tar.gz
running perl /usr/bin/abi-compliance-checker -l libsample_c -d1 abi_dumps/libsample_c/libsample_c_1.0.abi.tar.gz -d2 abi_dumps/libsample_c/libsample_c_2.0.abi.tar.gz -logging-mode a -debug
preparation, please wait ...
comparing ABIs ...
comparing APIs ...
creating compatibility report ...
result: INCOMPATIBLE (Binary: 51.1%, Source: 23.3%)
total "Binary" compatibility problems: 85, warnings: 51
total "Source" compatibility problems: 37, warnings: 52
see detailed report:
compat_reports/libsample_c/1.0_to_2.0/compat_report.html
result: SUCCESS (122 problems found)
verifying detectable C++ library changes
executing perl /usr/bin/abi-compliance-checker -l libsample_cpp -old libsample_cpp/v1.xml -new libsample_cpp/v2.xml -lang C++ -use-dumps -debug
preparation, please wait ...
running perl /usr/bin/abi-compliance-checker -dump libsample_cpp/v1.xml -l libsample_cpp -lang C++ -debug
running perl /usr/bin/abi-compliance-checker -dump libsample_cpp/v2.xml -l libsample_cpp -lang C++ -debug
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
Using GCC 4.9.4 (i386-pc-solaris2.11, target: x86)
checking header(s) 2.0 ...
checking header(s) 1.0 ...
creating library ABI dump ...
creating library ABI dump ...
dump path: abi_dumps/libsample_cpp/libsample_cpp_1.0.abi.tar.gz
dump path: abi_dumps/libsample_cpp/libsample_cpp_2.0.abi.tar.gz
running perl /usr/bin/abi-compliance-checker -l libsample_cpp -d1 abi_dumps/libsample_cpp/libsample_cpp_1.0.abi.tar.gz -d2 abi_dumps/libsample_cpp/libsample_cpp_2.0.abi.tar.gz -logging-mode a -debug
preparation, please wait ...
comparing ABIs ...
comparing APIs ...
creating compatibility report ...
result: INCOMPATIBLE (Binary: 49.3%, Source: 23.9%)
total "Binary" compatibility problems: 138, warnings: 66
total "Source" compatibility problems: 78, warnings: 45
see detailed report:
compat_reports/libsample_cpp/1.0_to_2.0/compat_report.html
result: SUCCESS (216 problems found)
Tar file with debug and and abi_dumps directories is here: http://buildzone.oi-build.r61.net/compat/debug-abi.tar.gz Or do you mean there's a way to run Xfont case with abi dump debug?
Xfont case debug is here: http://buildzone.oi-build.r61.net/compat/Xfont-debug.tar
Alexander,
Thanks for debug info.
Looks like some symbols (including SnfSetFormat
) are not included to the translation unit dump due to compilation errors. It's necessary to provide the following options of the XML descriptor to fix all the errors:
<include_preamble>
... (list of headers that should be included before others, one per line)
</include_preamble>
<gcc_options>
... (list of necessary GCC options, one per line)
</gcc_options>
<include_paths>
... (list of necessary include paths if the tool generated incorrect ones, one per line)
</include_paths>
<skip_headers>
... (list of headers to skip, one per line)
</skip_headers>
This is a drawback of the approach relative to the analysis of DWARF debug-info in shared objects (see https://github.com/lvc/abi-dumper). But this approach allows to check 100% of source compatibility rules and also allows to analyze libraries with closed source.
Thank you.