libabigail/tests/data/test-abicompat/test7-fn-changed-app.c

16 lines
327 B
C
Raw Normal View History

Fix computing the set of exported functions and varible symbols Sinny Kumari reported that abicompat is failing to report ABI changes on a library linked to a small test program. It turned out that the code that compute if a given exported function is to be kept by looking at the white list of symbols to keep has a bug in which the versions of the symbols of the white list were not being reset as they should. Fixed thus. * src/abg-ir.cc (elf_symbol::get_name_and_version_from_id): Always set the version and name of the symbol. * src/abg-corpus.cc (corpus::exported_decls_builder::{keep_wrt_id_of_fns_to_keep, keep_wrt_id_of_vars_to_keep}): Reset the symbol name *and* version before passing it. This is redundant with the fix in elf_symbol::get_name_and_version_from_id() that always set the symbol name and version now, but I felt it makes it easier to understand the fix overall. * tests/data/test-abicompat/libtest7-fn-changed-libapp-v{0,1}.so: New test input binaries. * tests/data/test-abicompat/test7-fn-changed-app: Likewise. * tests/data/test-abicompat/test7-fn-changed-{app, libapp-v0, libapp-v1}.c: Source code of the binary test inputs above. * * tests/data/test-abicompat/test7-fn-changed-{libapp-v0, libapp-v1}.h: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-0.txt: Test input. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-abicompat.cc (int_out_specs): Add the test inputs above to the set of inputs this test harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-20 10:31:03 +00:00
// Compile this with:
// gcc -g -o test7-fn-changed-app -L. -ltest7-fn-changed-libapp-v0 test7-fn-changed-app.c
#include <stdio.h>
#include "test7-fn-changed-libapp-v0.h"
int main()
{
struct Student s = {7, "foo"};
float a = 3.5, b = 2.0;
printf ("Addition of a and b = %f\n",add(a,b));
print(s);
return 0;
}