On Mon, Jan 30, 2023 at 02:09:18PM +0100, Petr Pisar wrote:
> V Sat, Jan 28, 2023 at 06:12:11PM -0800, Gordon Messmer napsal(a):
> > 
> > I don't think convincing hundreds or thousands of developers to add symbol
> > versioning to their libraries is a viable solution. I'd love to see it
> > happen, but rpm/dnf should be more reliable in the meantime.
> > 
> Is symbol versioning portable across toolchains? I.e. is the linker script
> with symbol aliases understandible by other tools than (llvm|gcc)+binutils?
> I speak about upstreams who do not want to impede building e.g. on FreeBSD,
> Windows, or Solaris.

It only applies to ELF platforms.  It also works fine with Clang.

FreeBSD uses ELF but their linker has issues with wildcards in the
linker script so we had to disable it there:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851

macOS doesn't use ELF and doesn't support linker scripts, so obviously
disabled there too.

Windows (PE) linking has entirely its own set of complexities and
strangeness, but I don't think there's anything quite like symbol
versioning.

Symbol versioning makes it tricky to backport an upstream patch to
downstream (eg. to RHEL) if the patch adds a new API.  You have to
decide whether or not to add a new version to the linker script or put
the symbol into one of the old sections, and I seem to recollect there
is no always good answer.

Nevertheless I think symbol versioning is a worthwhile thing to do.

Some examples of projects using linker scripts and/or symbol
versioning:

https://gitlab.com/nbdkit/nbdkit
 - linker script only, to hide symbols

https://gitlab.com/nbdkit/libnbd
 - linker script + versioning, everything is generated from a
   machine-readable description of the API

https://gitlab.com/libvirt/libvirt
 - extensive use of linker scripts + symbol versioning, see the src/*.syms
   files

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to