Merging of GNU_UNIQUE symbols with different versions

Valentin Churavy vchuravy@mit.edu
Thu Nov 19 01:47:44 GMT 2020


Hi there,

I was looking at the handling of `GNU_UNIQUE` symbols in the presence of
version tags on those symbols.
I have two shared libraries that both version their symbols

 nm --with-symbol-versions -D libLLVM-11.0.0jl.so | llvm-cxxfilt | grep
"llvm::RegisterRegAlloc"
0000000007f71780 u
llvm::RegisterRegAllocBase<llvm::RegisterRegAlloc>::Registry@@JL_LLVM_11.0@
@JL_LLVM_11.0

nm --with-symbol-versions -D libLLVM-11.0.0.so | llvm-cxxfilt | grep
"llvm::RegisterRegAlloc"
00000000052188e0 u
llvm::RegisterRegAllocBase<llvm::RegisterRegAlloc>::Registry@@LLVM_11@
@LLVM_11

and I am seeing behaviour that indicates that these two symbols are mapped
onto each other.
I discussed that more in the LLVM bug report
https://bugs.llvm.org/show_bug.cgi?id=48221

Looking at the glibc source code in particular `elf/dl-lookup.c` line 234
on 807f3ea9b
https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/dl-lookup.c;h=807f3ea9b67489b3116535b7c433c774a72e4c29;hb=refs/heads/master#l234

It seems to me that the symbols are looked up by name and the code is not
checking for the symbol to be equivalent. Is my understanding correct?
If so is that the intended behaviour?

Thanks,
Valentin


More information about the Libc-help mailing list