summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2020-01-02 14:06:01 +0000
committerTamar Christina <tamar.christina@arm.com>2020-01-02 14:08:27 +0000
commit0db131fb835e4c4f6a024e86743467e7e01c965e (patch)
tree46301a70ff4b14310b46dd329b1d8679be65fae1 /bfd
parenta65b5de624a20f37f0fed484d6208d014f10a6f8 (diff)
downloadbinutils-gdb-0db131fb835e4c4f6a024e86743467e7e01c965e.tar.gz
AArch64: Set the correct ELF class for AArch64 stubs (PR/25210)
This fixes PR 25210 by specifying the the correct ELF class for AArch64 stubs. After doing this the stub section starts behaving like a normal object file loaded from disk. That is SEC_LINKER_CREATED causes us to have to write the section manually. This flag was added as a fix for PR 24753. I believe that fix to still be correct as linker created sections don't have a size on disk and it fixes the Arm bootstrap regression. But in this case specifying the correct section class also makes the stub section not be considered by compress.c. So I'm partially revert this change so that we don't have to manage the section manually as implied by SEC_LINKER_CREATED. bfd/ChangeLog: PR 25210 PR 24753 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class. ld/ChangeLog: PR 25210 PR 24753 * emultempl/aarch64elf.em (elf${ELFSIZE}_aarch64_add_stub_section): Remove SEC_LINKER_CREATED. * testsuite/ld-aarch64/aarch64-elf.exp: Add erratum835769-843419. * testsuite/ld-aarch64/erratum835769-843419.d: New test.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elfnn-aarch64.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c78b42bb0e9..144c7788880 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-02 Tamar Christina <tamar.christina@arm.com>
+
+ PR 25210
+ PR 24753
+ * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class.
+
2020-01-01 Alan Modra <amodra@gmail.com>
Update year range in copyright notice of all files.
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 5fabcd8f646..756ffeb6bda 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -3177,6 +3177,10 @@ _bfd_aarch64_create_stub_section (asection *section,
if (s_name == NULL)
return NULL;
+ /* PR 25210. Set the right class on the stub_bfd. */
+ elf_elfheader (htab->stub_bfd)->e_ident[EI_CLASS] = ELFCLASSNN;
+ BFD_ASSERT (ELFCLASSNN == get_elf_backend_data (htab->stub_bfd)->s->elfclass);
+
memcpy (s_name, section->name, namelen);
memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
return (*htab->add_stub_section) (s_name, section);