On Tue, 2020-04-14 at 17:25 +0200, Mark Wielaard wrote: > On Fri, 2020-04-10 at 21:42 +0200, Mark Wielaard wrote: > > GCC 10 introduces a function attribute to define symbol versioning. > > Add a configure check to see if __attribute__((symver)) is supported. > > If it is then define the OLD_VERSION, NEW_VERSION, COMPAT_VERSION > > and COMPAT_VERSION_NEWPROTO macros using just attribute symver, > > attribute alias and typeof function names. And avoid defining symbols > > in asm statements. > > Turns out this almost, but not completely work. > > > +#define NEW_VERSION(name, version) \ > > + __attribute__((__symver__(#name "@@" #version))) \ > > + __typeof__ ( name ) name ; > > Using the two @@ variant keeps the original name in the symbol table, > which will cause that symbol to be doubly marked as a version symbol my > the linker. We really need the tripple @@@ variant which will actually > rename and remove the original non-versioned name. But gcc10 > attribute((symver)) only accepts the single and double @ variants. > > I am looking how to work around this. The gcc function attribute > documentation implies that you shouldn't use the bare non-versioned > symbol name, but that is precisely what we do (so we don't have to mark > up each symbol, but can simply rely on the linker version map script). > > Back to the drawing board... OK, I found a workaround, as attached. It feels a bit like a hack, but seems to do what is expected. Cheers, Mark