This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] [ARC] Avoid creating dynamic relocs when static linked is requested.
- From: Cupertino Miranda <cmiranda at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 8 Jun 2017 17:01:20 -0000
- Subject: [binutils-gdb] [ARC] Avoid creating dynamic relocs when static linked is requested.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=be9e3704f91190c1e1c5d253494423b13c982d93
commit be9e3704f91190c1e1c5d253494423b13c982d93
Author: Cupertino Miranda <cmiranda@synopsys.com>
Date: Wed Dec 7 14:22:54 2016 +0100
[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.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/elf32-arc.c | 25 ++++++++++++++-----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 65e7dae..6d8e9b1 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
+ object is created.
+
2017-06-08 Richard Earnshaw <rearnsha@arm.com>
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
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); \
+ } \
}