aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-04-16 23:07:00 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-04-16 23:07:00 +0000
commit3023e3f66a5ac8d0fc159324ea49f9e15bbb2e8f (patch)
tree81e5e31e35c8871af838ab530c1d3416a0849784 /ld
parent1554e9be88d65571db4bef4a6aa916087de6bd94 (diff)
downloadgdb-3023e3f66a5ac8d0fc159324ea49f9e15bbb2e8f.zip
gdb-3023e3f66a5ac8d0fc159324ea49f9e15bbb2e8f.tar.gz
gdb-3023e3f66a5ac8d0fc159324ea49f9e15bbb2e8f.tar.bz2
bfd/
* aout-adobe.c (aout_32_bfd_define_common_symbol): Define. * aout-target.h (MY_bfd_define_common_symbol): Likewise. * aout-tic30.c (MY_bfd_define_common_symbol): Likewise. * binary.c (binary_bfd_define_common_symbol): Likewise. * bout.c (b_out_bfd_define_common_symbol): Likewise. * coff-alpha.c (_bfd_ecoff_bfd_define_common_symbol): Likewise. * coff-mips.c (_bfd_ecoff_bfd_define_common_symbol): Likewise. * coffcode.h (coff_bfd_define_common_symbol): Likewise. * elfxx-target.h (bfd_elfNN_bfd_define_common_symbol): Likewise. * i386msdos.c (msdos_bfd_define_common_symbol): Likewise. * i386os9k.c (os9k_bfd_define_common_symbol): Likewise. * ieee.c (ieee_bfd_define_common_symbol): Likewise. * ihex.c (ihex_bfd_define_common_symbol): Likewise. * libbfd-in.h (_bfd_nolink_bfd_define_common_symbol): Likewise. * mach-o.c (bfd_mach_o_bfd_define_common_symbol): Likewise. * mmo.c (mmo_bfd_define_common_symbol): Likewise. * nlm-target.h (nlm_bfd_define_common_symbol): Likewise. * oasys.c (oasys_bfd_define_common_symbol): Likewise. * pef.c (bfd_pef_bfd_define_common_symbol): Likewise. * ppcboot.c (ppcboot_bfd_define_common_symbol): Likewise. * som.c (som_bfd_define_common_symbol): Likewise. * srec.c (srec_bfd_define_common_symbol): Likewise. * tekhex.c (tekhex_bfd_define_common_symbol): Likewise. * versados.c (versados_bfd_define_common_symbol): Likewise. * vms.c (vms_bfd_define_common_symbol): Likewise. * xcoff-target.h (_bfd_xcoff_bfd_define_common_symbol): Likewise. * xsym.c (bfd_sym_bfd_define_common_symbol): Likewise. * coff-rs6000.c (rs6000coff_vec): Add _bfd_xcoff_define_common_symbol. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * linker.c (bfd_generic_define_common_symbol): New function. * targets.c (BFD_JUMP_TABLE_LINK): Add NAME##_bfd_define_common_symbol. (_bfd_define_common_symbol): New field. * libcoff-in.h (_bfd_xcoff_define_common_symbol): Declare. * xcofflink.c (_bfd_xcoff_define_common_symbol): New function. (xcoff_build_ldsyms): Don't set XCOFF_DEF_REGULAR for common symbols here. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. * libcoff.h: Likewise. ld/ * ldlang.c (lang_one_common): Use bfd_define_common_symbol. ld/testsuite/ * ld-powerpc/aix-export-2.s, ld-powerpc/aix-export-2.nd: New test. * ld-powerpc/aix52.exp: Run it.
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 099275d..befe0c6 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 412a86c..230994a 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 7718d84..75b9050 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 0000000..6f97433
--- /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 0000000..f720635
--- /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 4d32b2d..25479dd 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}