/* BFD back-end for National Semiconductor's CR16 ELF
- Copyright 2007 Free Software Foundation, Inc.
+ Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
Written by M R Swami Reddy.
This file is part of BFD, the Binary File Descriptor library.
unsigned short r_type = howto->type;
bfd_byte *hit_data = contents + offset;
bfd_vma reloc_bits, check, Rvalue1;
-
bfd * dynobj;
bfd_vma * local_got_offsets;
- asection * sgot;
dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
- sgot = NULL;
-
-
switch (r_type)
{
case R_CR16_IMM4:
| (bfd_get_32 (input_bfd, hit_data) & 0xf0ff));
}
+ else if (r_type == R_CR16_NUM32)
+ {
+ Rvalue1 = (bfd_get_32 (input_bfd, hit_data));
+
+ /* Add or subtract the offset value */
+ if (Rvalue1 & 0x80000000)
+ Rvalue -= (~Rvalue1 + 1) & 0xffffffff;
+ else
+ Rvalue += Rvalue1;
+
+ /* Check for Ranga */
+ if (Rvalue > 0xffffffff)
+ return bfd_reloc_overflow;
+ }
+
bfd_put_32 (input_bfd, Rvalue, hit_data);
}
break;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
unresolved_reloc, warned);
}
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+ /* For relocs against symbols from removed linkonce sections,
+ or sections discarded by a linker script, we just want the
+ section contents zeroed. Avoid any special processing. */
+ _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+ rel->r_info = 0;
+ rel->r_addend = 0;
+ continue;
+ }
+
+ if (info->relocatable)
+ continue;
+
r = cr16_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,