Add readahead cache to gdb's vFile:pread
[binutils-gdb.git] / ld / ldexp.c
index 9cd9e29d813f665402b1ead4cfd8881a541167f4..1140881015dd15e5fda34b702d9ffb3f351c4513 100644 (file)
@@ -575,7 +575,6 @@ fold_binary (etree_type *tree)
                  else if (expld.dataseg.phase == exp_dataseg_none)
                    {
                      expld.dataseg.phase = exp_dataseg_align_seen;
-                     expld.dataseg.min_base = expld.dot;
                      expld.dataseg.base = expld.result.value;
                      expld.dataseg.pagesize = commonpage;
                      expld.dataseg.maxpagesize = maxpage;
@@ -591,6 +590,7 @@ fold_binary (etree_type *tree)
          /* Operands swapped!  DATA_SEGMENT_RELRO_END(offset,exp)
             has offset in expld.result and exp in lhs.  */
          expld.dataseg.relro = exp_dataseg_relro_end;
+         expld.dataseg.relro_offset = expld.result.value;
          if (expld.phase == lang_first_phase_enum
              || expld.section != bfd_abs_section_ptr)
            expld.result.valid_p = FALSE;
@@ -877,7 +877,7 @@ fold_name (etree_type *tree)
 }
 
 /* Return true if TREE is '.'.  */
+
 static bfd_boolean
 is_dot (const etree_type *tree)
 {
@@ -1026,7 +1026,12 @@ exp_fold_tree_1 (etree_type *tree)
              /* If we are assigning to dot inside an output section
                 arrange to keep the section, except for certain
                 expressions that evaluate to zero.  We ignore . = 0,
-                . = . + 0, and . = ALIGN (. != 0 ? expr : 1).  */
+                . = . + 0, and . = ALIGN (. != 0 ? expr : 1).
+                We can't ignore all expressions that evaluate to zero
+                because an otherwise empty section might have padding
+                added by an alignment expression that changes with
+                relaxation.  Such a section might have zero size
+                before relaxation and so be stripped incorrectly.  */
              if (expld.phase == lang_mark_phase_enum
                  && expld.section != bfd_abs_section_ptr
                  && !(expld.result.valid_p
@@ -1139,6 +1144,7 @@ exp_fold_tree_1 (etree_type *tree)
              h->type = bfd_link_hash_defined;
              h->u.def.value = expld.result.value;
              h->u.def.section = expld.result.section;
+             h->linker_def = 0;
              if (tree->type.node_class == etree_provide)
                tree->type.node_class = etree_provided;