Change regcache list to be an hash map
[deliverable/binutils-gdb.git] / ld / ldexp.c
index d7d253eee12b50df8ab201d7a69316fca922ee29..b4e7c41209dd48c82bc2476f1ffc83c3f3235586 100644 (file)
@@ -1,5 +1,5 @@
 /* This module handles expression trees.
-   Copyright (C) 1991-2019 Free Software Foundation, Inc.
+   Copyright (C) 1991-2020 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
    This file is part of the GNU Binutils.
@@ -30,6 +30,7 @@
 #include "sysdep.h"
 #include "bfd.h"
 #include "bfdlink.h"
+#include "ctf-api.h"
 
 #include "ld.h"
 #include "ldmain.h"
@@ -699,7 +700,8 @@ fold_name (etree_type *tree)
          /* Don't find the real header size if only marking sections;
             The bfd function may cache incorrect data.  */
          if (expld.phase != lang_mark_phase_enum)
-           hdr_size = bfd_sizeof_headers (link_info.output_bfd, &link_info);
+           hdr_size = (bfd_sizeof_headers (link_info.output_bfd, &link_info)
+                       / bfd_octets_per_byte (link_info.output_bfd, NULL));
          new_number (hdr_size);
        }
       break;
@@ -729,7 +731,10 @@ fold_name (etree_type *tree)
                                            tree->name.name,
                                            TRUE, FALSE, TRUE);
          if (!h)
-           einfo (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
+           {
+             if (expld.phase != lang_first_phase_enum)
+               einfo (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
+           }
          else if (h->type == bfd_link_hash_defined
                   || h->type == bfd_link_hash_defweak)
            {
@@ -851,7 +856,8 @@ fold_name (etree_type *tree)
 
              if (tree->type.node_code == SIZEOF)
                val = (os->bfd_section->size
-                      / bfd_octets_per_byte (link_info.output_bfd));
+                      / bfd_octets_per_byte (link_info.output_bfd,
+                                             os->bfd_section));
              else
                val = (bfd_vma)1 << os->bfd_section->alignment_power;
 
@@ -1211,15 +1217,19 @@ exp_fold_tree_1 (etree_type *tree)
                        bfd_link_hide_symbol (link_info.output_bfd,
                                              &link_info, h);
 
-                     /* Copy the symbol type if this is an expression only
+                     /* Copy the symbol type and set non_ir_ref_regular
+                        on the source if this is an expression only
                         referencing a single symbol.  (If the expression
                         contains ternary conditions, ignoring symbols on
                         false branches.)  */
                      if (expld.assign_src != NULL
                          && (expld.assign_src
                              != (struct bfd_link_hash_entry *) -1))
-                       bfd_copy_link_hash_symbol_type (link_info.output_bfd,
-                                                       h, expld.assign_src);
+                       {
+                         bfd_copy_link_hash_symbol_type (link_info.output_bfd,
+                                                         h, expld.assign_src);
+                         expld.assign_src->non_ir_ref_regular = TRUE;
+                       }
                    }
                }
            }
This page took 0.023255 seconds and 4 git commands to generate.