Skip to content

Commit

Permalink
Use a more accurate name than "libtool".
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonmessmer committed Feb 26, 2023
1 parent 441504c commit e8c9844
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\
#
# Generate minimum versions for ELF libraries that don't provide
# versioned symbol?
#%_elf_provide_fallback_versions --libtool-version-fallback
#%_elf_require_fallback_versions --libtool-version-fallback
#%_elf_provide_fallback_versions --full-name-version-fallback
#%_elf_require_fallback_versions --full-name-version-fallback

# Directories whose contents should be considered as documentation.
%__docdir_path %{_datadir}/doc:%{_datadir}/man:%{_datadir}/info:%{_datadir}/gtk-doc/html:%{_datadir}/gnome/help:%{?_docdir}:%{?_mandir}:%{?_infodir}:%{?_javadocdir}:/usr/doc:/usr/man:/usr/info:/usr/X11R6/man
Expand Down
24 changes: 12 additions & 12 deletions tests/rpmbuild.at
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,9 @@ RPMDB_INIT

AT_CHECK([
runroot_other chmod a-x /data/misc/libhello.so
runroot_other ${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback /data/misc/libhello.so
runroot_other ${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback /data/misc/libhello.so
runroot_other chmod a+x /data/misc/libhello.so
runroot_other ${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback /data/misc/libhello.so
runroot_other ${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback /data/misc/libhello.so
],
[0],
[libc.so.6(GLIBC_2.2.5)(64bit)
Expand All @@ -912,9 +912,9 @@ rtld(GNU_HASH)

AT_CHECK([
runroot_other chmod a-x /data/misc/libhello.so.1.0.0
runroot_other ${RPM_CONFIGDIR}/elfdeps -P --libtool-version-fallback /data/misc/libhello.so
runroot_other ${RPM_CONFIGDIR}/elfdeps -P --full-name-version-fallback /data/misc/libhello.so
runroot_other chmod a+x /data/misc/libhello.so.1.0.0
runroot_other ${RPM_CONFIGDIR}/elfdeps -P --libtool-version-fallback /data/misc/libhello.so
runroot_other ${RPM_CONFIGDIR}/elfdeps -P --full-name-version-fallback /data/misc/libhello.so
],
[0],
[libhello.so()(64bit) = 1.0.0
Expand All @@ -926,9 +926,9 @@ AT_SKIP_IF([! $HAVE_GNU_DLFCN])
AT_CHECK([
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${RPMTEST}/data/misc
runroot_other chmod a-x /data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/helloexe
runroot_other chmod a+x /data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/helloexe
],
[0],
[libc.so.6(GLIBC_2.2.5)(64bit)
Expand All @@ -942,9 +942,9 @@ AT_SKIP_IF([! $HAVE_GNU_DLFCN])
AT_CHECK([
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${RPMTEST}/data/misc
runroot_other chmod a-x /data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/hellopie
runroot_other chmod a+x /data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/hellopie
],
[0],
[libc.so.6(GLIBC_2.2.5)(64bit)
Expand All @@ -958,9 +958,9 @@ AT_SKIP_IF([$HAVE_GNU_DLFCN])
AT_CHECK([
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${RPMTEST}/data/misc
runroot_other chmod a-x /data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/helloexe
runroot_other chmod a+x /data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/helloexe
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/helloexe
],
[0],
[libc.so.6(GLIBC_2.2.5)(64bit)
Expand All @@ -974,9 +974,9 @@ AT_SKIP_IF([$HAVE_GNU_DLFCN])
AT_CHECK([
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${RPMTEST}/data/misc
runroot_other chmod a-x /data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/hellopie
runroot_other chmod a+x /data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --libtool-version-fallback ${RPMTEST}/data/misc/hellopie
${RPM_CONFIGDIR}/elfdeps -R --full-name-version-fallback ${RPMTEST}/data/misc/hellopie
],
[0],
[libc.so.6(GLIBC_2.2.5)(64bit)
Expand Down
32 changes: 16 additions & 16 deletions tools/elfdeps.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <rpm/rpmstring.h>
#include <rpm/argv.h>

int libtool_version_fallback = 0;
int full_name_version_fallback = 0;
int soname_only = 0;
int fake_soname = 1;
int filter_soname = 1;
Expand All @@ -42,7 +42,7 @@ typedef struct elfInfo_s {
* If filename is a symlink to a path that contains ".so." followed by
* a version number, return a copy of the version number.
*/
static char *getLibtoolVer(const char *filename)
static char *getFullNameVer(const char *filename)
{
const char *so, *link_basename, *dest_basename;
char dest[PATH_MAX];
Expand Down Expand Up @@ -105,7 +105,7 @@ static char *getLibtoolVer(const char *filename)
* functions, which isn't necessarily safe, so do that in a separate
* process.
*/
static char *getLibtoolVerFromShLink(const char *filename)
static char *getFullNameVerFromShLink(const char *filename)
{
#if defined(HAVE_DLMOPEN) && defined(HAVE_DLINFO)
char dest[PATH_MAX];
Expand All @@ -129,7 +129,7 @@ static char *getLibtoolVerFromShLink(const char *filename)
if (dl_handle == NULL) _exit(EXIT_FAILURE);
if (dlinfo(dl_handle, RTLD_DI_LINKMAP, &linkmap) == -1)
_exit(EXIT_FAILURE);
version = getLibtoolVer(linkmap->l_name);
version = getFullNameVer(linkmap->l_name);
if (version)
(void) write(pipefd[1], version, strlen(version));
close(pipefd[1]);
Expand Down Expand Up @@ -245,7 +245,7 @@ static void addDep(ARGV_t *deps,

if (compare_op && fallback_ver) {
/*
* when versioned symbols aren't available, the libtool version
* when versioned symbols aren't available, the full name version
* might be used to generate a minimum dependency version.
*/
rasprintf(&dep,
Expand Down Expand Up @@ -371,17 +371,17 @@ static void processDynamic(Elf_Scn *scn, GElf_Shdr *shdr, elfInfo *ei)
if (genRequires(ei)) {
s = elf_strptr(ei->elf, shdr->sh_link, dyn->d_un.d_val);
if (s) {
char *libtool_ver = NULL;
char *full_name_ver = NULL;
/*
* If soname matches an item already in the deps, then
* it had versioned symbols and doesn't require fallback.
*/
if (libtool_version_fallback &&
if (full_name_version_fallback &&
!findSonameInDeps(ei->requires, s)) {
libtool_ver = getLibtoolVerFromShLink(s);
full_name_ver = getFullNameVerFromShLink(s);
}
addDep(&ei->requires, s, NULL, ei->marker, ">=", libtool_ver);
free(libtool_ver);
addDep(&ei->requires, s, NULL, ei->marker, ">=", full_name_ver);
free(full_name_ver);
}
}
break;
Expand Down Expand Up @@ -482,12 +482,12 @@ static int processFile(const char *fn, int dtype)
ei->soname = rstrdup(bn ? bn + 1 : fn);
}
if (ei->soname) {
char *libtool_ver = NULL;
if (libtool_version_fallback) {
libtool_ver = getLibtoolVer(fn);
char *full_name_ver = NULL;
if (full_name_version_fallback) {
full_name_ver = getFullNameVer(fn);
}
addDep(&ei->provides, ei->soname, NULL, ei->marker, "=", libtool_ver);
free(libtool_ver);
addDep(&ei->provides, ei->soname, NULL, ei->marker, "=", full_name_ver);
free(full_name_ver);
}
}

Expand Down Expand Up @@ -524,7 +524,7 @@ int main(int argc, char *argv[])
struct poptOption opts[] = {
{ "provides", 'P', POPT_ARG_VAL, &provides, -1, NULL, NULL },
{ "requires", 'R', POPT_ARG_VAL, &requires, -1, NULL, NULL },
{ "libtool-version-fallback", 0, POPT_ARG_VAL, &libtool_version_fallback, -1, NULL, NULL },
{ "full-name-version-fallback", 0, POPT_ARG_VAL, &full_name_version_fallback, -1, NULL, NULL },
{ "soname-only", 0, POPT_ARG_VAL, &soname_only, -1, NULL, NULL },
{ "no-fake-soname", 0, POPT_ARG_VAL, &fake_soname, 0, NULL, NULL },
{ "no-filter-soname", 0, POPT_ARG_VAL, &filter_soname, 0, NULL, NULL },
Expand Down

0 comments on commit e8c9844

Please sign in to comment.