diff --git a/Makefile.am b/Makefile.am index 4e30722e2c8fe20095038fb0b83427deebb43999..f1700629c599486328d7d3d055a91babaf01da2c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,7 +56,6 @@ uninstall-hook: # Headers to be included by shim libraries nobase_include_HEADERS += capsule/capsule-shim.h \ - capsule/_ext_dlopen.h \ capsule/_int_dlopen.h # demo program - keep this hanging around as it's a useful PoC @@ -244,7 +243,6 @@ tests/shim/%.c: tests/shim/%.excluded tests/shim/%.shared tests/shim/%.symbols d PKG_CONFIG_PATH=$(abs_builddir)/data \ V=$V \ $(top_srcdir)/data/capsule-mkstublib \ - --ext-dlopen \ --symbols-from=$(srcdir)/tests/shim/$*.symbols \ --no-update-symbols \ --runtime-tree=/host \ diff --git a/capsule/_ext_dlopen.h b/capsule/_ext_dlopen.h deleted file mode 100644 index 02fb3853cef3997b5ea5b272788e823bc064c613..0000000000000000000000000000000000000000 --- a/capsule/_ext_dlopen.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright © 2017 Collabora Ltd -// -// This file is part of libcapsule. -// -// libcapsule is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// libcapsule is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with libcapsule. If not, see <http://www.gnu.org/licenses/>. - -// Standard implementation of _ext_dlopen(), the implementation used -// when a library outside the capsule calls dlopen(). To override this -// implementation, copy this file to shim/capsule/_ext_dlopen.h in -// your shim library and modify as needed. -static void *_ext_dlopen (const char *filename, int flag) -{ - return capsule_external_dlopen( filename, flag ); -} diff --git a/data/capsule-mkstublib b/data/capsule-mkstublib index 3d3e8e67eea2d690548c2476b0d41b5eadbf86a0..515d7b7133efcb5b9c0a475b343909618ba1d987 100755 --- a/data/capsule-mkstublib +++ b/data/capsule-mkstublib @@ -34,8 +34,6 @@ Usage: $me [OPTIONS] TARGET EXCLUDES EXPORTS OUTPUT [DSO-VERSION [TREE]]" Use replacement capsule-symbols(1) --symbols-from=PATH Use symbols from this file [default: \${OUTPUT%.c}.symbols] - --[no-]ext-dlopen Do or don't override dlopen() for - callers outside the capsule [default: don't] --[no-]update-symbols Do or don't update symbols list if EXPORTS is newer than it [default: do] --search-tree=PATH Find libraries to be proxied in this @@ -66,11 +64,10 @@ EOF exit "${1:-0}" } -ext_dlopen= update_symbols= getopt_temp="$(getopt -o 'h' \ - -l 'capsule-symbols-tool:,ext-dlopen,no-ext-dlopen,search-tree:,runtime-tree:,symbols-from:,update-symbols,no-update-symbols,help' \ + -l 'capsule-symbols-tool:,search-tree:,runtime-tree:,symbols-from:,update-symbols,no-update-symbols,help' \ -n "$me" -- "$@")" eval set -- "$getopt_temp" @@ -83,18 +80,6 @@ do continue; ;; - (--ext-dlopen) - ext_dlopen=yes; - shift; - continue; - ;; - - (--no-ext-dlopen) - ext_dlopen=; - shift; - continue; - ;; - (--runtime-tree) runtime_tree="$2" shift 2; @@ -248,21 +233,6 @@ static const char soname[] = "$proxied_dso"; // _int_dlopen() from libcapsule or a locally overridden version #include "capsule/_int_dlopen.h" -EOF - -if [ -n "$ext_dlopen" ] -then - echo '// _ext_dlopen() from libcapsule or a locally overridden version' - echo '#include "capsule/_ext_dlopen.h"' - echo '#define HAVE_EXT_DLOPEN' -else - echo '// Disabled by capsule-mkstublib --no-ext-dlopen' - echo '//#include "capsule/_ext_dlopen.h"' - echo '//#define HAVE_EXT_DLOPEN' -fi - -cat - <<EOF - // should we exclude libpthread here? // in any case, these are DSOs we do _not_ want to isolate static const char *exclude[] = @@ -310,19 +280,6 @@ static const char *invalid_dl_reloc_targets[] = NULL }; -#ifdef HAVE_EXT_DLOPEN -static capsule_item _external_dl_relocs[] = -{ - { "dlopen", - (capsule_addr) _ext_dlopen , - (capsule_addr) _ext_dlopen }, - { NULL } -}; -#define EXT_DLOPEN_WRAPPERS _external_dl_relocs -#else -#define EXT_DLOPEN_WRAPPERS capsule_external_dl_relocs -#endif - // make sure this symbol has global visibility so // that the libcapsule initialisation can find it __attribute__ ((visibility("default"))) @@ -334,7 +291,7 @@ capsule_metadata capsule_meta = .exclude = exclude, .export = valid_dlsym_sources, .nowrap = invalid_dl_reloc_targets, - .dl_wrappers = EXT_DLOPEN_WRAPPERS, + .dl_wrappers = capsule_external_dl_relocs, }; // ------------------------------------------------------------- @@ -407,7 +364,7 @@ static void __attribute__ ((constructor)) _capsule_init (void) if( rloc != 0 ) // relocation failed. we're dead. abort(); - rloc = capsule_relocate_except( cap, EXT_DLOPEN_WRAPPERS, + rloc = capsule_relocate_except( cap, capsule_external_dl_relocs, &invalid_dl_reloc_targets[0], &capsule_error ); if( rloc != 0 ) // we may survive this depending on how dlopen is used diff --git a/data/shim-Makefile.am b/data/shim-Makefile.am index 89c9bbfce108e0e673b4d7fbd1edb4a376e05142..1e9aa824245282cec8fdb5542340769c1fef069d 100644 --- a/data/shim-Makefile.am +++ b/data/shim-Makefile.am @@ -9,7 +9,7 @@ AM_CFLAGS += $(CAPSULE_CFLAGS) CAPSULE_SONAMES := @TARGET@ CAPSULE_VERSION_@AMTARGET@ := @VER@ -#AM_CAPSULE_MKSTUBLIB_FLAGS := --ext-dlopen +AM_CAPSULE_MKSTUBLIB_FLAGS := lib_LTLIBRARIES = lib@LIB@.la diff --git a/data/shim-README.in b/data/shim-README.in index 94b5d80f17aabab153c5d343feffcca64cf9f63c..15b82bec4468f1f00075936524bc29c66212c2a5 100644 --- a/data/shim-README.in +++ b/data/shim-README.in @@ -21,15 +21,7 @@ The generated library will have the same name as the main proxy target (@TARGET@). You can control the exact version number (cf libfoo.x.y.z) by setting CAPSULE_VERSION_@AMTARGET@ in Makefile.am -To make the generated library override dlopen() for callers outside the -capsule, pass --ext-dlopen to capsule-mkstublib by setting the -AM_CAPSULE_MKSTUBLIB_FLAGS variable in Makefile.am. - -If libcapsule's standard implementations of that function -is not suitable, copy capsule/_ext_dlopen.h from libcapsule's -development files into shim/capsule/, modify it as necessary, -and add it to EXTRA_DIST in Makefile.am. - -Similarly, if libcapsule's standard implementation of dlopen() for -callers inside the capsule is not suitable, copy and modify -capsule/_int_dlopen.h. +If libcapsule's standard implementation of dlopen() for callers inside +the capsule is not suitable, copy capsule/_int_dlopen.h from +libcapsule's development files into shim/capsule/, modify it as +necessary, and add it to EXTRA_DIST in Makefile.am. diff --git a/doc/Building.txt b/doc/Building.txt index c22bb715d000073d595c8848366e1d69947ab1bc..eec14c97c64551e95ea5697875c8e61249d6dbad 100644 --- a/doc/Building.txt +++ b/doc/Building.txt @@ -175,30 +175,6 @@ shim/capsule/_int_dlopen.h ⋮ } ----------------------------------------------------------------------------- -shim/capsule/_ext_dlopen.h - - This file is not created or used by default. It can be enabled by - adding --ext-dlopen to AM_CAPSULE_MKSTUBLIB_FLAGS in Makefile.am. - - The _ext_dlopen wrapper is installed in _most_ libraries outside the - capsule (notably not in the shim itself, libcapsule.so, libc.so and - a few other core libraries). It is responsible for triggering the - capsule's manual symbol relocation when a library outside the capsule - is dlopen()ed. - - If this is enabled by --ext-dlopen but the file is not present, - a default implementation provided by libcapsule is used. - See libcapsule's <capsule/_ext_dlopen.h> for that implementation. - - To use a custom implementation, create the file and implement a - function with the same signature: - - static void *_ext_dlopen (const char *filename, int flags) - { - ⋮ - } - ---------------------------------------------------------------------------- That's it - you should be ready to: diff --git a/doc/capsule-mkstublib.xml b/doc/capsule-mkstublib.xml index 79967e6db3e66d90b48387ce0405a62b0cb3ecdc..5f64311810a67810bfbe194b3c1c6629fff0d80f 100644 --- a/doc/capsule-mkstublib.xml +++ b/doc/capsule-mkstublib.xml @@ -186,21 +186,6 @@ License along with libcapsule. If not, see <http://www.gnu.org/licenses/>. </listitem> </varlistentry> - <varlistentry> - <term><option>--[no-]ext-dlopen</option></term> - <listitem> - <para> - Do or don't provide an explicit override for dlopen(3) - calls made outside the capsule in the generated - source. - </para> - <para> - [There is always an implicit override - this just - exposes the implementation for easy modification] - </para> - </listitem> - </varlistentry> - <varlistentry> <term><option>--[no]-update-symbols</option></term> <listitem>