2009-11-23 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Mon, 23 Nov 2009 14:41:33 +0000 (14:41 +0000)
committerPaul Brook <paul@codesourcery.com>
Mon, 23 Nov 2009 14:41:33 +0000 (14:41 +0000)
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.

41 files changed:
bfd/ChangeLog
bfd/aout-adobe.c
bfd/aout-target.h
bfd/aout-tic30.c
bfd/bfd-in2.h
bfd/binary.c
bfd/bout.c
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/coffcode.h
bfd/elf-bfd.h
bfd/elflink.c
bfd/elfxx-target.h
bfd/i386msdos.c
bfd/i386os9k.c
bfd/ieee.c
bfd/ihex.c
bfd/libbfd-in.h
bfd/libbfd.h
bfd/libecoff.h
bfd/linker.c
bfd/mach-o-target.c
bfd/mmo.c
bfd/nlm-target.h
bfd/oasys.c
bfd/pef.c
bfd/ppcboot.c
bfd/som.c
bfd/srec.c
bfd/targets.c
bfd/tekhex.c
bfd/versados.c
bfd/vms.c
bfd/xsym.c
ld/ChangeLog
ld/ldexp.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-arm/script-type.ld [new file with mode: 0644]
ld/testsuite/ld-arm/script-type.s [new file with mode: 0644]
ld/testsuite/ld-arm/script-type.sym [new file with mode: 0644]

index a3b9a8fe4b8c51630f8831b451cb73a3855e88d8..2f7a85d8efbbfdd4cc5b682960d72310d66be2ce 100644 (file)
@@ -1,3 +1,43 @@
+2009-11-23  Paul Brook  <paul@codesourcery.com>
+
+       * 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.
+
 2009-11-19  Tristan Gingold  <gingold@adacore.com>
 
        * coff-rs6000.c (rs6000coff_vec): Use generic routines instead of
index 02f6ccbb35f66339f9e3ec61e610a6d7208eb3d4..ca0e0035d29ff05f88598505ad39caded53fcc44 100644 (file)
@@ -468,6 +468,8 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
 #define aout_32_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
 #define aout_32_bfd_link_add_symbols               _bfd_generic_link_add_symbols
 #define aout_32_bfd_link_just_syms                 _bfd_generic_link_just_syms
+#define aout_32_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define aout_32_bfd_final_link                     _bfd_generic_final_link
 #define aout_32_bfd_link_split_section             _bfd_generic_link_split_section
 
index 96d7f971574127a53c78176b12d9c6ba1414ff8f..39c8d34c1ae4669a76d94be2e427df9fb2be0284 100644 (file)
@@ -523,6 +523,10 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
 #ifndef MY_bfd_link_just_syms
 #define MY_bfd_link_just_syms _bfd_generic_link_just_syms
 #endif
+#ifndef MY_bfd_copy_link_hash_symbol_type
+#define MY_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
+#endif
 #ifndef MY_bfd_link_split_section
 #define MY_bfd_link_split_section  _bfd_generic_link_split_section
 #endif
index ef74fa6d9683be7f925497b113551fad32c89c45..feaec8a8c7d375ebe8efd29b33d425c8528a3913 100644 (file)
@@ -980,6 +980,10 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #ifndef MY_bfd_link_just_syms
 #define MY_bfd_link_just_syms _bfd_generic_link_just_syms
 #endif
+#ifndef MY_bfd_copy_link_hash_symbol_type
+#define MY_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
+#endif
 #ifndef MY_bfd_link_split_section
 #define MY_bfd_link_split_section  _bfd_generic_link_split_section
 #endif
index 455ec5696fc4f17498d0181cb929ddafab7ee3c1..aa58ca659fde18a3a9c252b8939abe22f98a9ed3 100644 (file)
@@ -5601,6 +5601,7 @@ typedef struct bfd_target
   NAME##_bfd_link_hash_table_free, \
   NAME##_bfd_link_add_symbols, \
   NAME##_bfd_link_just_syms, \
+  NAME##_bfd_copy_link_hash_symbol_type, \
   NAME##_bfd_final_link, \
   NAME##_bfd_link_split_section, \
   NAME##_bfd_gc_sections, \
