2005-06-04 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 4 Jun 2005 14:40:21 +0000 (14:40 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 4 Jun 2005 14:40:21 +0000 (14:40 +0000)
PR 992
* ldexp.c (exp_mark_used_section): Set SEC_KEEP on current
section for etree_assign, etree_provide and etree_provided.
Call fold_binary on etree_binary.

* ldlang.c (lang_mark_used_section_1): Handle load base.

ld/ChangeLog
ld/ldexp.c
ld/ldlang.c

index 7789ed66d80c093b670320559d281db9a3b85799..12d643be02f3b86560969e0e720832b4bd41e202 100644 (file)
@@ -1,3 +1,12 @@
+2005-06-04  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR 992
+       * ldexp.c (exp_mark_used_section): Set SEC_KEEP on current
+       section for etree_assign, etree_provide and etree_provided.
+       Call fold_binary on etree_binary.
+
+       * ldlang.c (lang_mark_used_section_1): Handle load base.
+
 2005-06-03  Alan Modra  <amodra@bigpond.net.au>
 
        * ldmain.c (link_callbacks): Add einfo.
index 1790e8c2a32d57b017bb2fcedb69c94262981baf..7d63c8d9acac1d0e7ffecc1a526bf34d53e8dd60 100644 (file)
@@ -1217,6 +1217,8 @@ align_n (bfd_vma value, bfd_vma align)
 void
 exp_mark_used_section (etree_type *tree, asection *current_section)
 {
+  bfd_vma dot = 0;
+
   switch (tree->type.node_class)
     {
     case etree_value:
@@ -1232,6 +1234,8 @@ exp_mark_used_section (etree_type *tree, asection *current_section)
       break;
 
     case etree_binary:
+      fold_binary (tree, current_section, lang_allocating_phase_enum,
+                  dot, &dot, TRUE);
       break;
 
     case etree_trinary:
@@ -1243,12 +1247,13 @@ exp_mark_used_section (etree_type *tree, asection *current_section)
       if (tree->assign.dst[0] != '.' || tree->assign.dst[1] != 0)
        {
          etree_value_type result;
-         bfd_vma dot = 0;
 
          result = exp_fold_tree_1 (tree->assign.src,
                                    current_section,
                                    lang_allocating_phase_enum,
                                    dot, &dot, TRUE);
+         if (current_section != bfd_abs_section_ptr)
+           current_section->flags |= SEC_KEEP;
          if (result.valid_p)
            {
              bfd_boolean create;
index b4f767d6e89b687b88f68be7f2d5770ab896fa06..973ed4105af2f81697bda1378521f1bb79f5e985 100644 (file)
@@ -3065,7 +3065,12 @@ lang_mark_used_section_1
 
            os = &(s->output_section_statement);
            if (os->bfd_section != NULL)
-             lang_mark_used_section_1 (os->children.head, os);
+             {
+               lang_mark_used_section_1 (os->children.head, os);
+               if (os->load_base)
+                 exp_mark_used_section (os->load_base,
+                                        bfd_abs_section_ptr);
+             }
          }
          break;
        case lang_wild_statement_enum: