#!/bin/sh -e ## 200-hjl-ld-env.dpatch ## ## DP: Description: Handle LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS env vars ## DP: Author: H.J. Lu ## DP: Upstream status: hjl 2.17.50.0.18 ## DP: Original patch: ld-env-6.patch if [ $# -ne 1 ]; then echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1 fi [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts patch_opts="${patch_opts:--f --no-backup-if-mismatch}" case "$1" in -patch) patch $patch_opts -p1 < $0;; -unpatch) patch $patch_opts -p1 -R < $0;; *) echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1;; esac exit 0 2007-01-24 H.J. Lu * NEWS: Mention LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS. * ld.texinfo: Document LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS. * ldmain.c (main): Handle LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS. @DPATCH@ diff -urNad binutils-2.18~cvs20070812~/ld/NEWS binutils-2.18~cvs20070812/ld/NEWS --- binutils-2.18~cvs20070812~/ld/NEWS 2007-08-12 10:00:32.000000000 +0200 +++ binutils-2.18~cvs20070812/ld/NEWS 2007-08-12 13:09:23.000000000 +0200 @@ -1,6 +1,9 @@ -*- text -*- Changes in 2.18: +* ELF: Support environment variables, LD_SYMBOLIC for -Bsymbolic and + LD_SYMBOLIC_FUNCTIONS for -Bsymbolic-functions. + * Linker sources now released under version 3 of the GNU General Public License. diff -urNad binutils-2.18~cvs20070812~/ld/ld.texinfo binutils-2.18~cvs20070812/ld/ld.texinfo --- binutils-2.18~cvs20070812~/ld/ld.texinfo 2007-07-25 16:56:22.000000000 +0200 +++ binutils-2.18~cvs20070812/ld/ld.texinfo 2007-08-12 13:08:46.000000000 +0200 @@ -1142,14 +1142,21 @@ definition within the shared library, if any. Normally, it is possible for a program linked against a shared library to override the definition within the shared library. This option is only meaningful on ELF -platforms which support shared libraries. +platforms which support shared libraries. If @option{-Bsymbolic} is not +used when linking a shared library, the linker will also turn on this +option if the environment variable @code{LD_SYMBOLIC} is set. @kindex -Bsymbolic-functions @item -Bsymbolic-functions When creating a shared library, bind references to global function symbols to the definition within the shared library, if any. This option is only meaningful on ELF platforms which support shared -libraries. +libraries. If @option{-Bsymbolic-functions} is not used when linking a +shared library, the linker will also turn on this option if the +environment variable @code{LD_SYMBOLIC_FUNCTIONS} is set. When +both environment variables @code{LD_SYMBOLIC} and +@code{LD_SYMBOLIC_FUNCTIONS} are set, @code{LD_SYMBOLIC} will take +precedent. @kindex --dynamic-list=@var{dynamic-list-file} @item --dynamic-list=@var{dynamic-list-file} diff -urNad binutils-2.18~cvs20070812~/ld/ldmain.c binutils-2.18~cvs20070812/ld/ldmain.c --- binutils-2.18~cvs20070812~/ld/ldmain.c 2007-07-06 16:09:41.000000000 +0200 +++ binutils-2.18~cvs20070812/ld/ldmain.c 2007-08-12 13:08:46.000000000 +0200 @@ -254,6 +254,11 @@ command_line.warn_search_mismatch = TRUE; command_line.check_section_addresses = TRUE; + if (getenv ("LD_SYMBOLIC") != NULL) + command_line.symbolic = symbolic; + else if (getenv ("LD_SYMBOLIC_FUNCTIONS") != NULL) + command_line.symbolic = symbolic_functions; + /* We initialize DEMANGLING based on the environment variable COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the output of the linker, unless COLLECT_NO_DEMANGLE is set in the