ld/
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 5 Jun 2005 15:28:36 +0000 (15:28 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 5 Jun 2005 15:28:36 +0000 (15:28 +0000)
2005-06-05  H.J. Lu  <hongjiu.lu@intel.com>

* ldexp.c (exp_mark_used_section): Set SEC_KEEP on current
section only if the symbol will be defined.

ld/testsuite/

2005-06-05  H.J. Lu  <hongjiu.lu@intel.com>

* ld-cris/hiddef1.d: Undo the last change.
* ld-cris/libdso-10.d: Likewise.
* ld-cris/libdso-2.d: Likewise.

ld/ChangeLog
ld/ldexp.c
ld/testsuite/ChangeLog
ld/testsuite/ld-cris/hiddef1.d
ld/testsuite/ld-cris/libdso-10.d
ld/testsuite/ld-cris/libdso-2.d

index 12d643be02f3b86560969e0e720832b4bd41e202..d4a15a86b388a6c466b1c25f1b26fccdcb561d2f 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ldexp.c (exp_mark_used_section): Set SEC_KEEP on current
+       section only if the symbol will be defined.
+
 2005-06-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR 992
index 7d63c8d9acac1d0e7ffecc1a526bf34d53e8dd60..3927f85f0b5c18c2edc7cca0820315dec6d91d32 100644 (file)
@@ -1247,24 +1247,33 @@ 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_boolean create = tree->type.node_class == etree_assign;
+         struct bfd_link_hash_entry *h;
 
          result = exp_fold_tree_1 (tree->assign.src,
                                    current_section,
                                    lang_allocating_phase_enum,
                                    dot, &dot, TRUE);
-         if (current_section != bfd_abs_section_ptr)
+
+         /* We mark the current section SEC_KEEP only if the symbol
+            will be defined.  */
+         if (!create)
+           h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
+                                     create, FALSE, TRUE);
+         else
+           h = NULL;
+
+         if ((create || h)
+             && current_section != bfd_abs_section_ptr)
            current_section->flags |= SEC_KEEP;
