|
|
881b8e |
diff -Nrup a/bfd/bfd-in2.h b/bfd/bfd-in2.h
|
|
|
881b8e |
--- a/bfd/bfd-in2.h 2014-08-21 16:03:53.583828269 -0400
|
|
|
881b8e |
+++ b/bfd/bfd-in2.h 2014-08-21 15:59:59.969022057 -0400
|
|
|
881b8e |
@@ -6707,7 +6707,8 @@ typedef struct bfd_target
|
|
|
881b8e |
/* Indicate that we are only retrieving symbol values from this section. */
|
|
|
881b8e |
void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
|
|
|
881b8e |
|
|
|
881b8e |
- /* Copy the symbol type of a linker hash table entry. */
|
|
|
881b8e |
+ /* Copy the symbol type and other attributes for a linker script
|
|
|
881b8e |
+ assignment of one symbol to another. */
|
|
|
881b8e |
#define bfd_copy_link_hash_symbol_type(b, t, f) \
|
|
|
881b8e |
BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
|
|
|
881b8e |
void (*_bfd_copy_link_hash_symbol_type)
|
|
|
881b8e |
diff -Nrup a/bfd/elflink.c b/bfd/elflink.c
|
|
|
881b8e |
--- a/bfd/elflink.c 2014-08-21 16:03:53.729901009 -0400
|
|
|
881b8e |
+++ b/bfd/elflink.c 2014-08-21 15:59:59.983030963 -0400
|
|
|
881b8e |
@@ -13156,17 +13156,24 @@ _bfd_elf_make_dynamic_reloc_section (ase
|
|
|
881b8e |
return reloc_sec;
|
|
|
881b8e |
}
|
|
|
881b8e |
|
|
|
881b8e |
-/* Copy the ELF symbol type associated with a linker hash entry. */
|
|
|
881b8e |
+/* Copy the ELF symbol type and other attributes for a linker script
|
|
|
881b8e |
+ assignment from HSRC to HDEST. Generally this should be treated as
|
|
|
881b8e |
+ if we found a strong non-dynamic definition for HDEST (except that
|
|
|
881b8e |
+ ld ignores multiple definition errors). */
|
|
|
881b8e |
void
|
|
|
881b8e |
-_bfd_elf_copy_link_hash_symbol_type (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
881b8e |
- struct bfd_link_hash_entry * hdest,
|
|
|
881b8e |
- struct bfd_link_hash_entry * hsrc)
|
|
|
881b8e |
-{
|
|
|
881b8e |
- struct elf_link_hash_entry *ehdest = (struct elf_link_hash_entry *)hdest;
|
|
|
881b8e |
- struct elf_link_hash_entry *ehsrc = (struct elf_link_hash_entry *)hsrc;
|
|
|
881b8e |
+_bfd_elf_copy_link_hash_symbol_type (bfd *abfd,
|
|
|
881b8e |
+ struct bfd_link_hash_entry *hdest,
|
|
|
881b8e |
+ struct bfd_link_hash_entry *hsrc)
|
|
|
881b8e |
+{
|
|
|
881b8e |
+ struct elf_link_hash_entry *ehdest = (struct elf_link_hash_entry *) hdest;
|
|
|
881b8e |
+ struct elf_link_hash_entry *ehsrc = (struct elf_link_hash_entry *) hsrc;
|
|
|
881b8e |
+ Elf_Internal_Sym isym;
|
|
|
881b8e |
|
|
|
881b8e |
ehdest->type = ehsrc->type;
|
|
|
881b8e |
ehdest->target_internal = ehsrc->target_internal;
|
|
|
881b8e |
+
|
|
|
881b8e |
+ isym.st_other = ehsrc->other;
|
|
|
881b8e |
+ elf_merge_st_other (abfd, ehdest, &isym, TRUE, FALSE);
|
|
|
881b8e |
}
|
|
|
881b8e |
|
|
|
881b8e |
/* Append a RELA relocation REL to section S in BFD. */
|
|
|
881b8e |
diff -Nrup a/bfd/linker.c b/bfd/linker.c
|
|
|
881b8e |
--- a/bfd/linker.c 2013-02-27 15:28:03.000000000 -0500
|
|
|
881b8e |
+++ b/bfd/linker.c 2014-08-21 15:59:59.990852110 -0400
|
|
|
881b8e |
@@ -815,14 +815,13 @@ _bfd_generic_link_just_syms (asection *s
|
|
|
881b8e |
sec->output_offset = sec->vma;
|
|
|
881b8e |
}
|
|
|
881b8e |
|
|
|
881b8e |
-/* Copy the type of a symbol assiciated with a linker hast table entry.
|
|
|
881b8e |
- Override this so that symbols created in linker scripts get their
|
|
|
881b8e |
- type from the RHS of the assignment.
|
|
|
881b8e |
+/* Copy the symbol type and other attributes for a linker script
|
|
|
881b8e |
+ assignment from HSRC to HDEST.
|
|
|
881b8e |
The default implementation does nothing. */
|
|
|
881b8e |
void
|
|
|
881b8e |
_bfd_generic_copy_link_hash_symbol_type (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
881b8e |
- struct bfd_link_hash_entry * hdest ATTRIBUTE_UNUSED,
|
|
|
881b8e |
- struct bfd_link_hash_entry * hsrc ATTRIBUTE_UNUSED)
|
|
|
881b8e |
+ struct bfd_link_hash_entry *hdest ATTRIBUTE_UNUSED,
|
|
|
881b8e |
+ struct bfd_link_hash_entry *hsrc ATTRIBUTE_UNUSED)
|
|
|
881b8e |
{
|
|
|
881b8e |
}
|
|
|
881b8e |
|
|
|
881b8e |
diff -Nrup a/bfd/targets.c b/bfd/targets.c
|
|
|
881b8e |
--- a/bfd/targets.c 2013-02-27 15:28:03.000000000 -0500
|
|
|
881b8e |
+++ b/bfd/targets.c 2014-08-21 15:59:59.995830496 -0400
|
|
|
881b8e |
@@ -484,7 +484,8 @@ BFD_JUMP_TABLE macros.
|
|
|
881b8e |
. {* Indicate that we are only retrieving symbol values from this section. *}
|
|
|
881b8e |
. void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
|
|
|
881b8e |
.
|
|
|
881b8e |
-. {* Copy the symbol type of a linker hash table entry. *}
|
|
|
881b8e |
+. {* Copy the symbol type and other attributes for a linker script
|
|
|
881b8e |
+. assignment of one symbol to another. *}
|
|
|
881b8e |
.#define bfd_copy_link_hash_symbol_type(b, t, f) \
|
|
|
881b8e |
. BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
|
|
|
881b8e |
. void (*_bfd_copy_link_hash_symbol_type)
|
|
|
881b8e |
diff -Nrup a/ld/testsuite/ld-powerpc/defsym.d b/ld/testsuite/ld-powerpc/defsym.d
|
|
|
881b8e |
--- a/ld/testsuite/ld-powerpc/defsym.d 1969-12-31 19:00:00.000000000 -0500
|
|
|
881b8e |
+++ b/ld/testsuite/ld-powerpc/defsym.d 2014-08-21 15:59:59.998828366 -0400
|
|
|
881b8e |
@@ -0,0 +1,26 @@
|
|
|
881b8e |
+#source: defsym.s
|
|
|
881b8e |
+#as: -a64
|
|
|
881b8e |
+#ld: -melf64ppc --defsym bar=foo
|
|
|
881b8e |
+#objdump: -Dr
|
|
|
881b8e |
+
|
|
|
881b8e |
+.*: file format elf64-powerpc.*
|
|
|
881b8e |
+
|
|
|
881b8e |
+Disassembly of section \.text:
|
|
|
881b8e |
+
|
|
|
881b8e |
+0+100000b0 <_start>:
|
|
|
881b8e |
+ 100000b0: (15 00 00 48|48 00 00 15) bl 100000c4 <(foo|bar)\+0x8>
|
|
|
881b8e |
+ 100000b4: (11 00 00 48|48 00 00 11) bl 100000c4 <(foo|bar)\+0x8>
|
|
|
881b8e |
+ 100000b8: (00 00 00 60|60 00 00 00) nop
|
|
|
881b8e |
+
|
|
|
881b8e |
+0+100000bc <(foo|bar)>:
|
|
|
881b8e |
+ 100000bc: (02 10 40 3c|3c 40 10 02) lis r2,4098
|
|
|
881b8e |
+ 100000c0: (c8 80 42 38|38 42 80 c8) addi r2,r2,-32568
|
|
|
881b8e |
+ 100000c4: (20 00 80 4e|4e 80 00 20) blr
|
|
|
881b8e |
+
|
|
|
881b8e |
+Disassembly of section \.data:
|
|
|
881b8e |
+
|
|
|
881b8e |
+0+100100c8 .*:
|
|
|
881b8e |
+ 100100c8: (bc 00 00 10|00 00 00 00) .*
|
|
|
881b8e |
+ 100100cc: (00 00 00 00|10 00 00 bc) .*
|
|
|
881b8e |
+ 100100d0: (bc 00 00 10|00 00 00 00) .*
|
|
|
881b8e |
+ 100100d4: (00 00 00 00|10 00 00 bc) .*
|
|
|
881b8e |
diff -Nrup a/ld/testsuite/ld-powerpc/defsym.s b/ld/testsuite/ld-powerpc/defsym.s
|
|
|
881b8e |
--- a/ld/testsuite/ld-powerpc/defsym.s 1969-12-31 19:00:00.000000000 -0500
|
|
|
881b8e |
+++ b/ld/testsuite/ld-powerpc/defsym.s 2014-08-21 15:59:59.999832192 -0400
|
|
|
881b8e |
@@ -0,0 +1,19 @@
|
|
|
881b8e |
+ .text
|
|
|
881b8e |
+ .globl _start
|
|
|
881b8e |
+_start:
|
|
|
881b8e |
+ bl foo
|
|
|
881b8e |
+ bl bar
|
|
|
881b8e |
+ nop
|
|
|
881b8e |
+
|
|
|
881b8e |
+ .globl foo
|
|
|
881b8e |
+ .type foo,@function
|
|
|
881b8e |
+foo:
|
|
|
881b8e |
+ addis 2,12,.TOC.-foo@ha
|
|
|
881b8e |
+ addi 2,2,.TOC.-foo@l
|
|
|
881b8e |
+ .localentry foo,.-foo
|
|
|
881b8e |
+ blr
|
|
|
881b8e |
+ .size foo,.-foo
|
|
|
881b8e |
+
|
|
|
881b8e |
+ .data
|
|
|
881b8e |
+ .dc.a foo
|
|
|
881b8e |
+ .dc.a bar
|
|
|
881b8e |
diff -Nrup a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
|
|
|
881b8e |
--- a/ld/testsuite/ld-powerpc/powerpc.exp 2014-08-21 16:03:53.866828736 -0400
|
|
|
881b8e |
+++ b/ld/testsuite/ld-powerpc/powerpc.exp 2014-08-21 16:06:09.309893786 -0400
|
|
|
881b8e |
@@ -275,6 +275,7 @@ if [ supports_ppc64 ] then {
|
|
|
881b8e |
run_dump_test "elfv2exe"
|
|
|
881b8e |
run_dump_test "ambiguousv1"
|
|
|
881b8e |
run_dump_test "ambiguousv2"
|
|
|
881b8e |
+ run_dump_test "defsym"
|
|
|
881b8e |
}
|
|
|
881b8e |
|
|
|
881b8e |
if { [istarget "powerpc*-eabi*"] } {
|