Hi Mark,
jankratochvil/compatversion
On Mon, 29 Apr 2013 23:57:12 +0200, Mark Wielaard wrote:
> # define COMPAT_VERSION(name, version, prefix) \
> - asm (".symver _compat." #version "." #name ","
#name "@" #version); \
> + asm (".symver _compat." #version "." #name ","
#name "@" #version);
> +# define COMPAT_VERSION_SAMEPROTO(name, version, prefix) \
> + COMPAT_VERSION (name, version, prefix); \
> __typeof (name) _compat_##prefix##_##name asm ("_compat." #version
"." #name);
[...]
If I read this right then for the new COMPAT_VERSION macro we
don't define
a _compat_prefix_name symbol anymore.
A bug, thanks. I have checked now the new patch produces correct output:
Num: Value Size Type Bind Vis Ndx Name
26: 000000000000083f 242 FUNC GLOBAL DEFAULT 1
dwfl_report_elf@(a)ELFUTILS_0.156
30: 000000000000083f 242 FUNC GLOBAL HIDDEN 1 __dwfl_report_elf_internal
31: 0000000000000931 65 FUNC GLOBAL DEFAULT 1
_compat.ELFUTILS_0.122.dwfl_report_elf
32: 0000000000000931 65 FUNC GLOBAL DEFAULT 1 dwfl_report_elf(a)ELFUTILS_0.122
I think it is slightly cleaner to keep the old name do the same
thing. So have a COMPAT_VERSION macro that deals with the prototype of
the function being the same. And a new macro COMPAT_VERSION_NEWPROTO
that deals with compat functions that have different prototypes. Then
you don't have to change any existing code.
OK, changed.
Thanks,
Jan
commit fba1588ee438e47a24e92fbd378756501933d00d
Author: Jan Kratochvil <jan.kratochvil(a)redhat.com>
Date: Sun Apr 28 20:10:33 2013 +0200
New macro COMPAT_VERSION_NEWPROTO.
lib/
* eu-config.h (COMPAT_VERSION_NEWPROTO): New. Twice.
Signed-off-by: Jan Kratochvil <jan.kratochvil(a)redhat.com>
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 1fa4249..6ce3168 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-30 Jan Kratochvil <jan.kratochvil(a)redhat.com>
+
+ * eu-config.h (COMPAT_VERSION_NEWPROTO): New. Twice.
+
2013-04-26 Jan Kratochvil <jan.kratochvil(a)redhat.com>
* system.h (LE64, BE64): Move here the definitions from
diff --git a/lib/eu-config.h b/lib/eu-config.h
index 68efb82..3afff26 100644
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -170,12 +170,18 @@ asm (".section predict_data, \"aw\";
.previous\n"
".symver _compat." #version "." #name "," #name
"@" #version);
# define NEW_VERSION(name, version) \
asm (".symver " #name "," #name "@@@" #version);
+# define COMPAT_VERSION_NEWPROTO(name, version, prefix) \
+ asm (".symver _compat." #version "." #name "," #name
"@" #version); \
+ __typeof (_compat_##prefix##_##name) _compat_##prefix##_##name \
+ asm ("_compat." #version "." #name);
# define COMPAT_VERSION(name, version, prefix) \
asm (".symver _compat." #version "." #name "," #name
"@" #version); \
__typeof (name) _compat_##prefix##_##name asm ("_compat." #version
"." #name);
#else
# define OLD_VERSION(name, version) /* Nothing for static linking. */
# define NEW_VERSION(name, version) /* Nothing for static linking. */
+# define COMPAT_VERSION_NEWPROTO(name, version, prefix) \
+ error "should use #ifdef SHARED"
# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef
SHARED"
#endif