Versioned symbols for 3.0?
- From: Patryk Zawadzki <patrys pld-linux org>
- To: desktop-devel-list <desktop-devel-list gnome org>
- Subject: Versioned symbols for 3.0?
- Date: Tue, 18 May 2010 17:24:32 +0200
Today Elan Ruusamäe and me spent some time making glibc compile with
versioned interfaces for exported symbols.
The ultimate goal is being able to automatically detect at link time
that program A requires library B implementing at least version X of
the interface and embedding such information in packages
automatically. Just like we do for glibc with its GLIBC_x_y
interfaces.
The changes required for glibc was:
1) removing the -export-symbols-regex "^g.*" passed to libtool
2) adding -Wl,-version-script=libglib-2.0.ver to libglib_2_0_la_LDFLAGS
3) creating the .ver file
A sample file (marking just one symbol as GLIB_2_24 for demonstration
purposes) looks like that:
- 8< - - - - - - - - -
GLIB_2 {
global:
g_*;
local:
*;
};
GLIB_2_24 {
global:
g_malloc_n;
} GLIB_2;
- 8< - - - - - - - - -
The resulting objdump:
- 8< - - - - - - - - -
...
0000000000049770 g DF .text 0000000000000039 GLIB_2
g_option_context_get_help_enabled
00000000000508c0 g DF .text 0000000000000180 GLIB_2
g_random_double_range
00000000000377b0 g DF .text 0000000000000184 GLIB_2
g_key_file_get_boolean
0000000000016820 g DF .text 0000000000000005 GLIB_2 g_byte_array_unref
00000000000398c0 g DF .text 0000000000000032 GLIB_2 g_list_position
0000000000030330 g DF .text 000000000000003f GLIB_2 g_io_channel_ref
0000000000044810 g DF .text 000000000000006d GLIB_2_24 g_malloc_n
...
- 8< - - - - - - - - -
And in turn we can track the required interface versions while
maintaining an ABI-stable library. Another useful feature of
introducing versioned interfaces is being able to become
ABI-complatible while breaking API compatibility (you .symver g_foo at
GLIB_2_24 to call g_deprecated_foo and remove the g_foo symbol from
GLIB_2_26).
I'd like to propose adapting versioned symbols across the stack as
soon as possible. Keep in mind it'll probably break the existing ABI -
didn't test that yet - so "as soon as possible" might mean "during the
nearest ABI break".
--
Patryk Zawadzki
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]