/* 32-bit ELF support for S+core.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Copyright (C) 2009-2017 Free Software Foundation, Inc.
Contributed by
Brain.lin (brain.lin@sunplusct.com)
Mei Ligang (ligang@sunnorth.com.cn)
/* We have to use an alignment of 2**4 here because this is hardcoded
in the function stub generation and in the linker script. */
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
- if (s == NULL
+ elf_hash_table (info)->sgot = s;
+ if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4))
return FALSE;
h->non_elf = 0;
h->def_regular = 1;
h->type = STT_OBJECT;
+ elf_hash_table (info)->hgot = h;
if (bfd_link_pic (info)
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
{
(*loc)->gotidx = -1;
/* We didn't allocate enough space in the GOT. */
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("not enough GOT space for local GOT entries"));
bfd_set_error (bfd_error_bad_value);
return NULL;
bh = bfd_link_hash_lookup (info->hash, "_gp", 0, 0, 1);
if (bh != NULL && bh->type == bfd_link_hash_defined)
- elf_gp (output_bfd) = (bh->u.def.value
- + bh->u.def.section->output_section->vma
- + bh->u.def.section->output_offset);
+ {
+ elf_gp (output_bfd) = (bh->u.def.value
+ + bh->u.def.section->output_offset);
+ if (bh->u.def.section->output_section)
+ elf_gp (output_bfd) += bh->u.def.section->output_section->vma;
+ }
else if (bfd_link_relocatable (info))
{
bfd_vma lo = -1;
default:
msg = _("internal error: unknown error");
- /* fall through */
+ /* Fall through. */
common_error:
(*info->callbacks->warning) (info, msg, name, input_bfd,
}
else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr))
{
- (*_bfd_error_handler) (_("%s: Malformed reloc detected for section %s"), abfd, name);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%s: Malformed reloc detected for section %s"), abfd, name);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
case R_SCORE_CALL15:
if (h == NULL)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("%B: CALL15 reloc at 0x%lx not against global symbol"),
abfd, (unsigned long) rel->r_offset);
bfd_set_error (bfd_error_bad_value);
break;
case DT_PLTGOT:
- name = ".got";
- s = bfd_get_linker_section (dynobj, name);
+ s = elf_hash_table (info)->sgot;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
}
/* In case if we don't have global got symbols we default
to setting DT_SCORE_GOTSYM to the same value as
- DT_SCORE_SYMTABNO, so we just fall through. */
+ DT_SCORE_SYMTABNO. */
+ /* Fall through. */
case DT_SCORE_SYMTABNO:
name = ".dynsym";
}
bfd_boolean
-s7_elf32_score_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+s7_elf32_score_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
{
+ bfd *obfd = info->output_bfd;
flagword in_flags;
flagword out_flags;
- if (!_bfd_generic_verify_endian_match (ibfd, obfd))
+ if (!_bfd_generic_verify_endian_match (ibfd, info))
return FALSE;
in_flags = elf_elfheader (ibfd)->e_flags;
if (((in_flags & EF_SCORE_PIC) != 0) != ((out_flags & EF_SCORE_PIC) != 0))
{
- (*_bfd_error_handler) (_("%B: warning: linking PIC files with non-PIC files"), ibfd);
+ _bfd_error_handler (_("%B: warning: linking PIC files with non-PIC files"), ibfd);
}
/* Maybe dependency fix compatibility should be checked here. */