[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5 BFD ELF future

The current dynamic linking support has too much code duplication. While each processor has particular differences, much of the dynamic linking support is quite similar for each processor. The GOT and PLT are handled in fairly similar ways, the details of -Bsymbolic linking are generally similar, etc. This code should be reworked to use more generic functions, eliminating the duplication.

Similarly, the relocation handling has too much duplication. Many of the `reloc_type_lookup' and `info_to_howto' functions are quite similar. The relocate section functions are also often quite similar, both in the standard linker handling and the dynamic linker handling. Many of the COFF processor specific backends share a single relocate section function (`_bfd_coff_generic_relocate_section'), and it should be possible to do something like this for the ELF targets as well.

The appearance of the processor specific magic number in `prep_headers' in `elf.c' is somewhat bogus. It should be possible to add support for a new processor without changing the generic support.

The processor function hooks and constants are ad hoc and need better documentation.

When a linker script uses `SIZEOF_HEADERS', the ELF backend must guess at the number of program segments which will be required, in `get_program_header_size'. This is because the linker calls `bfd_sizeof_headers' before it knows all the section addresses and sizes. The ELF backend may later discover, when creating program segments, that more program segments are required. This is currently reported as an error in `assign_file_positions_for_segments'.

In practice this makes it difficult to use `SIZEOF_HEADERS' except with a carefully defined linker script. Unfortunately, `SIZEOF_HEADERS' is required for fast program loading on a native system, since it permits the initial code section to appear on the same page as the program segments, saving a page read when the program starts running. Fortunately, native systems permit careful definition of the linker script. Still, ideally it would be possible to use relaxation to compute the number of program segments.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by system on December, 2 2004 using texi2html