PR27451, -z start_stop_gc
[deliverable/binutils-gdb.git] / ld / ldexp.c
index 905055ab1c9581852859b5b86dc0fc3efe89e757..016784505b2b0fad4dc511729f1e52537a39417b 100644 (file)
@@ -1,5 +1,5 @@
 /* This module handles expression trees.
-   Copyright (C) 1991-2020 Free Software Foundation, Inc.
+   Copyright (C) 1991-2021 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
    This file is part of the GNU Binutils.
@@ -1186,16 +1186,19 @@ exp_fold_tree_1 (etree_type *tree)
                {
                  if (expld.result.section == NULL)
                    expld.result.section = expld.section;
-                 if (!update_definedness (tree->assign.dst, h) && 0)
+                 if (!update_definedness (tree->assign.dst, h)
+                     && expld.assign_name != NULL)
                    {
-                     /* Symbol was already defined.  For now this error
-                        is disabled because it causes failures in the ld
-                        testsuite: ld-elf/var1, ld-scripts/defined5, and
-                        ld-scripts/pr14962.  Some of these no doubt
-                        reflect scripts used in the wild.  */
+                     /* Symbol was already defined, and the script isn't
+                        modifying the symbol value for some reason as in
+                        ld-elf/var1 and ld-scripts/pr14962.
+                        For now this is only a warning.  */
+                     unsigned int warn = link_info.warn_multiple_definition;
+                     link_info.warn_multiple_definition = 1;
                      (*link_info.callbacks->multiple_definition)
                        (&link_info, h, link_info.output_bfd,
                         expld.result.section, expld.result.value);
+                     link_info.warn_multiple_definition = warn;
                    }
                  if (expld.phase == lang_fixed_phase_enum)
                    {
This page took 0.0252 seconds and 4 git commands to generate.