@@ -5632,6 +5633,12 @@ typedef struct bfd_target
   /* Indicate that we are only retrieving symbol values from this section.  */
   void        (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
 
+  /* Copy the symbol type of a linker hash table entry.  */
+#define bfd_copy_link_hash_symbol_type(b, t, f) \
+  BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
+  void (*_bfd_copy_link_hash_symbol_type)
+    (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
+
   /* Do a link based on the link_order structures attached to each
      section of the BFD.  */
   bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
index d264a09209e6d95a0c3f787dbc8f3b14ebe972cf..2af0293ef4c4e6db52c1868491a0fe3d8d3bf276 100644 (file)
@@ -307,6 +307,8 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define binary_bfd_link_hash_table_create         _bfd_generic_link_hash_table_create
 #define binary_bfd_link_hash_table_free           _bfd_generic_link_hash_table_free
 #define binary_bfd_link_just_syms                 _bfd_generic_link_just_syms
+#define binary_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define binary_bfd_link_add_symbols               _bfd_generic_link_add_symbols
 #define binary_bfd_final_link                     _bfd_generic_final_link
 #define binary_bfd_link_split_section             _bfd_generic_link_split_section
index f2721e87e5952480eee7f2aa24ef3ed8df88cd73..ad53d8fc320810b03aa3e1df4a6ef7e021398e67 100644 (file)
@@ -1386,6 +1386,8 @@ b_out_bfd_get_relocated_section_contents (bfd *output_bfd,
 #define b_out_bfd_link_hash_table_free         _bfd_generic_link_hash_table_free
 #define b_out_bfd_link_add_symbols             _bfd_generic_link_add_symbols
 #define b_out_bfd_link_just_syms               _bfd_generic_link_just_syms
+#define b_out_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define b_out_bfd_final_link                   _bfd_generic_final_link
 #define b_out_bfd_link_split_section           _bfd_generic_link_split_section
 #define b_out_bfd_gc_sections                  bfd_generic_gc_sections
index 2482cfbc7e19b1ee6b283dc0e2e0ec29bac82169..2ee74ecf574a58f4cf29d0523193827a26a9cd22 100644 (file)
@@ -4230,6 +4230,7 @@ const bfd_target rs6000coff_vec =
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
     _bfd_generic_link_just_syms,
+    _bfd_generic_copy_link_hash_symbol_type,
     _bfd_xcoff_bfd_final_link,
     _bfd_generic_link_split_section,
     bfd_generic_gc_sections,
@@ -4483,6 +4484,7 @@ const bfd_target pmac_xcoff_vec =
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
     _bfd_generic_link_just_syms,
+    _bfd_generic_copy_link_hash_symbol_type,
     _bfd_xcoff_bfd_final_link,
     _bfd_generic_link_split_section,
     bfd_generic_gc_sections,
index 9b653e62b91d30255f74282262219bdb3c58bd9d..4d618c1acc23f6390ec441879c11b18136956ba8 100644 (file)
@@ -2800,6 +2800,7 @@ const bfd_target rs6000coff64_vec =
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
     _bfd_generic_link_just_syms,
+    _bfd_generic_copy_link_hash_symbol_type,
     _bfd_xcoff_bfd_final_link,
     _bfd_generic_link_split_section,
     bfd_generic_gc_sections,
@@ -3054,6 +3055,7 @@ const bfd_target aix5coff64_vec =
     _bfd_generic_link_hash_table_free,
     _bfd_xcoff_bfd_link_add_symbols,
     _bfd_generic_link_just_syms,
+    _bfd_generic_copy_link_hash_symbol_type,
     _bfd_xcoff_bfd_final_link,
     _bfd_generic_link_split_section,
     bfd_generic_gc_sections,
index 19f4159ac3185a0410fce8633e65766161278f26..55c54deb77a86c9144c0fcbcf5142b4d4bf44541 100644 (file)
@@ -5328,6 +5328,8 @@ dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED,
 #endif /* ! defined (coff_relocate_section) */
 
 #define coff_bfd_link_just_syms      _bfd_generic_link_just_syms
+#define coff_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define coff_bfd_link_split_section  _bfd_generic_link_split_section
 
 #ifndef coff_start_final_link
index 7cc420c7a8f4774c7f59a9f5a8bfe447f51ae111..daa2b62d9a5966e9aa157d657b7333f391ec7f5e 100644 (file)
@@ -1751,6 +1751,8 @@ extern asection *_bfd_elf_check_kept_section
   (asection *, struct bfd_link_info *);
 extern void _bfd_elf_link_just_syms
   (asection *, struct bfd_link_info *);
+extern void _bfd_elf_copy_link_hash_symbol_type
+  (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
 extern bfd_boolean _bfd_elf_copy_private_header_data
   (bfd *, bfd *);
 extern bfd_boolean _bfd_elf_copy_private_symbol_data
index 0153411ae850e2e2a05fca55050588c19f02a47b..8e29154e6e35a9cfd93d4d212c1bcd19de024d5e 100644 (file)
@@ -12596,3 +12596,15 @@ _bfd_elf_make_dynamic_reloc_section (asection *         sec,
 
   return reloc_sec;
 }
+
+/* Copy the ELF symbol type associated with a linker hash entry.  */
+void
+_bfd_elf_copy_link_hash_symbol_type (bfd *abfd ATTRIBUTE_UNUSED,
+    struct bfd_link_hash_entry * hdest,
+    struct bfd_link_hash_entry * hsrc)
+{
+  struct elf_link_hash_entry *ehdest = (struct elf_link_hash_entry *)hdest;
+  struct elf_link_hash_entry *ehsrc = (struct elf_link_hash_entry *)hsrc;
+
+  ehdest->type = ehsrc->type;
+}
index 413f273f8b9f1a053bc59f513d87974febcb75a4..ebce6a8f07a850ce70c9f8866b78a9ee7a82b932 100644 (file)
 #define bfd_elfNN_bfd_link_just_syms   _bfd_elf_link_just_syms
 #endif
 
+#ifndef bfd_elfNN_bfd_copy_link_hash_symbol_type
+#define bfd_elfNN_bfd_copy_link_hash_symbol_type \
+  _bfd_elf_copy_link_hash_symbol_type
+#endif
+
 #ifndef bfd_elfNN_bfd_link_split_section
 #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
 #endif
index 2059d9cafc1cfeaf08c85e79fbe7a66339c54984..95d9775cf7bc4ef4a53c7acb3aa33d3923d9ac57 100644 (file)
@@ -153,6 +153,8 @@ msdos_set_section_contents (bfd *abfd,
 #define msdos_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define msdos_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define msdos_bfd_link_just_syms _bfd_generic_link_just_syms
+#define msdos_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define msdos_bfd_final_link _bfd_generic_final_link
 #define msdos_bfd_link_split_section _bfd_generic_link_split_section
 #define msdos_set_arch_mach _bfd_generic_set_arch_mach
index 4c33a6e67ecd681a279f316ea96d1482f5488001..a5e89208df0acdca872aa61fb59c361fe5ae32ba 100644 (file)
@@ -177,6 +177,8 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define os9k_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define os9k_bfd_link_just_syms _bfd_generic_link_just_syms
+#define os9k_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define os9k_bfd_final_link _bfd_generic_final_link
 #define os9k_bfd_link_split_section  _bfd_generic_link_split_section
 
index 1fecf5ae325e5ac43ffa09b3dd7b1bc8554e1d11..68bdd5ed57a6147a26ca62081eff7d6ab996c6d6 100644 (file)
@@ -3775,6 +3775,8 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
+#define ieee_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define ieee_bfd_final_link _bfd_generic_final_link
 #define ieee_bfd_link_split_section  _bfd_generic_link_split_section
 
index aaad6d7b46d162a5890f96ee8bf3bd8bde0c1850..6a9816c0b5fd6f7e12132bb3d71c7aeda45d86ef 100644 (file)
@@ -939,6 +939,8 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define ihex_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
 #define ihex_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
 #define ihex_bfd_link_just_syms                   _bfd_generic_link_just_syms
+#define ihex_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define ihex_bfd_final_link                       _bfd_generic_final_link
 #define ihex_bfd_link_split_section               _bfd_generic_link_split_section
 
index 2e441db7e7d2b71be15185903726a374e811e9bd..8c6f9b6321d6509e4e38b46429822c245d4517db 100644 (file)
@@ -410,6 +410,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
 #define _bfd_nolink_bfd_link_just_syms \
   ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
+#define _bfd_nolink_bfd_copy_link_hash_symbol_type \
+  ((void (*) (bfd *, struct bfd_link_hash_entry *, \
+             struct bfd_link_hash_entry *)) bfd_void)
 #define _bfd_nolink_bfd_final_link \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
 #define _bfd_nolink_bfd_link_split_section \
@@ -524,6 +527,10 @@ extern bfd_boolean _bfd_generic_link_add_one_symbol
 extern void _bfd_generic_link_just_syms
   (asection *, struct bfd_link_info *);
 
+/* Generic routine that does nothing.  */
+extern void _bfd_generic_copy_link_hash_symbol_type
+  (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
+
 /* Generic link routine.  */
 extern bfd_boolean _bfd_generic_final_link
   (bfd *, struct bfd_link_info *);
index 7fe65789bd7f6e09947270cccea0d8a455c1b893..8146ef9011617520bdac9a00ae37e209519308ad 100644 (file)
@@ -415,6 +415,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
 #define _bfd_nolink_bfd_link_just_syms \
   ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
+#define _bfd_nolink_bfd_copy_link_hash_symbol_type \
+  ((void (*) (bfd *, struct bfd_link_hash_entry *, \
+             struct bfd_link_hash_entry *)) bfd_void)
 #define _bfd_nolink_bfd_final_link \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
 #define _bfd_nolink_bfd_link_split_section \
@@ -529,6 +532,10 @@ extern bfd_boolean _bfd_generic_link_add_one_symbol
 extern void _bfd_generic_link_just_syms
   (asection *, struct bfd_link_info *);
 
+/* Generic routine that does nothing.  */
+extern void _bfd_generic_copy_link_hash_symbol_type
+  (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
+
 /* Generic link routine.  */
 extern bfd_boolean _bfd_generic_final_link
   (bfd *, struct bfd_link_info *);
index 0e7ea855c5553deef574a691bc78e7d40268cbbc..75c65e7fbe0a161cb7ebb8ec8b0b0064d46fe56e 100644 (file)
@@ -315,6 +315,8 @@ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
 extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols
   (bfd *, struct bfd_link_info *);
 #define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms
+#define _bfd_ecoff_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 extern bfd_boolean _bfd_ecoff_bfd_final_link
   (bfd *, struct bfd_link_info *);
 
index 1163a5591c1436800ce233a0a6e958d37afa9f3b..76bc70af0933c2351fe014172722e7f2572825aa 100644 (file)
@@ -797,6 +797,17 @@ _bfd_generic_link_just_syms (asection *sec,
   sec->output_offset = sec->vma;
 }
 
+/* Copy the type of a symbol assiciated with a linker hast table entry.
+   Override this so that symbols created in linker scripts get their
+   type from the RHS of the assignment.
+   The default implementation does nothing.  */
+void
+_bfd_generic_copy_link_hash_symbol_type (bfd *abfd ATTRIBUTE_UNUSED,
+    struct bfd_link_hash_entry * hdest ATTRIBUTE_UNUSED,
+    struct bfd_link_hash_entry * hsrc ATTRIBUTE_UNUSED)
+{
+}
+
 /* Add symbols from an object file to the global hash table.  */
 
 static bfd_boolean
index c3084673e995ec66c3397463ca58326a153206e4..2a30b2ed1f611325ed49c1cc8b1d82667e4130eb 100644 (file)
@@ -53,6 +53,8 @@
 #define bfd_mach_o_bfd_link_hash_table_free           _bfd_generic_link_hash_table_free
 #define bfd_mach_o_bfd_link_add_symbols               _bfd_generic_link_add_symbols
 #define bfd_mach_o_bfd_link_just_syms                 _bfd_generic_link_just_syms
+#define bfd_mach_o_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define bfd_mach_o_bfd_final_link                     _bfd_generic_final_link
 #define bfd_mach_o_bfd_link_split_section             _bfd_generic_link_split_section
 #define bfd_mach_o_set_arch_mach                      bfd_default_set_arch_mach
index 39cc2699e06e386da818ad06045c1e9bdfef4d5f..eee27c3a269a97a7ab3e50d050a4879afa044bbb 100644 (file)
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3199,6 +3199,8 @@ mmo_write_object_contents (bfd *abfd)
 #define mmo_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define mmo_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define mmo_bfd_link_just_syms _bfd_generic_link_just_syms
+#define mmo_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define mmo_bfd_final_link _bfd_generic_final_link
 #define mmo_bfd_link_split_section _bfd_generic_link_split_section
 
index 809019066a8066fc4f234afe02a2418d07382ba3..add69372d2384ebc02320c20845179a146e0ee8c 100644 (file)
@@ -54,6 +54,8 @@
 #define nlm_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
 #define nlm_bfd_link_add_symbols                _bfd_generic_link_add_symbols
 #define nlm_bfd_link_just_syms                  _bfd_generic_link_just_syms
+#define nlm_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define nlm_bfd_final_link                      _bfd_generic_final_link
 #define nlm_bfd_link_split_section              _bfd_generic_link_split_section
 
index aad22a12ff3c9abfaeaee26cbfdcd85a95db72d6..17714ec2078acb707becac0e4737f570cba0ca1a 100644 (file)
@@ -1203,6 +1203,8 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define oasys_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
 #define oasys_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
 #define oasys_bfd_link_just_syms                   _bfd_generic_link_just_syms
+#define oasys_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define oasys_bfd_final_link                       _bfd_generic_final_link
 #define oasys_bfd_link_split_section               _bfd_generic_link_split_section
 
index 4fcae1e5435f568d3d14bb2afe82c77a8de073c6..b7156f06234a2662c3e1958a6a2a5c3c8dda12e2 100644 (file)
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -57,6 +57,8 @@
 #define bfd_pef_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
 #define bfd_pef_bfd_link_add_symbols                _bfd_generic_link_add_symbols
 #define bfd_pef_bfd_link_just_syms                  _bfd_generic_link_just_syms
+#define bfd_pef_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define bfd_pef_bfd_final_link                      _bfd_generic_final_link
 #define bfd_pef_bfd_link_split_section              _bfd_generic_link_split_section
 #define bfd_pef_get_section_contents_in_window      _bfd_generic_get_section_contents_in_window
index 0d9a3bcdfaca7b722a17390612ce890df696af3e..853ee88fcf8d80ec5ace773d6a9e8726ca7ec83c 100644 (file)
@@ -480,6 +480,8 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
 #define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms
+#define ppcboot_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define ppcboot_bfd_final_link _bfd_generic_final_link
 #define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
 #define ppcboot_get_section_contents_in_window \
index 0fb8e1de37b14e15b83d385ab96f78f6b4c1a868..f259da805508016b19900e438cbc80795e143208 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6343,6 +6343,8 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
 #define som_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
 #define som_bfd_link_add_symbols                _bfd_generic_link_add_symbols
 #define som_bfd_link_just_syms                  _bfd_generic_link_just_syms
+#define som_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define som_bfd_final_link                      _bfd_generic_final_link
 #define som_bfd_gc_sections                    bfd_generic_gc_sections
 #define som_bfd_merge_sections                 bfd_generic_merge_sections
index d66fa6d99d87dd9c70b6c410ce131529c26c60cf..1251a7e93c9c353382590203ec8315645c6fe2ea 100644 (file)
@@ -1261,6 +1261,8 @@ srec_print_symbol (bfd *abfd,
 #define srec_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
 #define srec_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
 #define srec_bfd_link_just_syms                   _bfd_generic_link_just_syms
+#define srec_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define srec_bfd_final_link                       _bfd_generic_final_link
 #define srec_bfd_link_split_section               _bfd_generic_link_split_section
 
index 31ec42f4784df1ac4e6c8e73dd1bbb4f5a8877ee..d9811a8010954a12282ab8b9509f86f79f3887ac 100644 (file)
@@ -436,6 +436,7 @@ BFD_JUMP_TABLE macros.
 .  NAME##_bfd_link_hash_table_free, \
 .  NAME##_bfd_link_add_symbols, \
 .  NAME##_bfd_link_just_syms, \
+.  NAME##_bfd_copy_link_hash_symbol_type, \
 .  NAME##_bfd_final_link, \
 .  NAME##_bfd_link_split_section, \
 .  NAME##_bfd_gc_sections, \
@@ -467,6 +468,12 @@ BFD_JUMP_TABLE macros.
 .  {* Indicate that we are only retrieving symbol values from this section.  *}
 .  void        (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
 .
+.  {* Copy the symbol type of a linker hash table entry.  *}
+.#define bfd_copy_link_hash_symbol_type(b, t, f) \
+.  BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
+.  void (*_bfd_copy_link_hash_symbol_type)
+.    (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
+.
 .  {* Do a link based on the link_order structures attached to each
 .     section of the BFD.  *}
 .  bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
index 0be3ab967574b070cfb2a79a742f34a499921b59..bc3c9ca9bc5f97114b530531e1a540b0906e41b2 100644 (file)
@@ -952,6 +952,8 @@ tekhex_print_symbol (bfd *abfd,
 #define tekhex_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
 #define tekhex_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
 #define tekhex_bfd_link_just_syms                   _bfd_generic_link_just_syms
+#define tekhex_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define tekhex_bfd_final_link                       _bfd_generic_final_link
 #define tekhex_bfd_link_split_section               _bfd_generic_link_split_section
 #define tekhex_get_section_contents_in_window       _bfd_generic_get_section_contents_in_window
index 8fbc17b8d3c4910fd05616a36bf72e4085c00d39..f3de87188bb82d46bec74270f674216a7209aee6 100644 (file)
@@ -813,6 +813,8 @@ versados_canonicalize_reloc (bfd *abfd,
 #define versados_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
 #define versados_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
 #define versados_bfd_link_just_syms                   _bfd_generic_link_just_syms
+#define versados_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define versados_bfd_final_link                       _bfd_generic_final_link
 #define versados_bfd_link_split_section               _bfd_generic_link_split_section
 
index 61f485ed683e2a7bb1ecb7362d9e5de93f0502aa..76b59b38091b174be0bf5967839018db722bc4e3 100644 (file)
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -140,6 +140,8 @@ static bfd_boolean vms_bfd_set_private_flags (bfd *abfd, flagword flags);
 #define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define vms_make_empty_symbol             _bfd_generic_make_empty_symbol
 #define vms_bfd_link_just_syms            _bfd_generic_link_just_syms
+#define vms_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define vms_bfd_is_group_section          bfd_generic_is_group_section
 #define vms_bfd_discard_group             bfd_generic_discard_group
 #define vms_section_already_linked        _bfd_generic_section_already_linked
index 706310ac6166c73b061f2775c7e2bff50076c238..dd1ffd77731dc34c219faaf87b3f678f800ae9f7 100644 (file)
@@ -51,6 +51,8 @@
 #define bfd_sym_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
 #define bfd_sym_bfd_link_add_symbols                _bfd_generic_link_add_symbols
 #define bfd_sym_bfd_link_just_syms                  _bfd_generic_link_just_syms
+#define bfd_sym_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define bfd_sym_bfd_final_link                      _bfd_generic_final_link
 #define bfd_sym_bfd_link_split_section              _bfd_generic_link_split_section
 #define bfd_sym_get_section_contents_in_window      _bfd_generic_get_section_contents_in_window
index 31985e38f1262c14ae1c8b903273831d1039ea2a..4a93d2c064e6d0b33787ba6dd2e85808fbae8630 100644 (file)
@@ -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)
index 2d0382815f1e5b333294bb90f1195e2b6f0040eb..7fdf7f40587d16bd0ff6f98f5f446c3c2a725a7d 100644 (file)
@@ -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;
index 91d3c7fa4b4b0a958fd93497772ac646b16aa151..537c2d6e8ea33f20abb2cace251d15dd35869094 100644 (file)
@@ -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.
index 21ec2254b636a46d0d64a3d30dccd0f5e2c438b1..8fbf8df29f9e8122cf562d3ecfcbc067367c74c0 100644 (file)
@@ -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 (file)
index 0000000..684fc97
--- /dev/null
@@ -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 (file)
index 0000000..f9d41e8
--- /dev/null
@@ -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 (file)
index 0000000..4e00da3
--- /dev/null
@@ -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