This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/9] [ARC] Avoid creating dynamic relocs when static linked is requested.
- From: Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>
- To: binutils at sourceware dot org
- Cc: Cupertino dot Miranda at synopsys dot com, Claudiu dot Zissulescu at synopsys dot com, Francois dot Bedard at synopsys dot com
- Date: Tue, 23 May 2017 17:40:48 +0200
- Subject: [PATCH 1/9] [ARC] Avoid creating dynamic relocs when static linked is requested.
- Authentication-results: sourceware.org; auth=none
- References: <20170523154056.19234-1-cmiranda@synopsys.com>
bfd/Changelog:
Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (ADD_RELA): Changed to only work when dynamic object is
created.
---
bfd/elf32-arc.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 3e99cab..33166f2 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); \
+ } \
}
--
2.9.0