libga68: Add symbol versions to exports

libga68/ChangeLog:

	* configure.ac: New test to determine if symbol versioning is
	supported.
	* Makefile.am: Use result of above test to add appropriate linker
	flags.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* ga68.map: New file.
	* libtool-version: New file.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
This commit is contained in:
Pietro Monteiro
2025-12-29 12:53:20 -05:00
parent 7e8034ae44
commit f426587cf9
7 changed files with 289 additions and 16 deletions

View File

@@ -44,6 +44,27 @@ endif
A68_BUILDDIR := $(shell pwd)
if LIBGA68_USE_SYMVER
if LIBGA68_USE_SYMVER_GNU
version_arg = -Wl,--version-script=$(srcdir)/ga68.map
version_dep = $(srcdir)/ga68.map
endif
if LIBGA68_USE_SYMVER_SUN
version_arg = -Wl,-M,ga68.map-sun
version_dep = ga68.map-sun
ga68.map-sun : $(srcdir)/ga68.map \
$(top_srcdir)/../contrib/make_sunver.pl \
$(libga68_la_OBJECTS) $(libga68_la_LIBADD)
perl $(top_srcdir)/../contrib/make_sunver.pl \
$(srcdir)/ga68.map \
$(libga68_la_OBJECTS) $(libga68_la_LIBADD) \
> $@ || (rm -f $@ ; exit 1)
endif
else
version_arg =
version_dep =
endif
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
@@ -111,9 +132,9 @@ libga68_la_SOURCES = libga68.c \
ga68.h
libga68_la_LIBTOOLFLAGS =
libga68_la_CFLAGS = $(LIBGA68_GCFLAGS) $(LIBGA68_BOEHM_GC_INCLUDES)
libga68_la_LDFLAGS = -version-info $(libga68_VERSION) \
$(extra_darwin_ldflags_libga68)
libga68_la_DEPENDENCIES = libga68.spec
libga68_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(version_arg) $(lt_host_flags) $(extra_darwin_ldflags_libga68)
libga68_la_DEPENDENCIES = libga68.spec $(version_dep)
libga68_la_LIBADD = $(LIBGA68_BOEHM_GC_LIBS)
# target overrides

View File

@@ -121,6 +121,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gcc-plugin.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/lthostflags.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/no-executables.m4 \
$(top_srcdir)/../config/override.m4 \
@@ -357,9 +358,9 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libga68_VERSION = @libga68_VERSION@
localedir = @localedir@
localstatedir = @localstatedir@
lt_host_flags = @lt_host_flags@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
@@ -395,6 +396,12 @@ GCC_DIR = $(TOP_GCCDIR)/gcc
A68_SRC = $(GCC_DIR)/algol68
A68_FOR_TARGET = @A68_FOR_TARGET@
A68_BUILDDIR := $(shell pwd)
@LIBGA68_USE_SYMVER_FALSE@version_arg =
@LIBGA68_USE_SYMVER_GNU_TRUE@@LIBGA68_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/ga68.map
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@version_arg = -Wl,-M,ga68.map-sun
@LIBGA68_USE_SYMVER_FALSE@version_dep =
@LIBGA68_USE_SYMVER_GNU_TRUE@@LIBGA68_USE_SYMVER_TRUE@version_dep = $(srcdir)/ga68.map
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@version_dep = ga68.map-sun
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
@@ -462,10 +469,10 @@ libga68_la_SOURCES = libga68.c \
libga68_la_LIBTOOLFLAGS =
libga68_la_CFLAGS = $(LIBGA68_GCFLAGS) $(LIBGA68_BOEHM_GC_INCLUDES)
libga68_la_LDFLAGS = -version-info $(libga68_VERSION) \
$(extra_darwin_ldflags_libga68)
libga68_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(version_arg) $(lt_host_flags) $(extra_darwin_ldflags_libga68)
libga68_la_DEPENDENCIES = libga68.spec
libga68_la_DEPENDENCIES = libga68.spec $(version_dep)
libga68_la_LIBADD = $(LIBGA68_BOEHM_GC_LIBS)
MULTISRCTOP =
MULTIBUILDTOP =
@@ -868,6 +875,13 @@ uninstall-am: uninstall-toolexeclibDATA \
.PRECIOUS: Makefile
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ga68.map-sun : $(srcdir)/ga68.map \
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ $(top_srcdir)/../contrib/make_sunver.pl \
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ $(libga68_la_OBJECTS) $(libga68_la_LIBADD)
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ perl $(top_srcdir)/../contrib/make_sunver.pl \
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ $(srcdir)/ga68.map \
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ $(libga68_la_OBJECTS) $(libga68_la_LIBADD) \
@LIBGA68_USE_SYMVER_SUN_TRUE@@LIBGA68_USE_SYMVER_TRUE@ > $@ || (rm -f $@ ; exit 1)
# target overrides
-include $(tmake_file)

1
libga68/aclocal.m4 vendored
View File

