After I'm done with supporting Sun symbol versioning in the currently versioned GCC runtime libraries, I've started investigating versioning the remaining unversioned ones.
One of them is libffi.so.4. To start, I've looked at the global symbols in the library with $ nm -Pgn libffi.so.4 | awk '$2 !~ /U/ {print $1}' on i386-pc-solaris2.11. Here's what I found: __bss_start created by gld _edata dto. _end dto. _etext dto. _fini dto. _init dto. _lib_version imported from values-*.o ffi_assert ffi_common.h [FFI_DEBUG] ffi_call libffi.texi ffi_call_SYSV implementation detail ffi_closure_alloc libffi.texi ffi_closure_free libffi.texi ffi_java_ptrarray_to_raw ffi.h.in ffi_java_raw_size ffi.h.in ffi_java_raw_to_ptrarray ffi.h.in ffi_prep_args implementation detail ffi_prep_cif libffi.texi ffi_prep_cif_machdep ffi_common.h ffi_prep_closure libffi.texi (deprecated) ffi_prep_closure_loc libffi.texi ffi_prep_raw_closure ffi.h.in ffi_prep_raw_closure_loc libffi.texi ffi_ptrarray_to_raw ffi.h.in ffi_raw_call ffi.h.in ffi_raw_size ffi.h.in ffi_raw_to_ptrarray ffi.h.in ffi_stop_here ffi_common.h [FFI_DEBUG], unused ffi_type_double libffi.texi ffi_type_float libffi.texi ffi_type_longdouble libffi.texi ffi_type_pointer libffi.texi ffi_type_sint16 libffi.texi ffi_type_sint32 libffi.texi ffi_type_sint64 libffi.texi ffi_type_sint8 libffi.texi ffi_type_test ffi_common.h [FFI_DEBUG] ffi_type_uint16 libffi.texi ffi_type_uint32 libffi.texi ffi_type_uint64 libffi.texi ffi_type_uint8 libffi.texi ffi_type_void libffi.texi So obviosly the public ABI consists solely of symbols starting with ffi_ (quel surprise :-). * Those tagged libffi.texi are part of the documented API and thus are part of the ABI, too. * Those tagged with ffi.h.in are also part of the public API, though not yet properly documented ;-( * Some symbols are declared in ffi_common.h inside FFI_DEBUG blocks, but are obviously internal and don't belong to the ABI. * ffi_call_SYSV, ffi_prep_args, ffi_prep_cif_machdep are implementation details and shouldn't be exported. With this in place, I've provided an initial version map below, grouped into Base API, Types, Closure API, Raw API, and Java raw API. There are two open issues: * ffi_prep_closure (and thus ffi_prep_raw_closure and ffi_prep_java_raw_closure) are documented as deprecated. They shouldn't probably be part of the FFI_4.0 version, but rather moved into a (say) FFI_3.0 version which FFI_4.0 inherits from. Ok? * There's a problem with the Java Raw API functions: src/java_raw_api.c implements them (ffi_java_raw_call and ffi_prep_java_raw_closure*) only if !FFI_NATIVE_RAW_API, which is false on x86. Thus we are left without an implementation. Is this supposed to be so? With the version map below in place, I could rebuild libffi.so.4 and rerun the testsuite without failures, so it seems like a reasonable start. Comments? If this is deemed acceptable, I'll probably go ahead and implement proper support for this in libffi, but only after providing a common symbol versioning infrastructure in GCC instead of again duplicating what we already have in several runtime libraries. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University # FIXME: # * How to handle deprecated functions (at least ffi_prep_closure, # probably also ffi_prep_raw_closure and ffi_prep_java_raw_closure? # * How to name the version anyway? (cf. libgcc_s.so.1, others) # * Determine status of missing functions. # * Perhaps group symbols instead of sorting alphabetically? # cf. libffi.texi: base API, types, closure API, raw API, Java raw API FFI_4.0 { global: # Base API ffi_call; ffi_prep_cif; # Types ffi_type_double; ffi_type_float; ffi_type_longdouble; ffi_type_pointer; ffi_type_sint16; ffi_type_sint32; ffi_type_sint64; ffi_type_sint8; ffi_type_uint16; ffi_type_uint32; ffi_type_uint64; ffi_type_uint8; ffi_type_void; # Closure API ffi_closure_alloc; ffi_closure_free; ffi_prep_closure; ffi_prep_closure_loc; # Raw API ffi_prep_raw_closure; ffi_prep_raw_closure_loc; ffi_ptrarray_to_raw; ffi_raw_call; ffi_raw_size; ffi_raw_to_ptrarray; # Java Raw API ffi_java_ptrarray_to_raw; # src/java_raw_api.c implements ffi_java_raw_call only if # !FFI_NATIVE_RAW_API, which is false on x86. #ffi_java_raw_call; #ffi_prep_java_raw_closure; #ffi_prep_java_raw_closure_loc; ffi_java_raw_size; ffi_java_raw_to_ptrarray; local: *; };