Skip to content

Commit 41b6663

Browse files
committed
Add --exclude-libs=ALL for libtcl and libtk on Linux
In general, if libX.so depends on libY.a, we don't want libY's symbols dynamically exported by libX. We want libX's use of libY to be private. We use two mechanisms for making this happen. -fvisibility=hidden, which works on the build of libY to mark the symbols themselves as hidden in the object file, and -Wl,--exclude-libs=ALL, which works on the build of libX to instruct the linker not to re-export symbols from static libraries. We set -fvisibility=hidden on some platforms but not all. We use -Wl,--exclude-libs=ALL on the build of Python itself on all platforms, which up to this point built our only dynamic objects (bin/python and libpython). Now that libtcl and libtk are dynamic, we need to do the same thing. I'm not sure if -fvisibility=hidden actually does anything useful for us, given the use of -Wl,--exclude-libs=ALL, and I think the fact that it's only set on some platforms is an oversight and demonstrates that it's not needed. See #735, which removes it; the builds pass vaildation.
1 parent 359a430 commit 41b6663

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

cpython-unix/build-tcl.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ pushd unix
5050

5151
CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC -I${TOOLS_PATH}/deps/include"
5252
LDFLAGS="${EXTRA_TARGET_CFLAGS} -L${TOOLS_PATH}/deps/lib"
53+
if [[ "${PYBUILD_PLATFORM}" != macos* ]]; then
54+
LDFLAGS="${LDFLAGS} -Wl,--exclude-libs,ALL"
55+
fi
5356

5457
CFLAGS="${CFLAGS}" CPPFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \
5558
--build=${BUILD_TRIPLE} \

cpython-unix/build-tk.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then
2929
LDFLAGS="-L${TOOLS_PATH}/deps/lib"
3030
EXTRA_CONFIGURE_FLAGS="--enable-aqua=yes --without-x"
3131
else
32+
LDFLAGS="${LDFLAGS} -Wl,--exclude-libs,ALL"
3233
EXTRA_CONFIGURE_FLAGS="--x-includes=${TOOLS_PATH}/deps/include --x-libraries=${TOOLS_PATH}/deps/lib"
3334
fi
3435

0 commit comments

Comments
 (0)