bfd/
authorRichard Sandiford <rdsandiford@googlemail.com>
Wed, 1 Apr 2009 20:09:03 +0000 (20:09 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Wed, 1 Apr 2009 20:09:03 +0000 (20:09 +0000)
* xcofflink.c (bfd_link_input_bfd): Treat __rtinit as C_HIDEXT
rather than C_EXT.

ld/testsuite/
* ld-powerpc/aix-gc-1.nd: New test.
* ld-powerpc/aix52.exp: Run it.

bfd/ChangeLog
bfd/xcofflink.c
ld/testsuite/ChangeLog
ld/testsuite/ld-powerpc/aix-gc-1.nd [new file with mode: 0644]
ld/testsuite/ld-powerpc/aix52.exp

index 6d3b40518e1756ccf566e9f91285557e6e44bad8..544e5adff9f00d12f26f8862bc970ad6e46ab927 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * xcofflink.c (bfd_link_input_bfd): Treat __rtinit as C_HIDEXT
+       rather than C_EXT.
+
 2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
 
        * coff-rs6000.c (member_layout): New structure.
index 97c051a2b9fe6f8bd6ec64a0dbaae1f32522fb61..cb1da9eb6ae8c95f90b28a61bd3c86d562d30a51 100644 (file)
@@ -4289,6 +4289,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *finfo,
 
   esym = (bfd_byte *) obj_coff_external_syms (input_bfd);
   esym_end = esym + obj_raw_syment_count (input_bfd) * isymesz;
+  sym_hash = obj_xcoff_sym_hashes (input_bfd);
   isymp = finfo->internal_syms;
   indexp = finfo->sym_indices;
   csectpp = xcoff_data (input_bfd)->csects;
@@ -4336,6 +4337,16 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *finfo,
                }
            }
 
+         /* Make __rtinit C_HIDEXT rather than C_EXT.  This avoids
+            multiple definition problems when linking a shared object
+            statically.  (The native linker doesn't enter __rtinit into
+            the normal table at all, but having a local symbol can make
+            the objdump output easier to read.)  */
+         if (isym.n_sclass == C_EXT
+             && *sym_hash
+             && ((*sym_hash)->flags & XCOFF_RTINIT) != 0)
+           isym.n_sclass = C_HIDEXT;
+
          /* The value of a C_FILE symbol is the symbol index of the
             next C_FILE symbol.  The value of the last C_FILE symbol
             is -1.  We try to get this right, below, just before we
@@ -4664,6 +4675,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *finfo,
            }
        }
 
+      sym_hash += add;
       indexp += add;
       isymp += add;
       csectpp += add;
index 124b11cd53297369a46a477be23ff45ba3768cc2..f1c5f490e81f8d6e7029320f369bda919ce69391 100644 (file)
@@ -1,3 +1,13 @@
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * ld-powerpc/aix-gc-1.nd: New test.
+       * ld-powerpc/aix52.exp: Run it.
+
+2009-04-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * ld-powerpc/aix-rel-1.s, ld-powerpc/aix-rel-1.od: New test.
+       * ld-powerpc/aix52.exp: Run it.
+
 2009-04-01  Dave Korn  <dave.korn.cygwin@gmail.com>
 
        * ld-cygwin/exe-export.exp:  Add "-lkernel32" when linking test exe.
diff --git a/ld/testsuite/ld-powerpc/aix-gc-1.nd b/ld/testsuite/ld-powerpc/aix-gc-1.nd
new file mode 100644 (file)
index 0000000..f399646
--- /dev/null
@@ -0,0 +1,3 @@
+#...
+0*20000008 d __rtinit
+#pass
index c88ba9b5101dc81b0e2cedd2d0a0f84a799f5f48..4d32b2d0065b9a28540281200d8a4e5fbd0c3a34 100644 (file)
@@ -131,7 +131,8 @@ set aix52tests {
     {"Garbage collection test 1"
      "-shared -binitfini:init_function:fini_function -bE:aix-gc-1.ex"
      "" {aix-gc-1.s}
-     {{objdump {-dz -j.text -j.data} aix-gc-1-SIZE.dd}}
+     {{objdump {-dz -j.text -j.data} aix-gc-1-SIZE.dd}
+      {nm {} aix-gc-1.nd}}
      "aix-gc-1.so"}
 
     {"Glink test 1"