- index = r_length + 4 * r_pcrel_done;
- return tic30_aout_howto_table + index;
-}
-
-/* This function is used as a callback for 16-bit relocs. This is
- required for relocations between segments. A line in aoutx.h
- requires that any relocations for the data section should point to
- the end of the aligned text section, plus an offset. By default,
- this does not happen, therefore this function takes care of
- that. */
-
-static bfd_reloc_status_type
-tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
-
- /* Make sure that the symbol's section is defined. */
- if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
- return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
- /* Get the size of the input section and turn it into the TMS320C30
- 32-bit address format. */
- relocation = (symbol->section->vma >> 2);
- relocation += bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
- bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
- return bfd_reloc_ok;
-}
-
-/* This function does the same thing as tic30_aout_fix_16 except for 32
- bit relocations. */
-
-static bfd_reloc_status_type
-tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation;
-
- /* Make sure that the symbol's section is defined. */
- if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
- return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
- /* Get the size of the input section and turn it into the TMS320C30
- 32-bit address format. */
- relocation = (symbol->section->vma >> 2);
- relocation += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
- bfd_put_32 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
- return bfd_reloc_ok;
-}
-
-/* This function is used to work out pc-relative offsets for the
- TMS320C30. The data already placed by md_pcrel_from within gas is
- useless for a relocation, so we just get the offset value and place
- a version of this within the object code.
- tic30_aout_final_link_relocate will then calculate the required
- relocation to add on to the value in the object code. */
-
-static bfd_reloc_status_type
-tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
- output_bfd, error_message)
- bfd *abfd;
- arelent *reloc_entry;
- asymbol *symbol ATTRIBUTE_UNUSED;
- PTR data;
- asection *input_section ATTRIBUTE_UNUSED;
- bfd *output_bfd ATTRIBUTE_UNUSED;
- char **error_message ATTRIBUTE_UNUSED;
-{
- bfd_vma relocation = 1;
- bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1);
-
- /* The byte before the location of the fix contains bits 23-16 of
- the pcrel instruction. Bit 21 is set for a delayed instruction
- which requires on offset of 3 instead of 1. */
- if (offset_data & 0x20)
- relocation -= 3;
- else
- relocation -= 1;
- bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
- return bfd_reloc_ok;