mailing list of musl libc
 help / color / mirror / code / Atom feed
* Symbol versioning approximation trips on compat symbols
@ 2019-01-21 17:57 Florian Weimer
  2019-01-24  1:43 ` Rich Felker
  0 siblings, 1 reply; 26+ messages in thread
From: Florian Weimer @ 2019-01-21 17:57 UTC (permalink / raw)
  To: musl

On what appears to be current Alpine Linux (musl-1.1.19-r10), the
following reproducer

######################################################################
cat > symver.c <<EOF
void
compat_function (void)
{
}
__asm__ (".symver compat_function,compat_function@SYMVER");

void
call_compat_function (void)
{
  return compat_function ();
}
EOF

echo "SYMVER { };" > symver.map

cat > main.c <<EOF
extern void call_compat_function (void);

int
main (void)
{
  call_compat_function ();
}
EOF

gcc -fpic -shared -o symver.so -Wl,--version-script=symver.map symver.c
gcc -Wl,--rpath=. -o main main.c symver.so
######################################################################

fails with:

$ ./main
Error relocating ./symver.so: compat_function: symbol not found

The problem is the compatibility symbol (one @ instead of @@).  The
dynamic linker is supposed to ignore the difference between the two, the
default vs non-default version only matters to the link editor when
processing an undefined symbol without a symbol version.

In my case, I do not need symbol interposition and therefore can work
around this, but I wonder if there is some sort of approved compile-time
or link-time check to detect this issue.  Unfortunately, the Alpine
Linux toolchain (and part of the system) is built *with* symbol
versioning support, so this does not appear to be straightforward.

The actual application does not need to make the symbol interposable, so
I can use a hidden alias within the DSO for PLT avoidance (and more
configure checks to disable all this on targets which do not support
*that*).

Thanks,
Florian


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2019-01-30 14:57 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 17:57 Symbol versioning approximation trips on compat symbols Florian Weimer
2019-01-24  1:43 ` Rich Felker
2019-01-24  9:28   ` u-uy74
2019-01-24 10:11     ` Florian Weimer
2019-01-24 11:09   ` Szabolcs Nagy
2019-01-24 11:18     ` Florian Weimer
2019-01-27  4:04       ` Rich Felker
2019-01-27  9:36         ` u-uy74
2019-01-28  6:34           ` Florian Weimer
2019-01-28  9:17             ` Timo Teras
2019-01-28 11:33               ` Szabolcs Nagy
2019-01-28 12:40             ` Szabolcs Nagy
2019-01-28 13:08             ` (OT?) Re: [musl] " u-uy74
2019-01-28 15:22               ` Markus Wichmann
2019-01-28 15:34                 ` Rich Felker
2019-01-28 15:29               ` Rich Felker
2019-01-29 17:13                 ` u-uy74
2019-01-30 14:57                   ` Rich Felker
2019-01-28 21:57             ` A. Wilcox
2019-01-28 22:52               ` Matias Fonzo
2019-01-28 23:12                 ` Zach van Rijn
2019-01-28 23:41                   ` A. Wilcox
2019-01-28 23:47                     ` Rich Felker
2019-01-29  3:22                       ` A. Wilcox
2019-01-29 19:40                         ` Matias Fonzo
2019-01-29 19:31                   ` Matias Fonzo

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).