@@ -1192,6 +1192,7 @@ m4_include([../config/clang-plugin.m4])
m4_include([../config/depstand.m4])
m4_include([../config/gcc-plugin.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/lthostflags.m4])
m4_include([../config/multi.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/override.m4])

157
libga68/configure vendored
View File

@@ -638,7 +638,12 @@ LIBGA68_BOEHM_GC_LIBS
LIBGA68_BOEHM_GC_INCLUDES
LIBGA68_GCFLAGS
extra_darwin_ldflags_libga68
libga68_VERSION
LIBGA68_USE_SYMVER_SUN_FALSE
LIBGA68_USE_SYMVER_SUN_TRUE
LIBGA68_USE_SYMVER_GNU_FALSE
LIBGA68_USE_SYMVER_GNU_TRUE
LIBGA68_USE_SYMVER_FALSE
LIBGA68_USE_SYMVER_TRUE
SPEC_LIBGA68_DEPS
get_gcc_base_ver
CC_FOR_BUILD
@@ -646,6 +651,7 @@ enable_static
enable_shared
ENABLE_DARWIN_AT_RPATH_FALSE
ENABLE_DARWIN_AT_RPATH_TRUE
lt_host_flags
OTOOL64
OTOOL
LIPO
@@ -798,6 +804,7 @@ with_gnu_ld
enable_libtool_lock
enable_darwin_at_rpath
with_gcc_major_version_only
enable_symvers
enable_algol68_gc
with_target_bdw_gc
with_target_bdw_gc_include
@@ -1451,6 +1458,7 @@ Optional Features:
--enable-darwin-at-rpath
install libraries with @rpath/library-name, requires
rpaths to be added to executables
--disable-symvers disable symbol versioning for libga68
--enable-algol68-gc enable use of Boehm's garbage collector with the GNU
Algol runtime
@@ -12593,7 +12601,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12596 "configure"
#line 12604 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12699,7 +12707,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12702 "configure"
#line 12710 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12937,6 +12945,28 @@ CC="$lt_save_CC"
case $host in
*-cygwin* | *-mingw*)
# 'host' will be top-level target in the case of a target lib,
# we must compare to with_cross_host to decide if this is a native
# or cross-compiler and select where to install dlls appropriately.
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
lt_host_flags='-no-undefined -bindir "$(toolexeclibdir)"';
else
lt_host_flags='-no-undefined -bindir "$(bindir)"';
fi
;;
*)
lt_host_flags=
;;
esac
if test x$enable_darwin_at_rpath = xyes; then
ENABLE_DARWIN_AT_RPATH_TRUE=
ENABLE_DARWIN_AT_RPATH_FALSE='#'
@@ -13100,8 +13130,113 @@ fi
SPEC_LIBGA68_DEPS="$LIBS"
# libga68 soname version
libga68_VERSION=2:0:0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symbol versioning is supported" >&5
$as_echo_n "checking whether symbol versioning is supported... " >&6; }
# Check whether --enable-symvers was given.
if test "${enable_symvers+set}" = set; then :
enableval=$enable_symvers; ga68_use_symver=$enableval
else
ga68_use_symver=yes
fi
if test "x$ga68_use_symver" != xno; then
if test x$gcc_no_link = xyes; then
# If we cannot link, we cannot build shared libraries, so do not use
# symbol versioning.
ga68_use_symver=no
else
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
cat > conftest.map <<EOF
FOO_1.0 {
global: *foo*; bar; local: *;
};
EOF
if test x$gcc_no_link = xyes; then
as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ga68_use_symver=gnu
else
ga68_use_symver=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test x$ga68_use_symver = xno; then
case "$target_os" in
solaris2*)
LDFLAGS="$save_LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
# Sun ld cannot handle wildcards and treats all entries as undefined.
cat > conftest.map <<EOF
FOO_1.0 {
global: foo; local: *;
};
EOF
if test x$gcc_no_link = xyes; then
as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ga68_use_symver=sun
else
ga68_use_symver=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
;;
esac
fi
LDFLAGS="$save_LDFLAGS"
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ga68_use_symver" >&5
$as_echo "$ga68_use_symver" >&6; }
if test "x$ga68_use_symver" != xno; then
LIBGA68_USE_SYMVER_TRUE=
LIBGA68_USE_SYMVER_FALSE='#'
else
LIBGA68_USE_SYMVER_TRUE='#'
LIBGA68_USE_SYMVER_FALSE=
fi
if test "x$ga68_use_symver" = xgnu; then
LIBGA68_USE_SYMVER_GNU_TRUE=
LIBGA68_USE_SYMVER_GNU_FALSE='#'
else
LIBGA68_USE_SYMVER_GNU_TRUE='#'
LIBGA68_USE_SYMVER_GNU_FALSE=
fi
if test "x$ga68_use_symver" = xsun; then
LIBGA68_USE_SYMVER_SUN_TRUE=
LIBGA68_USE_SYMVER_SUN_FALSE='#'
else
LIBGA68_USE_SYMVER_SUN_TRUE='#'
LIBGA68_USE_SYMVER_SUN_FALSE=
fi
# The Boehm GC
@@ -13477,6 +13612,18 @@ if test -z "${ENABLE_DARWIN_AT_RPATH_TRUE}" && test -z "${ENABLE_DARWIN_AT_RPATH
as_fn_error $? "conditional \"ENABLE_DARWIN_AT_RPATH\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGA68_USE_SYMVER_TRUE}" && test -z "${LIBGA68_USE_SYMVER_FALSE}"; then
as_fn_error $? "conditional \"LIBGA68_USE_SYMVER\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGA68_USE_SYMVER_GNU_TRUE}" && test -z "${LIBGA68_USE_SYMVER_GNU_FALSE}"; then
as_fn_error $? "conditional \"LIBGA68_USE_SYMVER_GNU\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGA68_USE_SYMVER_SUN_TRUE}" && test -z "${LIBGA68_USE_SYMVER_SUN_FALSE}"; then
as_fn_error $? "conditional \"LIBGA68_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0

