build: Generate the map file from the configured ABI

Some linkers require the map file definitions to contain only symbols
that are present on the linked object, either in the map file or in the
sym file we generate from the map file.

This is preparatory work to be able to conditionally include symbols
in the man and sym files depending on the ABI definitions.
This commit is contained in:
Guillem Jover 2024-02-11 19:35:05 +01:00
parent 10920c3084
commit 19e06407eb
3 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ ChangeLog
*.gcda
*.gcno
*.sym
*.map
.dirstamp
.deps/
.libs/

View File

@ -28,7 +28,7 @@ libbsd_la_included_sources = \
CLEANFILES =
EXTRA_DIST = \
libbsd.map \
libbsd.map.in \
libbsd.pc.in \
libbsd-ctor.pc.in \
libbsd-overlay.pc.in \
@ -53,6 +53,7 @@ endif
EXTRA_libbsd_la_DEPENDENCIES = \
$(libbsd_la_included_sources) \
libbsd.map \
libbsd.map.in \
# EOL
libbsd_la_LIBADD = \
$(MD5_LIBS) \
@ -64,7 +65,7 @@ libbsd_la_LDFLAGS = \
# EOL
if HAVE_LINKER_VERSION_SCRIPT
libbsd_la_LDFLAGS += \
-Wl,--version-script=$(srcdir)/libbsd.map \
-Wl,--version-script=libbsd.map \
# EOL
else
libbsd_la_LDFLAGS += \
@ -194,12 +195,18 @@ endif
DISTCLEANFILES = \
libbsd.sym \
libbsd.map \
# EOL
libbsd_ctor_a_SOURCES = \
setproctitle_ctor.c \
# EOL
# Generate the library map file with the pre-processor to selectively include
# symbols depending on the host system, otherwise some linkers might fail.
libbsd.map: libbsd.map.in
$(CPP) $(AM_CPPFLAGS) $(CPPFLAGS) -P - <$(srcdir)/libbsd.map.in >$@
# Generate a simple libtool symbol export list to be used as a fallback if
# there is no version script support.
libbsd.sym: libbsd.map

View File

@ -1,3 +1,5 @@
#include "config.h"
LIBBSD_0.0 {
global:
arc4random;