aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorSudakshina Das <sudi.das@arm.com>2019-06-06 12:27:41 +0100
committerSudakshina Das <sudi.das@arm.com>2019-06-06 12:27:41 +0100
commit237df8fe1863bb47fcf71ce125cd962666173aaa (patch)
tree7b4985f06381f82de4c47129c59ef8c8b8a72487 /bfd
parent8bf6d176b0a442a8091d338d4af971591d19922c (diff)
downloadgdb-237df8fe1863bb47fcf71ce125cd962666173aaa.zip
gdb-237df8fe1863bb47fcf71ce125cd962666173aaa.tar.gz
gdb-237df8fe1863bb47fcf71ce125cd962666173aaa.tar.bz2
[BFD, AArch64] Fix PT_GNU_PROPERTY alignment issue
If the new GNU property section was being created by the linker (this will happen only if none of the inputs have any GNU property section but the command line to the linker forces a bti with --force-bti), the alignment of the section and hence the program header of PT_GNU_PROPERTY type was not being set correctly. This patch fixes this issue. bfd/ChangeLog: 2019-06-06 Sudakshina Das <sudi.das@arm.com> * elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Set alignment of the new gnu property section. ld/ChangeLog: 2019-06-06 Sudakshina Das <sudi.das@arm.com> * testsuite/ld-aarch64/aarch64-elf.exp: Add new tests. * testsuite/ld-aarch64/property-bti-pac4-a.d: New test. * testsuite/ld-aarch64/property-bti-pac4-b.d: New test. * testsuite/ld-aarch64/property-bti-pac4.s: New test.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfxx-aarch64.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 69624fe..058e971 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2019-06-06 Sudakshina Das <sudi.das@arm.com>
+ * elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Set
+ alignment of the new gnu property section.
+
+2019-06-06 Sudakshina Das <sudi.das@arm.com>
+
* bfd-in.h: Change comment.
* bfd-in2.h: Regenerate.
* elfnn-aarch64.c (elfNN_aarch64_merge_gnu_properties): Update warning.
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index 1249008..33af6c2 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -695,6 +695,7 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
bfd *pbfd;
bfd *ebfd = NULL;
elf_property *prop;
+ unsigned align;
uint32_t gnu_prop = *gprop;
@@ -743,6 +744,13 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
info->callbacks->einfo (
_("%F%P: failed to create GNU property section\n"));
+ align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3;
+ if (!bfd_set_section_alignment (ebfd, sec, align))
+ {
+ info->callbacks->einfo (_("%F%pA: failed to align section\n"),
+ sec);
+ }
+
elf_section_type (sec) = SHT_NOTE;
}
}