This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Update to -z nodynamic-undefined-weak
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 25 Feb 2016 07:53:17 -0800
- Subject: [PATCH] Update to -z nodynamic-undefined-weak
- Authentication-results: sourceware.org; auth=none
---
ld/emulparams/dynamic_undefined_weak.sh | 14 +++++++-------
ld/ld.texinfo | 9 +++++----
ld/ldmain.c | 1 +
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/ld/emulparams/dynamic_undefined_weak.sh b/ld/emulparams/dynamic_undefined_weak.sh
index c6d9905..82d88d6 100644
--- a/ld/emulparams/dynamic_undefined_weak.sh
+++ b/ld/emulparams/dynamic_undefined_weak.sh
@@ -1,12 +1,12 @@
-PARSE_AND_LIST_OPTIONS_DYNAMIC_UNDEFINED_WEAK='
+PARSE_AND_LIST_OPTIONS_NODYNAMIC_UNDEFINED_WEAK='
fprintf (file, _("\
- -z dynamic-undefined-weak Treat undefined weak symbol as dynamic\n"));
+ -z nodynamic-undefined-weak Do not treat undefined weak symbol as dynamic\n"));
'
-PARSE_AND_LIST_ARGS_CASE_Z_DYNAMIC_UNDEFINED_WEAK='
- else if (strcmp (optarg, "dynamic-undefined-weak") == 0)
- link_info.dynamic_undefined_weak = TRUE;
+PARSE_AND_LIST_ARGS_CASE_Z_NODYNAMIC_UNDEFINED_WEAK='
+ else if (strcmp (optarg, "nodynamic-undefined-weak") == 0)
+ link_info.dynamic_undefined_weak = FALSE;
'
-PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_DYNAMIC_UNDEFINED_WEAK"
-PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_DYNAMIC_UNDEFINED_WEAK"
+PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_NODYNAMIC_UNDEFINED_WEAK"
+PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_NODYNAMIC_UNDEFINED_WEAK"
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index b53c436..ee462c5 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -1199,10 +1199,11 @@ generated by compiler. Updates on protected data symbols by another
module aren't visible to the resulting shared library. Supported for
i386 and x86-64.
-@item dynamic-undefined-weak
-Treat undefined weak symbols as dynamic when building executable. This
-option generates dynamic relocations against undefined weak symbols if
-all relocations aginst it are GOT or PLT relocations.
+@item nodynamic-undefined-weak
+Don't treat undefined weak symbols as dynamic when building executable.
+This option overrides linker backend default. It can be used to avoid
+dynamic relocations against undefined weak symbols in executable.
+Supported for i386 and x86-64.
@item call-nop=prefix-addr
@itemx call-nop=prefix-nop
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 7425da0..21133ab 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -278,6 +278,7 @@ main (int argc, char **argv)
link_info.fini_function = "_fini";
link_info.relax_pass = 1;
link_info.extern_protected_data = -1;
+ link_info.dynamic_undefined_weak = -1;
link_info.pei386_auto_import = -1;
link_info.spare_dynamic_tags = 5;
link_info.path_separator = ':';
--
2.5.0