QNX MIPS Support Patch
Thiemo Seufer
ica2_ts@csv.ica.uni-stuttgart.de
Wed Aug 18 12:44:00 GMT 2004
Jeff Baker wrote:
> The attached files comprise a patch to add QNX MIPS support to the
> binutils. The changes to 'bfd/elfxx-mips.c' as they appear here are
> obviously not supposed to be complete, though they are functional.
> Everything else looks (to me) to be reasonable.
>
> Please look it over and let me know what I have to change to get it
> accepted. As for 'bfd/elfxx-mips.c' I'm still trying to figure out how
> to piece it together proplerly as I have time. I just want to get the
> ball rolling on the rest.
[snip]
> --- bfd/config.bfd 29 Jul 2004 03:48:12 -0000 1.168
> +++ bfd/config.bfd 17 Aug 2004 17:16:21 -0000
> @@ -828,20 +828,35 @@ case "${targ}" in
> targ_selvecs=ecoff_little_vec
> ;;
> mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks* | mips*-*-chorus*)
> targ_defvec=bfd_elf32_littlemips_vec
> targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
> ;;
> mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks | mips*-*-windiss)
> targ_defvec=bfd_elf32_bigmips_vec
> targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
> ;;
> + mips*eb-*-nto*)
> + targ_defvec=bfd_elf32_bigmips_vec
> + targ_selvecs="bfd_elf32_littlemips_vec"
> + targ_cflags=-D__QNXTARGET__
> + ;;
> + mips*el-*-nto*)
> + targ_defvec=bfd_elf32_littlemips_vec
> + targ_selvecs="bfd_elf32_bigmips_vec"
> + targ_cflags=-D__QNXTARGET__
> + ;;
> + mips*-*-nto*)
> + targ_defvec=bfd_elf32_littlemips_vec
> + targ_selvecs="bfd_elf32_bigmips_vec"
> + targ_cflags=-D__QNXTARGET__
> + ;;
LE seems to be default, so you can remove the explicit mips*el-*-nto*
spec.
[snip]
> --- bfd/elf32-mips.c 29 Jun 2004 13:46:30 -0000 1.178
> +++ bfd/elf32-mips.c 17 Aug 2004 17:16:21 -0000
[snip]
> @@ -1315,21 +1337,23 @@ static const struct ecoff_debug_swap mip
> ecoff_swap_ext_out,
> _bfd_ecoff_swap_tir_out,
> _bfd_ecoff_swap_rndx_out,
> /* Function to read in symbolic data. */
> _bfd_mips_elf_read_ecoff_info
> };
>
> #define ELF_ARCH bfd_arch_mips
> #define ELF_MACHINE_CODE EM_MIPS
>
> +#if !defined(__QNXNTO__) && !defined(__QNXTARGET__)
> #define elf_backend_collect TRUE
> +#endif
It's probably better to do a runtime switch instead of hardcoding.
[snip]
> --- bfd/elfxx-mips.c 13 Aug 2004 03:15:59 -0000 1.109
> +++ bfd/elfxx-mips.c 17 Aug 2004 17:16:22 -0000
[snip]
> @@ -1173,20 +1181,32 @@ _bfd_mips_elf_got16_reloc (bfd *abfd, ar
> bfd *output_bfd, char **error_message)
> {
> if ((symbol->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
> || bfd_is_und_section (bfd_get_section (symbol))
> || bfd_is_com_section (bfd_get_section (symbol)))
> /* The relocation is against a global symbol. */
> return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
> input_section, output_bfd,
> error_message);
>
> +#ifdef __QNXTARGET__
> +/* Else we might be doing a reloc from a local symbol, but we want it
> + to be a got16 reloc, instead of a reloc against a section */
> +if (output_bfd != (bfd *) NULL
> + && (symbol->flags & BSF_GLOBAL))
> + {
> + reloc_entry->address += input_section->output_offset;
> + // reloc_entry->addend = 0;
> + return bfd_reloc_ok;
> + }
> +#endif
Same here, and the other __QNXTARGET__ instances. Can you also
split this monster up a bit, starting with the new reloc type?
It would make review quite a bit easier.
Thiemo
More information about the Binutils
mailing list