Sourceware Bugzilla – Attachment 11124 Details for
Bug 16177
R_ARM_COPY reloc generated for reference in writable section
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated/fixed patch
file_16177.txt (text/plain), 2.73 KB, created by
Jessica Clarke
on 2018-07-12 22:17:06 UTC
(
hide
)
Description:
Updated/fixed patch
Filename:
MIME Type:
Creator:
Jessica Clarke
Created:
2018-07-12 22:17:06 UTC
Size:
2.73 KB
patch
obsolete
>From d9f7088c9eb44ef62abae80e39c13c27e8e30e82 Mon Sep 17 00:00:00 2001 >From: James Clarke <jrtc27@jrtc27.com> >Date: Thu, 12 Jul 2018 23:05:47 +0100 >Subject: [PATCH] Don't emit R_ARM_COPY if there are no references in read-only > sections > >bfd/ > PR ld/16177 > * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Check > readonly_dynrelocs before deciding to use a copy relocation, and > reorganise to more closely match other architectures in style. >--- > bfd/elf32-arm.c | 25 +++++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) > >diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c >index 9c611813c6..c5fe92a0d0 100644 >--- a/bfd/elf32-arm.c >+++ b/bfd/elf32-arm.c >@@ -16014,6 +16014,21 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, > if (bfd_link_pic (info) || globals->root.is_relocatable_executable) > return TRUE; > >+ /* If -z nocopyreloc was given, we won't generate them either. */ >+ if (info->nocopyreloc) >+ { >+ h->non_got_ref = 0; >+ return TRUE; >+ } >+ >+ /* If we don't find any dynamic relocs in read-only sections, then >+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */ >+ if (!readonly_dynrelocs (h)) >+ { >+ h->non_got_ref = 0; >+ return TRUE; >+ } >+ > /* We must allocate the symbol in our .dynbss section, which will > become part of the .bss section of the executable. There will be > an entry for this symbol in the .dynsym section. The dynamic >@@ -16023,9 +16038,9 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, > determine the address it must put in the global offset table, so > both the dynamic object and the regular object will refer to the > same memory location for the variable. */ >- /* If allowed, we must generate a R_ARM_COPY reloc to tell the dynamic >- linker to copy the initial value out of the dynamic object and into >- the runtime process image. We need to remember the offset into the >+ /* We must generate a R_ARM_COPY reloc to tell the dynamic linker to >+ copy the initial value out of the dynamic object and into the >+ runtime process image. We need to remember the offset into the > .rel(a).bss section we are going to use. */ > if ((h->root.u.def.section->flags & SEC_READONLY) != 0) > { >@@ -16037,9 +16052,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, > s = globals->root.sdynbss; > srel = globals->root.srelbss; > } >- if (info->nocopyreloc == 0 >- && (h->root.u.def.section->flags & SEC_ALLOC) != 0 >- && h->size != 0) >+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) > { > elf32_arm_allocate_dynrelocs (info, srel, 1); > h->needs_copy = 1; >-- >2.17.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16177
:
9207
|
10727
| 11124 |
14399