]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gas: aarch64: Require 16 bytes for Morello capinit relocation
authorMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 29 Jul 2021 14:08:35 +0000 (15:08 +0100)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 29 Jul 2021 14:08:35 +0000 (15:08 +0100)
commitf4a5fecc9f1289e707a951e8228b44d2632a9e1a
tree71c4d605a9b890b2e344a5393560bff8843a4d8a
parentfb1a9e59cd1657f68d635a427f47751bfe05f64d
gas: aarch64: Require 16 bytes for Morello capinit relocation

The `capinit` directive does not allocate space for the relevant
relocation, rather it creates a CAPINIT relocation on the 16 bytes
immediately following it.

Our implementation works by ensuring we can grow the existing `frag` (an
internal structure that describes known contiguous bytes) by 8 bytes
and then recording that we have an 8 byte sized CAPINIT relocation.
It should be 16 bytes, since the relocation is on a 16 byte quantity.

One symptom this problem can cause is where the section that a given
CAPINIT relocation is recorded may not have enough space for the entire
capability the CAPINIT relocation requests.

The testcase we add demonstrated this problem before the current change.
Now it errors out.  Unfortunately the error is an internal one with a
error message that references internal data structures, but I believe
that is better than creating a faulty binary without complaint.
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/morello-capinit-require-size.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/morello-capinit-require-size.l [new file with mode: 0644]
gas/testsuite/gas/aarch64/morello-capinit-require-size.s [new file with mode: 0644]