+
          if (result.valid_p)
            {
-             bfd_boolean create;
-             struct bfd_link_hash_entry *h;
 
-             if (tree->type.node_class == etree_assign)
-               create = TRUE;
-             else
-               create = FALSE;
-             h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
-                                       create, FALSE, TRUE);
+             if (create)
+               h = bfd_link_hash_lookup (link_info.hash,
+                                         tree->assign.dst, create,
+                                         FALSE, TRUE);
              if (h == NULL)
                {
                  if (create)
index a2a946e4b69e0c290a2cb863bd75cc038ee3d930..52cffd3626addaa91a4ed476d0a433a49383f6b3 100644 (file)
@@ -1,3 +1,9 @@
+2005-06-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld-cris/hiddef1.d: Undo the last change.
+       * ld-cris/libdso-10.d: Likewise.
+       * ld-cris/libdso-2.d: Likewise.
+
 2005-06-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ld-cris/hiddef1.d: Updated.
index 99d8a3d13d723e53dc996667a20fd7b1332c62de..fd79f920f859ee016a92d53a92a79cc2756dda36 100644 (file)
@@ -14,7 +14,7 @@
 # and sections change, make sure that there's no .plt and that
 # dsofn is hidden (not exported as a dynamic symbol).
 
-There are 12 section headers, starting at offset 0x[0-9a-f]+:
+There are 11 section headers, starting at offset 0x[0-9a-f]+:
 #...
   \[[ 0-9]+\] \.got              PROGBITS        [0-9a-f]+ [0-9a-f]+ 0+10 04  WA  0   0  4
 #...
@@ -24,5 +24,5 @@ Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
 #...
 Symbol table '\.dynsym' contains 9 entries:
 #...
-Symbol table '\.symtab' contains 20 entries:
+Symbol table '\.symtab' contains 19 entries:
 #pass
index a0c75c167c454bdc2649434c39ccadc84217d291..3fe6ddbea958c3f9c6240f719f9fe022a6747a3b 100644 (file)
@@ -35,7 +35,5 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, ALLOC, LOAD, DATA
   5 \.got          0+c  0+21e0  0+21e0  0+1e0  2\*\*2
                   CONTENTS, ALLOC, LOAD, DATA
-  6 \.data         0+  0+21ec  0+21ec  0+1ec  2\*\*0
-                  CONTENTS, ALLOC, LOAD, DATA
-  7 \.bss          0+14  0+21ec  0+21ec  0+1ec  2\*\*0
+  6 \.bss          0+14  0+21ec  0+21ec  0+1ec  2\*\*0
                   ALLOC
index 48d0fe889f3135985ef31b732b88ed47be7c94b9..10bfe2870638c4fcd1aeb74fd8e19dd85804e8a2 100644 (file)
@@ -10,7 +10,7 @@
 # entries.  This formerly SEGV:ed because .rela.got was created
 # too late to have it mapped to an output section.
 
-There are 15 section headers.*
+There are 14 section headers.*
 #...
   \[ 1\] \.hash             HASH     .*
   \[ 2\] \.dynsym           DYNSYM   .*
@@ -21,11 +21,10 @@ There are 15 section headers.*
   \[ 7\] \.text             PROGBITS .*
   \[ 8\] \.dynamic          DYNAMIC  .*
   \[ 9\] \.got              PROGBITS .*
-  \[10\] \.data             PROGBITS .*
-  \[11\] \.bss              NOBITS   .*
-  \[12\] \.shstrtab         STRTAB   .*
-  \[13\] \.symtab           SYMTAB   .*
-  \[14\] \.strtab           STRTAB   .*
+  \[10\] \.bss              NOBITS   .*
+  \[11\] \.shstrtab         STRTAB   .*
+  \[12\] \.symtab           SYMTAB   .*
+  \[13\] \.strtab           STRTAB   .*
 #...
 Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
 #...
@@ -35,12 +34,12 @@ Symbol table '\.dynsym' contains 6 entries:
    Num:    Value  Size Type    Bind   Vis      Ndx Name
      0: 0+     0 NOTYPE  LOCAL  DEFAULT  UND 
      1: [0-9a-f]+     0 SECTION LOCAL  DEFAULT    7 
-     2: [0-9a-f]+     0 SECTION LOCAL  DEFAULT   10 
-     3: [0-9a-f]+     0 SECTION LOCAL  DEFAULT   11 
+     2: [0-9a-f]+     0 NOTYPE  LOCAL  DEFAULT  UND 
+     3: [0-9a-f]+     0 SECTION LOCAL  DEFAULT   10 
      4: 0+     0 OBJECT  GLOBAL DEFAULT  ABS TST1
      5: 0+188     0 FUNC    GLOBAL DEFAULT    7 export_1@@TST1
 
-Symbol table '\.symtab' contains 23 entries:
+Symbol table '\.symtab' contains 22 entries:
    Num:    Value  Size Type    Bind   Vis      Ndx Name
      0: 0+     0 NOTYPE  LOCAL  DEFAULT  UND 
      1: [0-9a-f]+     0 SECTION LOCAL  DEFAULT    1 
@@ -56,12 +55,11 @@ Symbol table '\.symtab' contains 23 entries:
     11: [0-9a-f]+     0 SECTION LOCAL  DEFAULT   11 
     12: [0-9a-f]+     0 SECTION LOCAL  DEFAULT   12 
     13: [0-9a-f]+     0 SECTION LOCAL  DEFAULT   13 
-    14: [0-9a-f]+     0 SECTION LOCAL  DEFAULT   14 
-    15: 0+2198     0 OBJECT  LOCAL  DEFAULT  ABS _DYNAMIC
-    16: 0+2230     0 NOTYPE  LOCAL  DEFAULT  ABS __bss_start
-    17: 0+2230     0 NOTYPE  LOCAL  DEFAULT  ABS _edata
-    18: 0+2220     0 OBJECT  LOCAL  HIDDEN  ABS _GLOBAL_OFFSET_TABLE_
-    19: 0+2240     0 NOTYPE  LOCAL  DEFAULT  ABS _end
-    20: 0+184     0 FUNC    LOCAL  DEFAULT    7 dsofn
-    21: 0+     0 OBJECT  GLOBAL DEFAULT  ABS TST1
-    22: 0+188     0 FUNC    GLOBAL DEFAULT    7 export_1
+    14: 0+2198     0 OBJECT  LOCAL  DEFAULT  ABS _DYNAMIC
+    15: 0+2230     0 NOTYPE  LOCAL  DEFAULT  ABS __bss_start
+    16: 0+2230     0 NOTYPE  LOCAL  DEFAULT  ABS _edata
+    17: 0+2220     0 OBJECT  LOCAL  HIDDEN  ABS _GLOBAL_OFFSET_TABLE_
+    18: 0+2240     0 NOTYPE  LOCAL  DEFAULT  ABS _end
+    19: 0+184     0 FUNC    LOCAL  DEFAULT    7 dsofn
+    20: 0+     0 OBJECT  GLOBAL DEFAULT  ABS TST1
+    21: 0+188     0 FUNC    GLOBAL DEFAULT    7 export_1
This page took 0.034724 seconds and 4 git commands to generate.