summaryrefslogtreecommitdiff
path: root/Src/mkbltnmlst.sh
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2023-06-26 17:13:04 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2023-06-26 17:13:04 +0900
commita84fdd7c8f77935ecce99ff2b0bdba738821ed79 (patch)
tree06f7bc39f53284ffc53dcbf5a85f8315e79e109f /Src/mkbltnmlst.sh
parent1b9bc3441ca0e6d155243084d6e7b98925dc02cb (diff)
downloadzsh-a84fdd7c8f77935ecce99ff2b0bdba738821ed79.tar.gz
zsh-a84fdd7c8f77935ecce99ff2b0bdba738821ed79.zip
51889: fix module loading problem with full RELRO
If full RELRO (relocation read-only, one of the security enhancement methods for ELF-based systems) is used when building zsh (as in binary packages of most Linuxes), loading a module (e.g. zsh/zftp) fails unless all the modules it depends on are already loaded. With this patch the necessary modules are automatically loaded.
Diffstat (limited to 'Src/mkbltnmlst.sh')
-rw-r--r--Src/mkbltnmlst.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh
index c4611d8b3..067ecdaf9 100644
--- a/Src/mkbltnmlst.sh
+++ b/Src/mkbltnmlst.sh
@@ -76,6 +76,30 @@ for x_mod in $x_mods; do
test "x$linked" = xno && echo "#endif"
done
+# if dynamic module 'mod' with load=no has moddeps in its .mdd,
+# then output add_dep(mod, dep) for each 'dep' in moddeps.
+dyn_mods="`grep ' link=dynamic .* load=no ' $CFMOD | \
+ sed -e '/^#/d' -e 's/ .*/ /' -e 's/^name=/ /'`"
+
+for mod in $dyn_mods; do
+ modfile="`grep '^name='$mod' ' $CFMOD | \
+ sed -e 's/^.* modfile=//' -e 's/ .*//'`"
+ if test "x$modfile" = x; then
+ echo >&2 "WARNING: no name for \`$mod' in $CFMOD (ignored)"
+ continue
+ fi
+ unset moddeps
+ . $srcdir/../$modfile
+ if test -n "$moddeps"; then
+ echo '#ifdef DYNAMIC'
+ echo "/* non-linked-in known module \`$mod' */"
+ for dep in $moddeps; do
+ echo " add_dep(\"$mod\", \"$dep\");"
+ done
+ echo '#endif'
+ fi
+done
+
echo
done_mods=" "
for bin_mod in $bin_mods; do