/* 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)
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;