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: New Port: iq2000 bfd


On Tue, Nov 26, 2002 at 11:20:56AM -0500, Stan Cox wrote:
> Index: bfd/archures.c
> +.#define bfd_mach_iq2000        0
> +.#define bfd_mach_iq10          1

I'd make these 1 and 2, because 0 is used as a default.

> Index: bfd/elf32-iq2000.c
> +  /* A 32 bit absolute relocation.  */
> +  HOWTO (R_IQ2000_32, 		     /* type */
> +	 0,			     /* rightshift */
> +	 2,		    	     /* size (0 = byte, 1 = short, 2 = long) */
> +	 32,			     /* bitsize */
> +	 false,			     /* pc_relative */
> +	 0,		    	     /* bitpos */
> +	 complain_overflow_bitfield, /* complain_on_overflow */
> +	 bfd_elf_generic_reloc,	     /* special_function */
> +	 "R_IQ2000_32",	    	     /* name */
> +	 false,			     /* partial_inplace */
> +	 0x00000000,	             /* src_mask */
> +	 0x7fffffff,		     /* dst_mask */
> +	 false),	     	     /* pcrel_offset */

dst_mask and bitsize don't seem to agree here, and in other reloc howtos.

> +      if (info->relocateable)
> +	{
> +	  /* This is a relocateable link.  We don't have to change
> +             anything, unless the reloc is against a section symbol,
> +             in which case we have to adjust according to where the
> +             section symbol winds up in the output section.  */
> +	  if (r_symndx < symtab_hdr->sh_info)
> +	    {
> +	      sym = local_syms + r_symndx;
> +	      
> +	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
> +		{
> +		  sec = local_sections [r_symndx];
> +		  rel->r_addend += sec->output_offset + sym->st_value;
> +		}
> +	    }
> +
> +	  continue;
> +	}

#define elf_backend_rela_normal 1, and you can dispense with the above.

> +	case R_IQ2000_HI16:
> +	  r = iq2000_elf_relocate_hi16 (input_bfd, rel, contents, relocation);
> +	  break;

I suggest making iq2000_elf_relocate_hi16 and similar functions callable
via howto.special_function.

> +      if (!(elf_bad_symtab (abfd)
> +	    && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
> +	  && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
> +		&& sym->st_shndx != SHN_COMMON))
> +	return bfd_section_from_elf_index (abfd, sym->st_shndx);

This can go.  See current code for other archs.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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