summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-11-23 14:41:26 +0000
committerPaul Brook <paul@codesourcery.com>2009-11-23 14:41:26 +0000
commit68fc6ea96a51e495d6f0d3e76448f75417d1538d (patch)
tree283e44b3eb9a6a0e653da1dd5598594c31784012 /ld
parent34abfb575f659cd918caf2245371002ba34aacf5 (diff)
downloadbinutils-redhat-68fc6ea96a51e495d6f0d3e76448f75417d1538d.tar.gz
2009-11-23 Paul Brook <paul@codesourcery.com>
ld/ * ldexp.c: Copy symbol type for simple assignments. bfd/ * libbfd-in.h (_bfd_generic_copy_link_hash_symbol_type): Add prototype. * elf-bfd.h (_bfd_elf_copy_link_hash_symbol_type): Add prototype. * linker.c (_bfd_generic_copy_link_hash_symbol_type): New function. * elflink.c (_bfd_elf_copy_link_hash_symbol_type): New function. * targets.c (BFD_JUMP_TABLE_LINK, struct bfd_target): Add _copy_link_hash_symbol_type. * bfd/coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Add _bfd_generic_copy_link_hash_symbol_type. * bfd/coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add _bfd_generic_copy_link_hash_symbol_type. * aout-adobe.c (aout_32_bfd_copy_link_hash_symbol_type): Define. * aout-target.h (MY_bfd_copy_link_hash_symbol_type): Define. * aout-tic30.c (MY_bfd_copy_link_hash_symbol_type): Define. * binary.c (binary_bfd_copy_link_hash_symbol_type): Define. * bout.c (b_out_bfd_copy_link_hash_symbol_type): Define. * coffcode.h (coff_bfd_copy_link_hash_symbol_type): Define. * elfxx-target.h (bfd_elfNN_bfd_copy_link_hash_symbol_type): Define. * i386msdos.c (msdos_bfd_copy_link_hash_symbol_type): Define. * i386os9k.c (os9k_bfd_copy_link_hash_symbol_type): Define. * ieee.c (ieee_bfd_copy_link_hash_symbol_type): Define. * ihex.c (ihex_bfd_copy_link_hash_symbol_type): Define. * libecoff.h (_bfd_ecoff_bfd_copy_link_hash_symbol_type): Define. * mach-o.c (bfd_mach_o_bfd_copy_link_hash_symbol_type): Define. * mmo.c (mmo_bfd_copy_link_hash_symbol_type): Define. * nlm-target.h (nlm_bfd_copy_link_hash_symbol_type): Define. * oasys.c (oasys_bfd_copy_link_hash_symbol_type): Define. * pef.c (bfd_pef_bfd_copy_link_hash_symbol_type): Define. * ppcboot.c (ppcboot_bfd_copy_link_hash_symbol_type): Define. * som.c (som_bfd_copy_link_hash_symbol_type): Define. * srec.c (srec_bfd_copy_link_hash_symbol_type): Define. * tekhex.c (tekhex_bfd_copy_link_hash_symbol_type): Define. * versados.c (versados_bfd_copy_link_hash_symbol_type): Define. * vms.c (vms_bfd_copy_link_hash_symbol_type): Define. * xsym.c (bfd_sym_bfd_copy_link_hash_symbol_type): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/testsuite * ld-arm/script-type.sym: New test. * ld-arm/script-type.s: New test. * ld-arm/script-type.s: New test.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/ldexp.c14
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp3
-rw-r--r--ld/testsuite/ld-arm/script-type.ld7
-rw-r--r--ld/testsuite/ld-arm/script-type.s20
-rw-r--r--ld/testsuite/ld-arm/script-type.sym15
7 files changed, 69 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 31985e38f1..4a93d2c064 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-23 Paul Brook <paul@codesourcery.com>
+
+ * ldexp.c: Copy symbol type for simple assignments.
+
2009-11-20 Thomas Schwinge <thomas@codesourcery.com>
* emulparams/armelf.sh (OTHER_READONLY_SECTIONS)
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 2d0382815f..7fdf7f4058 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -815,6 +815,20 @@ exp_fold_tree_1 (etree_type *tree)
h->u.def.section = expld.result.section;
if (tree->type.node_class == etree_provide)
tree->type.node_class = etree_provided;
+
+ /* Copy the symbol type if this is a simple assignment of
+ one symbol to annother. */
+ if (tree->assign.src->type.node_class == etree_name)
+ {
+ struct bfd_link_hash_entry *hsrc;
+
+ hsrc = bfd_link_hash_lookup (link_info.hash,
+ tree->assign.src->name.name,
+ FALSE, FALSE, TRUE);
+ if (hsrc)
+ bfd_copy_link_hash_symbol_type (link_info.output_bfd, h,
+ hsrc);
+ }
}
}
break;
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 91d3c7fa4b..537c2d6e8e 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-23 Paul Brook <paul@codesourcery.com>
+
+ * ld-arm/script-type.sym: New test.
+ * ld-arm/script-type.s: New test.
+ * ld-arm/script-type.s: New test.
+
2009-11-20 Thomas Schwinge <thomas@codesourcery.com>
* ld-arm/arm-dyn.ld: Adapt to main linker script changes.
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 21ec2254b6..8fbf8df29f 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -227,6 +227,9 @@ set armelftests {
{"jump19" "-static -T arm.ld" "" {jump19.s}
{{objdump -dr jump19.d}}
"jump19"}
+ {"script-type" "-static -T script-type.ld" "" {script-type.s}
+ {{readelf -s script-type.sym}}
+ "script-type"}
{"callweak" "-static -T arm.ld" "" {callweak.s}
{{objdump -dr callweak.d}}
"callweak"}
diff --git a/ld/testsuite/ld-arm/script-type.ld b/ld/testsuite/ld-arm/script-type.ld
new file mode 100644
index 0000000000..684fc97275
--- /dev/null
+++ b/ld/testsuite/ld-arm/script-type.ld
@@ -0,0 +1,7 @@
+SECTIONS {
+ foo_a = bar_a;
+ foo_t = bar_t;
+ foo_o = bar_o;
+ .text : { *(.text) }
+ .ARM.attribues 0 : { *(.ARM.attributes) }
+}
diff --git a/ld/testsuite/ld-arm/script-type.s b/ld/testsuite/ld-arm/script-type.s
new file mode 100644
index 0000000000..f9d41e861c
--- /dev/null
+++ b/ld/testsuite/ld-arm/script-type.s
@@ -0,0 +1,20 @@
+.syntax unified
+.text
+.global bar_a
+.type bar_a %function
+bar_a:
+bx lr
+
+.p2align 4
+.global bar_o
+.type bar_o %object
+bar_o:
+.word 0
+
+.p2align 4
+.thumb
+.global bar_t
+.type bar_t %function
+bar_t:
+bx lr
+
diff --git a/ld/testsuite/ld-arm/script-type.sym b/ld/testsuite/ld-arm/script-type.sym
new file mode 100644
index 0000000000..4e00da3d2f
--- /dev/null
+++ b/ld/testsuite/ld-arm/script-type.sym
@@ -0,0 +1,15 @@
+
+Symbol table '.symtab' contains 12 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00000000 0 SECTION LOCAL DEFAULT 1
+ 2: 00000000 0 SECTION LOCAL DEFAULT 2
+ 3: 00000000 0 NOTYPE LOCAL DEFAULT 1 \$a
+ 4: 00000010 0 NOTYPE LOCAL DEFAULT 1 \$d
+ 5: 00000020 0 NOTYPE LOCAL DEFAULT 1 \$t
+ 6: 00000010 0 OBJECT GLOBAL DEFAULT 1 bar_o
+ 7: 00000021 0 FUNC GLOBAL DEFAULT 1 bar_t
+ 8: 00000000 0 FUNC GLOBAL DEFAULT 1 foo_a
+ 9: 00000021 0 FUNC GLOBAL DEFAULT 1 foo_t
+ 10: 00000010 0 OBJECT GLOBAL DEFAULT 1 foo_o
+ 11: 00000000 0 FUNC GLOBAL DEFAULT 1 bar_a