This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] MIPS ELF64 support in BFD


Thiemo,

I had some problems applying this patch to the current
CVS.  What did you do the diff against?  Or am I being
a twitt?

-Tim

--- Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
wrote:
> Hi All,
> 
> this patch adds some support for MIPS ELF64 objects
> to BFD,
> most notably for ABI (n)64 non-PIC code. There are
> still many
> things to do, and some parts of this code are known
> to be
> wrong, but it's surely better than the current state
> in CVS.
> 
> 
> Thiemo
> 
> 
> 2001-12-13  Thiemo Seufer
> <seufer@csv.ica.uni-stuttgart.de>
> 
> 	/bfd/ChangeLog
> 	* elf64-mips.c (mips_elf64_link_hash_entry): New
> link hash.
> 	(mips_elf64_high): New Function.
> 	(mips_elf64_higher): Likewise.
> 	(mips_elf64_highest): Likewise.
> 	(mips_elf64_info_to_howto_rel): Likewise.
> 	(mips_elf64_info_to_howto_rela): Likewise.
> 	(mips_elf64_write_rel): Likewise.
> 	(mips_elf64_write_rela): Likewise.
> 	(mips_elf64_link_hash_newfunc): Likewise.
> 	(mips_elf64_hi16_reloc): Likewise.
> 	(mips_elf64_higher_reloc): Likewise.
> 	(mips_elf64_highest_reloc): Likewise.
> 	(mips_elf64_gprel16_reloc): Likewise.
> 	(mips_elf64_gprel16_reloca): Likewise.
> 	(mips_elf64_literal_reloc): Likewise.
> 	(mips_elf64_gprel32_reloc): Likewise.
> 	(mips_elf64_shift6_reloc): Likewise.
> 	(mips_elf64_got16_reloc): Likewise.
> 	(mips_elf64_assign_gp): Likewise.
> 	(mips_elf64_final_gp): Likewise.
> 	(gprel16_with_gp): Likewise.
> 	(mips_elf64_additional_program_headers): Likewise.
> 	(mips_elf64_link_hash_table_create): Likewise.
> 	(mips_elf64_got_offset_from_index): Likewise.
> 	(_mips_elf64_got_info): Likewise.
> 	(mips_elf64_sign_extend): Likewise.
> 	(mips_elf64_overflow_p): Likewise.
> 	(mips_elf64_global_got_index): Likewise.
> 	(mips_elf64_sort_hash_table_f): Likewise.
> 	(mips_elf64_sort_hash_table): Likewise.
> 	(mips_elf64_swap_msym_out): Likewise.
> 	(mips_elf64_create_local_got_entry): Likewise.
> 	(mips_elf64_local_got_index): Likewise.
> 	(mips_elf64_got_page): Likewise.
> 	(mips_elf64_got16_entry): Likewise.
> 	(mips_elf64_local_relocation_p): Likewise.
> 	(mips_elf64_next_relocation): Likewise.
> 	(mips_elf64_create_dynamic_relocation): Likewise.
> 	(mips_elf64_calculate_relocation): Likewise.
> 	(mips_elf64_obtain_contents): Likewise.
> 	(mips_elf64_perform_relocation): Likewise.
> 	(mips_elf64_relocate_section): Likewise.
> 	(mips_elf64_create_dynamic_sections): Likewise.
> 	(mips_elf64_adjust_dynamic_symbol): Likewise.
> 	(mips_elf64_always_size_sections): Likewise.
> 	(mips_elf64_size_dynamic_sections): Likewise.
> 	(mips_elf64_finish_dynamic_symbol): Likewise.
> 	(mips_elf64_finish_dynamic_sections): Likewise.
> 	(mips_elf64_gc_mark_hook): Likewise.
> 	(mips_elf64_gc_sweep_hook): Likewise.
> 	(mips_elf64_create_got_section): Likewise.
> 	(mips_elf64_record_global_got_symbol): Likewise.
> 	(mips_elf64_create_msym_section): Likewise.
> 	(mips_elf64_allocate_dynamic_relocations):
> Likewise.
> 	(mips_elf64_check_relocs): Likewise.
> 	(mips_elf64_output_extsym): Likewise.
> 	(mips_elf64_swap_gptab_in): Likewise.
> 	(mips_elf64_swap_gptab_out): Likewise.
> 	(gptab_compare): Likewise.
> 	(mips_elf64_final_link): Likewise.
> 	(prev_reloc_addend): Remenber addend of previous
> parts of a combined
> 	reloc.
> 	(ELF_MIPS_GP_OFFSET): New define.
> 	(STUB_LW,STUB_MOVE,STUB_JALR,STUB_LI16): Likewise.
> 	(MIPS_FUNCTION_STUB_SIZE): Likewise.
> 	(mips_elf64_howto_rel): Fix HOWTO defines.
> 	(mips_elf64_howto_rela): Likewise.
> 	(mips_elf64_swap_reloca_out): Fix signedness.
> 	(mips_elf64_be_swap_reloc_in): Use ELF64* instead
> of ELF32*.
> 	(mips_elf64_be_swap_reloca_in): Likewise.
> 	(mips_elf64_be_swap_reloc_out): Likewise. Preserve
> extended type info.
> 	(mips_elf64_be_swap_reloca_out): Likewise.
> 
> 
> diff -BurpN source-orig/bfd/elf64-mips.c
> source/bfd/elf64-mips.c
> --- source-orig/bfd/elf64-mips.c	Wed Dec 12 02:45:58
> 2001
> +++ source/bfd/elf64-mips.c	Thu Dec 13 02:56:02 2001
> @@ -27,6 +27,20 @@ Foundation, Inc., 59 Temple Place
> - Suit
>     overrides the usual ELF reloc handling, and
> handles reading and
>     writing the relocations here.  */
>  
> +/* TODO: Many things are unsupported, even if there
> is some code for it
> + .       (which was mostly stolen from elf32-mips.c
> and slightly adapted).
> + .
> + .   - Relocation handling for REL relocs is wrong
> in many cases and
> + .     generally untested.
> + .   - Relocation handling for RELA relocs related
> to GOT support are
> + .     also likely to be wrong.
> + .   - Support for MIPS16 is only partially
> implemented.
> + .   - Embedded PIC  is only partially implemented
> (is it needed?).
> + .   - Combined relocs with RSS_* entries are
> unsupported.
> + .   - The whole GOT handling for NewABI is
> missing, some parts of
> + .     the OldABI version is still lying around and
> shold be removed.
> + */
> +
>  #include "bfd.h"
>  #include "sysdep.h"
>  #include "libbfd.h"
> @@ -47,6 +61,8 @@ Foundation, Inc., 59 Temple Place
> - Suit
>  #define ECOFF_SIGNED_64
>  #include "ecoffswap.h"
>  
> +struct mips_elf64_link_hash_entry;
> +
>  static void mips_elf64_swap_reloc_in
>    PARAMS ((bfd *, const Elf64_Mips_External_Rel *,
>  	   Elf64_Mips_Internal_Rel *));
> @@ -67,14 +83,147 @@ static void
> mips_elf64_be_swap_reloca_in
>    PARAMS ((bfd *, const bfd_byte *,
> Elf_Internal_Rela *));
>  static void mips_elf64_be_swap_reloca_out
>    PARAMS ((bfd *, const Elf_Internal_Rela *,
> bfd_byte *));
> +static bfd_vma mips_elf64_high PARAMS ((bfd_vma));
> +static bfd_vma mips_elf64_higher PARAMS
> ((bfd_vma));
> +static bfd_vma mips_elf64_highest PARAMS
> ((bfd_vma));
>  static reloc_howto_type
> *mips_elf64_reloc_type_lookup
>    PARAMS ((bfd *, bfd_reloc_code_real_type));
> +static void mips_elf64_info_to_howto_rel
> +  PARAMS ((bfd *, arelent *, Elf64_Internal_Rel
> *));
> +static void mips_elf64_info_to_howto_rela
> +  PARAMS ((bfd *, arelent *, Elf64_Internal_Rela
> *));
>  static long mips_elf64_get_reloc_upper_bound PARAMS
> ((bfd *, asection *));
>  static boolean mips_elf64_slurp_one_reloc_table
>    PARAMS ((bfd *, asection *, asymbol **, const
> Elf_Internal_Shdr *));
>  static boolean mips_elf64_slurp_reloc_table
>    PARAMS ((bfd *, asection *, asymbol **,
> boolean));
>  static void mips_elf64_write_relocs PARAMS ((bfd *,
> asection *, PTR));
> +static void mips_elf64_write_rel
> +  PARAMS((bfd *, asection *, Elf_Internal_Shdr *,
> int *, PTR));
> +static void mips_elf64_write_rela
> +  PARAMS((bfd *, asection *, Elf_Internal_Shdr *,
> int *, PTR));
> +static struct bfd_hash_entry
> *mips_elf64_link_hash_newfunc
> +  PARAMS ((struct bfd_hash_entry *, struct
> bfd_hash_table *, const char *));
> +static bfd_reloc_status_type mips_elf64_hi16_reloc
> +  PARAMS ((bfd *, arelent *, asymbol *,	PTR,
> asection *, bfd *, char **));
> +static bfd_reloc_status_type
> mips_elf64_higher_reloc
> +  PARAMS ((bfd *, arelent *, asymbol *,	PTR,
> asection *, bfd *, char **));
> +static bfd_reloc_status_type
> mips_elf64_highest_reloc
> +  PARAMS ((bfd *, arelent *, asymbol *,	PTR,
> asection *, bfd *, char **));
> +static bfd_reloc_status_type
> mips_elf64_gprel16_reloc
> +  PARAMS ((bfd *, arelent *, asymbol *, PTR,
> asection *, bfd *, char **));
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]