View File

@@ -155,6 +155,7 @@ AC_PROG_INSTALL
# Initialize libtool.
LT_INIT
ACX_LT_HOST_FLAGS
AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
@@ -162,7 +163,7 @@ AC_SUBST(enable_shared)
AC_SUBST(enable_static)
# Do compilation tests using the C compiler and preprocessor.
AC_LANG_C([C])
AC_LANG([C])
# Allow the user to set CC_FOR_BUILD in the environment.
CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
@@ -179,9 +180,51 @@ GCC_BASE_VER
SPEC_LIBGA68_DEPS="$LIBS"
AC_SUBST(SPEC_LIBGA68_DEPS)
# libga68 soname version
libga68_VERSION=2:0:0
AC_SUBST(libga68_VERSION)
AC_MSG_CHECKING([whether symbol versioning is supported])
AC_ARG_ENABLE(symvers,
AS_HELP_STRING([--disable-symvers],
[disable symbol versioning for libga68]),
ga68_use_symver=$enableval,
ga68_use_symver=yes)
if test "x$ga68_use_symver" != xno; then
if test x$gcc_no_link = xyes; then
# If we cannot link, we cannot build shared libraries, so do not use
# symbol versioning.
ga68_use_symver=no
else
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
cat > conftest.map <<EOF
FOO_1.0 {
global: *foo*; bar; local: *;
};
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
[ga68_use_symver=gnu],[ga68_use_symver=no])
if test x$ga68_use_symver = xno; then
case "$target_os" in
solaris2*)
LDFLAGS="$save_LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
# Sun ld cannot handle wildcards and treats all entries as undefined.
cat > conftest.map <<EOF
FOO_1.0 {
global: foo; local: *;
};
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
[ga68_use_symver=sun],[ga68_use_symver=no])
;;
esac
fi
LDFLAGS="$save_LDFLAGS"
fi
fi
AC_MSG_RESULT($ga68_use_symver)
AM_CONDITIONAL(LIBGA68_USE_SYMVER, [test "x$ga68_use_symver" != xno])
AM_CONDITIONAL(LIBGA68_USE_SYMVER_GNU, [test "x$ga68_use_symver" = xgnu])
AM_CONDITIONAL(LIBGA68_USE_SYMVER_SUN, [test "x$ga68_use_symver" = xsun])
# The Boehm GC

41
libga68/ga68.map Normal file
View File

@@ -0,0 +1,41 @@
LIBGA68_2.0 {
global:
_libga68_assert;
_libga68_bitsboundserror;
_libga68_bounds;
_libga68_bounds_mismatch;
_libga68_derefnil;
_libga68_dim;
_libga68_invalidcharerror;
_libga68_longlongrandom;
_libga68_longrandom;
_libga68_lower_bound;
_libga68_malloc;
_libga68_posixargc;
_libga68_posixargv;
_libga68_posixclose;
_libga68_posixcreat;
_libga68_posixerrno;
_libga68_posixfconnect;
_libga68_posixfgetc;
_libga68_posixfgets;
_libga68_posixfopen;
_libga68_posixfputc;
_libga68_posixfputs;
_libga68_posixfsize;
_libga68_posixgetchar;
_libga68_posixgetenv;
_libga68_posixgets;
_libga68_posixlseek;
_libga68_posixperror;
_libga68_posixputchar;
_libga68_posixputs;
_libga68_posixstrerror;
_libga68_random;
_libga68_set_exit_status;
_libga68_u32_cmp2;
_libga68_unreachable;
_libga68_upper_bound;
local:
*;
};

6
libga68/libtool-version Normal file
View File

@@ -0,0 +1,6 @@
# This file is used to maintain libtool version info for libga68.
# See the libtool manual to understand the meaning of the fields.
# This is a separate file so that version updates don't involve re-running
# automake.
# CURRENT:REVISION:AGE
2:0:0