[patch] VxWorks x86 shared library support.

Paul Brook paul@codesourcery.com
Thu Apr 14 13:58:00 GMT 2005
The attached patch implements support for x86 VxWorks shared libraries.

VxWorks shared libraries are somewhat different to sysv shared libraries, so I 
needed to make a couple of changes to common code:
- The __GOTT_BASE__ and __GOTT_INDEX__ symbols are supplied by the OS loader, 
so we need to allow undefined references to these symbols.
- The OS loader requires both the normal dynamic relocations and a copy of the 
original static relocations for the PLT.

Both these changes will also be used by other (not yet submitted) VxWorks 
targets.

To actually generate working executables an additional option to create 
dynamic sections in executables is needed. This will follow shortly.

Tested on i586-wrs-vxworks and i686-pc-linux-gnu.
Ok?

Paul

2004-01-19  Paul Brook  <paul@codesourcery.com>

bfd/
	* config.bfd: Use bfd_elf32_i386_vxworks_vec for i?86-*-vxworks.
	* configure.in: Add bfd_elf32_i386_vxworks_vec.
	* configure: Regenerate.
	* elf-bfd.h (struct elf_backend_data): Add is_vxworks.
	(RELOC_FOR_GLOBAL_SYMBOL): Ignore VxWorks magic GOT symbols.
	* elf.c (assign_section_numbers): Add special handling for VxWorks
	.plt.unloaded section.
	* elflink.c (_bfd_elf_create_dynamic_sections): Mark VxWorks PLT
	symbols as functions.
	(elf_link_adjust_relocs): Convert SHN_UNDEF relocs for PLT stubs
	into section relative relocs.
	(elf_link_output_extsym): Ignore undefined VxWorks GOTT symbols.
	* elfxx-target.h (elf_backend_is_vxworks): Define.
	(elfNN_bed): Use it.
	* targets.c (bfd_elf32_i386_vxworks_vec): Declare.
	(_bfd_target_vector): Add bfd_elf32_i386_vxworks_vec.
	* elf32-i386.c: Add elf32-i386-vxworks target BFD.
	(PLTRESOLVE_RELOCS_SHLIB, PLTRESOLVE_RELOCS): Define.
	(PLT_NON_JUMP_SLOT_RELOCS): Define.
	(elf_i386_link_hash_table): Add srelplt2, hgot, hplt, is_vxworks and
	plt0_pad_byte fields.
	(elf_i386_link_hash_table_create): Zero them.
	(elf_i386_create_dynamic_sections): Create static relocation section.
	(allocate_dynrelocs): Allocate space for static PLT relocations.
	(elf_i386_size_dynamic_sections): Save shortcuts to PLT and GOT
	symbols.  Don't strip PLT sections if we have exported symbols from
	them.
	(elf_i386_finish_dynamic_symbol): Fill in VxWorks PLT static
	relocation section.  Don't mark _GLOBAL_OFFSET_TABLE_ as absolute on
	VxWorks.
	(elf_i386_finish_dynamic_sections): Allow different pad bytes.
	Add relocation for GOT location.  Fill in PLT static relocations.
	(elf_i386_vxworks_link_hash_table_create): New function.
gas/
	* config/tc-i386.h (ELF_TARGET_FORMAT): Define for TE_VXWORKS.
gas/testsuite/
	* gas/i386/i386.exp: Don't run divide test on vxworks.
ld/
	* Makefile.am: Add eelf_i386_vxworks.
	* Makefile.in: Regenerate.
	* configure.tgt: Make i?86-*-vxworks use targ_emul=elf_i386_vxworks.
	* emulparams/elf_i386_vxworks.sh: New file.
	* emulparams/vxworks.sh: New file.
	* scripttempl/elf.sc: Add DATA_END_SYMBOLS and ETEXT_NAME.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.vxworks_i386
Type: text/x-diff
Size: 29391 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050414/96ed91e9/attachment.bin>


More information about the Binutils mailing list