This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Small VxWorks cleanup
- From: Richard Sandiford <richard at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Wed, 01 Mar 2006 17:35:48 +0000
- Subject: Small VxWorks cleanup
elf-vxworks.c defines elf_vxworks_link_output_symbol_hook, but doesn't
provide the same interface as the link_output_symbol_hook, so backends
must provide their own wrapper. This leads to the temptation to
cut-&-paste, as you can tell from the name of the ppc hook ;)
This patch makes it possible to use elf_vxworks_link_output_symbol_hook
directly. Tested on powerpc-vxworks, i586-vxworks and i686-pc-linux-gnu
(--enable-targets=all --enable-64-bit-bfd). OK to install?
Richard
bfd/
* elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
(elf_backend_link_output_symbol_hook): Use
elf_vxworks_link_output_symbol_hook instead.
* elf32-ppc.c (elf_i386_vxworks_link_output_symbol_hook): Delete.
(elf_backend_link_output_symbol_hook): Use
elf_vxworks_link_output_symbol_hook instead.
* elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Provide the
same interface as elf_backend_link_output_symbol_hook.
* elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Update
prototype accordingly.
diff -uprN ../src.2/bfd/elf32-i386.c ./bfd/elf32-i386.c
--- ./bfd/elf32-i386.c 2006-02-28 07:14:36.000000000 +0000
+++ ./bfd/elf32-i386.c 2006-03-01 17:27:36.000000000 +0000
@@ -3969,23 +3969,6 @@ elf_i386_vxworks_link_hash_table_create
}
-/* Tweak magic VxWorks symbols as they are written to the output file. */
-static bfd_boolean
-elf_i386_vxworks_link_output_symbol_hook (struct bfd_link_info *info
- ATTRIBUTE_UNUSED,
- const char *name,
- Elf_Internal_Sym *sym,
- asection *input_sec ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry *h
- ATTRIBUTE_UNUSED)
-{
- /* Ignore the first dummy symbol. */
- if (!name)
- return TRUE;
-
- return elf_vxworks_link_output_symbol_hook (name, sym);
-}
-
#undef elf_backend_post_process_headers
#undef bfd_elf32_bfd_link_hash_table_create
#define bfd_elf32_bfd_link_hash_table_create \
@@ -3995,7 +3978,7 @@ elf_i386_vxworks_link_output_symbol_hook
elf_vxworks_add_symbol_hook
#undef elf_backend_link_output_symbol_hook
#define elf_backend_link_output_symbol_hook \
- elf_i386_vxworks_link_output_symbol_hook
+ elf_vxworks_link_output_symbol_hook
#undef elf_backend_emit_relocs
#define elf_backend_emit_relocs elf_vxworks_emit_relocs
#undef elf_backend_final_write_processing
diff -uprN ../src.2/bfd/elf32-ppc.c ./bfd/elf32-ppc.c
--- ./bfd/elf32-ppc.c 2006-03-01 16:25:44.000000000 +0000
+++ ./bfd/elf32-ppc.c 2006-03-01 17:27:36.000000000 +0000
@@ -7558,23 +7558,6 @@ ppc_elf_vxworks_add_symbol_hook (bfd *ab
return ppc_elf_add_symbol_hook(abfd, info, sym,namep, flagsp, secp, valp);
}
-/* Tweak magic VxWorks symbols as they are written to the output file. */
-static bfd_boolean
-elf_i386_vxworks_link_output_symbol_hook (struct bfd_link_info *info
- ATTRIBUTE_UNUSED,
- const char *name,
- Elf_Internal_Sym *sym,
- asection *input_sec ATTRIBUTE_UNUSED,
- struct elf_link_hash_entry *h
- ATTRIBUTE_UNUSED)
-{
- /* Ignore the first dummy symbol. */
- if (!name)
- return TRUE;
-
- return elf_vxworks_link_output_symbol_hook (name, sym);
-}
-
static void
ppc_elf_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
{
@@ -7605,7 +7588,7 @@ ppc_elf_vxworks_final_write_processing (
ppc_elf_vxworks_add_symbol_hook
#undef elf_backend_link_output_symbol_hook
#define elf_backend_link_output_symbol_hook \
- elf_i386_vxworks_link_output_symbol_hook
+ elf_vxworks_link_output_symbol_hook
#undef elf_backend_final_write_processing
#define elf_backend_final_write_processing \
ppc_elf_vxworks_final_write_processing
diff -uprN ../src.2/bfd/elf-vxworks.c ./bfd/elf-vxworks.c
--- ./bfd/elf-vxworks.c 2005-07-10 07:29:38.000000000 +0100
+++ ./bfd/elf-vxworks.c 2006-03-01 17:27:35.000000000 +0000
@@ -58,9 +58,18 @@ elf_vxworks_add_symbol_hook (bfd *abfd A
/* Tweak magic VxWorks symbols as they are written to the output file. */
bfd_boolean
-elf_vxworks_link_output_symbol_hook (const char *name,
- Elf_Internal_Sym *sym)
+elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info
+ ATTRIBUTE_UNUSED,
+ const char *name,
+ Elf_Internal_Sym *sym,
+ asection *input_sec ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h
+ ATTRIBUTE_UNUSED)
{
+ /* Ignore the first dummy symbol. */
+ if (!name)
+ return TRUE;
+
/* Reverse the effects of the hack in elf_vxworks_add_symbol_hook. */
if (strcmp (name, "__GOTT_INDEX__") == 0
|| strcmp (name, "__GOTT_BASE__") == 0)
diff -uprN ../src.2/bfd/elf-vxworks.h ./bfd/elf-vxworks.h
--- ./bfd/elf-vxworks.h 2005-05-05 15:37:11.000000000 +0100
+++ ./bfd/elf-vxworks.h 2006-03-01 17:27:35.000000000 +0000
@@ -25,7 +25,8 @@ bfd_boolean elf_vxworks_add_symbol_hook
(bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **,
flagword *, asection **, bfd_vma *);
bfd_boolean elf_vxworks_link_output_symbol_hook
- (const char *, Elf_Internal_Sym *);
+ (struct bfd_link_info *, const char *name, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *);
bfd_boolean elf_vxworks_emit_relocs
(bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
struct elf_link_hash_entry **);