aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arc.c
diff options
context:
space:
mode:
authorCupertino Miranda <cmiranda@synopsys.com>2016-12-07 14:22:54 +0100
committerCupertino Miranda <cmiranda@synopsys.com>2017-06-08 18:38:50 +0200
commitbe9e3704f91190c1e1c5d253494423b13c982d93 (patch)
tree6bf7e21f6f8560f203c9622d60bc667aeff664ba /bfd/elf32-arc.c
parentb8b6e72f3db1f798680742c02f3dc220175d0757 (diff)
downloadgdb-be9e3704f91190c1e1c5d253494423b13c982d93.zip
gdb-be9e3704f91190c1e1c5d253494423b13c982d93.tar.gz
gdb-be9e3704f91190c1e1c5d253494423b13c982d93.tar.bz2
[ARC] Avoid creating dynamic relocs when static linked is requested.
bfd/Changelog: Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (ADD_RELA): Changed to only work when dynamic object is created.
Diffstat (limited to 'bfd/elf32-arc.c')
-rw-r--r--bfd/elf32-arc.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index ef0d893..747faf9 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -55,17 +55,20 @@ name_for_global_symbol (struct elf_link_hash_entry *h)
Elf_Internal_Rela _rel; \
bfd_byte * _loc; \
\
- BFD_ASSERT (_htab->srel##SECTION &&_htab->srel##SECTION->contents); \
- _loc = _htab->srel##SECTION->contents \
- + ((_htab->srel##SECTION->reloc_count) \
- * sizeof (Elf32_External_Rela)); \
- _htab->srel##SECTION->reloc_count++; \
- _rel.r_addend = ADDEND; \
- _rel.r_offset = (_htab->s##SECTION)->output_section->vma \
- + (_htab->s##SECTION)->output_offset + OFFSET; \
- BFD_ASSERT ((long) SYM_IDX != -1); \
- _rel.r_info = ELF32_R_INFO (SYM_IDX, TYPE); \
- bfd_elf32_swap_reloca_out (BFD, &_rel, _loc); \
+ if (_htab->dynamic_sections_created == TRUE) \
+ { \
+ BFD_ASSERT (_htab->srel##SECTION &&_htab->srel##SECTION->contents); \
+ _loc = _htab->srel##SECTION->contents \
+ + ((_htab->srel##SECTION->reloc_count) \
+ * sizeof (Elf32_External_Rela)); \
+ _htab->srel##SECTION->reloc_count++; \
+ _rel.r_addend = ADDEND; \
+ _rel.r_offset = (_htab->s##SECTION)->output_section->vma \
+ + (_htab->s##SECTION)->output_offset + OFFSET; \
+ BFD_ASSERT ((long) SYM_IDX != -1); \
+ _rel.r_info = ELF32_R_INFO (SYM_IDX, TYPE); \
+ bfd_elf32_swap_reloca_out (BFD, &_rel, _loc); \
+ } \
}