Add a new option to the linker: --error-handling-script=<NAME>. Run the script <NAME> if an undefined symbol or unfound library error is encountered.

PR 26626
	* ldmain.c (undefined_symbol): If an error handlign script is
	available, call it.
	* ldfile.c  (error_handling_script): Declare.
	(ldfile_open_file): If a library cannot be found and an error
	handling script is available, call it.
	* ldmain.h  (error_handling_script): Prototype.
	* ldlex.h (OPTION_ERROR_HANDLING_SCRIPT): Define.
	* lexsup.c (ld_options): Add --error-handling-script.
	(parse_args): Add support for --errror-handling-script.
	* ld.texi: Document the new feature.
	* configure.ac: Add --error-handling-script option to disable
	support for the new feature.
	* NEWS: Mention the new feature.
	* config.in: Regenerate.
	* configure: Regenerate.
This commit is contained in:
Nick Clifton
2020-10-16 11:37:26 +01:00
parent 472d09c18a
commit 23ae20f5e3
11 changed files with 178 additions and 2 deletions

28
ld/configure vendored
View File

@@ -835,6 +835,7 @@ enable_new_dtags
enable_relro
enable_textrel_check
enable_separate_code
enable_error_handling_script
enable_default_hash_style
enable_libctf
enable_werror
@@ -1505,6 +1506,9 @@ Optional Features:
--enable-textrel-check=[yes|no|warning|error]
enable DT_TEXTREL check in ELF linker
--enable-separate-code enable -z separate-code in ELF linker by default
--enable-error-handling-script
enable/disable support for the
--error-handling-script option
--enable-default-hash-style={sysv,gnu,both}
use this default hash style
--enable-libctf Handle .ctf type-info sections [default=yes]
@@ -12039,7 +12043,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12042 "configure"
#line 12046 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12145,7 +12149,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 12148 "configure"
#line 12152 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15945,6 +15949,17 @@ esac
fi
# Decide if --error-handling-script should be supported.
ac_support_error_handling_script=unset
# Check whether --enable-error-handling-script was given.
if test "${enable_error_handling_script+set}" = set; then :
enableval=$enable_error_handling_script; case "${enableval}" in
yes) ac_support_error_handling_script=1 ;;
no) ac_support_error_handling_script=0 ;;
esac
fi
# Decide which "--hash-style" to use by default
# Provide a configure time option to override our default.
# Check whether --enable-default-hash-style was given.
@@ -17739,6 +17754,15 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
if test "${ac_support_error_handling_script}" = unset; then
ac_support_error_handling_script=1
fi
cat >>confdefs.h <<_ACEOF
#define SUPPORT_ERROR_HANDLING_SCRIPT $ac_support_error_handling_script
_ACEOF
cat >>confdefs.h <<_ACEOF
#define DEFAULT_EMIT_SYSV_HASH $ac_default_emit_sysv_hash