aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
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 31985e3..4a93d2c 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 2d03828..7fdf7f4 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 91d3c7f..537c2d6 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 21ec225..8fbf8df 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 0000000..684fc97
--- /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 0000000..f9d41e8
--- /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 0000000..4e00da3
--- /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