summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/ldlang.c24
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-powerpc/aix-export-2.nd1
-rw-r--r--ld/testsuite/ld-powerpc/aix-export-2.s1
-rw-r--r--ld/testsuite/ld-powerpc/aix52.exp4
6 files changed, 18 insertions, 21 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 099275dd487..befe0c68446 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2009-04-16 Richard Sandiford <r.sandiford@uk.ibm.com>
+
+ * ldlang.c (lang_one_common): Use bfd_define_common_symbol.
+
2009-04-15 Anthony Green <green@moxielogic.com>
* configure.tgt: Add moxie support.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 412a86c5a4d..230994a90e5 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5639,27 +5639,9 @@ lang_one_common (struct bfd_link_hash_entry *h, void *info)
return TRUE;
section = h->u.c.p->section;
-
- /* Increase the size of the section to align the common sym. */
- section->size += ((bfd_vma) 1 << (power_of_two + opb_shift)) - 1;
- section->size &= (- (bfd_vma) 1 << (power_of_two + opb_shift));
-
- /* Adjust the alignment if necessary. */
- if (power_of_two > section->alignment_power)
- section->alignment_power = power_of_two;
-
- /* Change the symbol from common to defined. */
- h->type = bfd_link_hash_defined;
- h->u.def.section = section;
- h->u.def.value = section->size;
-
- /* Increase the size of the section. */
- section->size += size;
-
- /* Make sure the section is allocated in memory, and make sure that
- it is no longer a common section. */
- section->flags |= SEC_ALLOC;
- section->flags &= ~SEC_IS_COMMON;
+ if (!bfd_define_common_symbol (link_info.output_bfd, &link_info, h))
+ einfo (_("%P%F: Could not define common symbol `%T': %E\n"),
+ h->root.string);
if (config.map_file != NULL)
{
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 7718d840d95..75b90500268 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-16 Richard Sandiford <r.sandiford@uk.ibm.com>
+
+ * ld-powerpc/aix-export-2.s, ld-powerpc/aix-export-2.nd: New test.
+ * ld-powerpc/aix52.exp: Run it.
+
2009-04-16 Alan Modra <amodra@bigpond.net.au>
* ld-libs/lib-1.s: Use "==" instead of ".set".
diff --git a/ld/testsuite/ld-powerpc/aix-export-2.nd b/ld/testsuite/ld-powerpc/aix-export-2.nd
new file mode 100644
index 00000000000..6f974331673
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-export-2.nd
@@ -0,0 +1 @@
+0*10000000 B x
diff --git a/ld/testsuite/ld-powerpc/aix-export-2.s b/ld/testsuite/ld-powerpc/aix-export-2.s
new file mode 100644
index 00000000000..f720635d669
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-export-2.s
@@ -0,0 +1 @@
+ .comm x,4
diff --git a/ld/testsuite/ld-powerpc/aix52.exp b/ld/testsuite/ld-powerpc/aix52.exp
index 4d32b2d0065..25479ddb390 100644
--- a/ld/testsuite/ld-powerpc/aix52.exp
+++ b/ld/testsuite/ld-powerpc/aix52.exp
@@ -128,6 +128,10 @@ set aix52tests {
{{objdump -dj.data aix-export-1-full.dd}}
"aix-export-1-full.so"}
+ {"Export test 2" "-shared -bexpall"
+ {} {aix-export-2.s}
+ {{nm -D aix-export-2.nd}} "aix-export-2.so"}
+
{"Garbage collection test 1"
"-shared -binitfini:init_function:fini_function -bE:aix-gc-1.ex"
"" {aix-gc-1.s}