]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Provide default permissions if section has no permission flags
authorMatthew Malcomson <matthew.malcomson@arm.com>
Mon, 7 Feb 2022 16:54:56 +0000 (16:54 +0000)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:59:25 +0000 (15:59 -0700)
commitc140b104081863a071b09830602bd95930a2a66c
treec96b6f363e939611383228d0eb2449aacd0af3db
parent00ef0d31ac92f61336d4f9eceab342fd88ad7e5e
Provide default permissions if section has no permission flags

The permissions that a capability to an object should end up with is
based on the section it should point into.  With symbols that point into
SHN_ABS sections we have nothing to base the permissions on (since these
sections don't have associated permission flags).

For the moment we are making a default of choosing Read-Write
permissions and warning the user about it.  The permissions match what
Morello LLD currently does (from observation).
When Morello linkers use the symbol type to determine whether a
capability should have executable permissions or not, this should end up
being able to handle all uses (since STT_FUNC would get RX perms while
everything else gets RW perms).

In the only case we know of in the GNU team the symbol ends up with
zero-size anyway, so the choice of Read-Write doesn't seem too lax.
(Having zero-size is fine for the use-case we know of in glibc, since
that use case simply checks if the address of the symbol is non-zero.
Hence we have no need as yet to dereference the symbol).

The use case we know about are the `_nl_current_<LANG>_used` symbols
defined with `_NL_CURRENT_DEFINE` in the locale/lc-<lang>.c files in
statically linked glibc.  If any case that requires non-zero size or
different permissions becomes important then something more will be
required across the toolchain.
bfd/elfnn-aarch64.c
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/emit-relocs-morello-8.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-morello-8.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-morello-8b.s [new file with mode: 0644]