summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddesh.poyarekar@arm.com>2020-09-11 09:18:09 +0530
committerLuis Machado <luis.machado@linaro.org>2020-10-20 15:04:01 -0300
commit40bbb79e5a3e81787ee5fdfccec04bac0d735744 (patch)
treebe423c1c1b41fb505e88e21cca5b79f2a23755ae /bfd/elf32-i386.c
parent925041050d890f90ce8411057bf21302cf4d94a5 (diff)
downloadbinutils-gdb-40bbb79e5a3e81787ee5fdfccec04bac0d735744.tar.gz
[Morello] Capability data relocations
Introduce three new relocations disguised as two relocations to support capabilities. R_MORELLO_CAPINIT is emitted as a static relocation by the assembler and as a dynamic relocation by the linker; it's a one on one free! The R_MORELLO_CAPINIT static relocation is emitted by the assembler to provide capability information to the static linker. The static linker may do one of two things: - For local symbols that can be resolved at link time, the static linker sets up frag and emits a R_MORELLO_RELATIVE dynamic relocation that the dynamic linker can resolve in a manner similar to R_AARCH64_RELATIVE. The dynamic linker will have all of the information it needs (i.e. permissions, size and relative address) to set up the capability without needing to peek into the symbol table. - For dynamic symbols, the static linker emits a R_MORELLO_CAPINIT with the reference of the dynamic symbol it refers to. The dynamic linker is then responsible for resolving the symbol at runtime and setting up the capability based on the properties of the symbol it is able to deduce. Linker and Linker script defined symbols ---------------------------------------- For symbols defined by the linker or in linker scripts, capability size and permissions are based on the section the symbol belongs to. For linker defined symbols (i.e. _DYNAMIC or _GLOBAL_OFFSET_TABLE_) this is straightforward since the linker puts them in the correct section and at the start. For symbols defined in the linker script, if they are anywhere but the end of the output script definition, their range becomes the point at which they are defined, up to the end of the output section. For symbols defined at the end of the output section, the symbols are defined with a zero size unless their name is of the form __start_.* or __.*_start, indicating a start of the section that follows it. In this case, the symbols are given the range and permission of the output section following it. Ideally, the last case (i.e. the heuristic looking for the name) should be strictly for compatibility and should eventually be fixed in the linker script to put the symbol into the output section it intends to track. It may be a useful enhancement to add a warning to that effect. bfd/ChangeLog: 2020-10-20 Siddhesh Poyarekar <siddesh.poyarekar@arm.com> * elfnn-aarch64.c (elfNN_aarch64_howto_table, elfNN_aarch64_final_link_relocate, elfNN_aarch64_check_relocs, elfNN_aarch64_relocate_section): Add R_MORELLO_CAPINIT and R_MORELLO_RELATIVE. (elf_aarch64_link_hash_table): New member srelcaps. (c64_valid_cap_range, exponent, cap_meta, section_start_symbol, c64_fixup_frag): New functions. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend, _bfd_aarch64_elf_resolve_relocation): Add BFD_RELOC_MORELLO_CAPINIT and BFD_RELOC_MORELLO_RELATIVE. * libbfd.h (bfd_reloc_code_real_names): Likewise. * reloc.c: Likewise. * bfd-in2.h: Regenerate. gas/ChangeLog: 2020-10-20 Siddhesh Poyarekar <siddesh.poyarekar@arm.com> * config/tc-aarch64.c (s_aarch64_capinit): New function. (md_pseudo_table): Use it. (md_apply_fix): Add BFD_RELOC_MORELLO_CAPINIT. (aarch64_fix_adjustable): Return FALSE for capabilities. * testsuite/gas/aarch64/morello-capinit.d: New test file. * testsuite/gas/aarch64/morello-capinit.s: Likewise. include/ChangeLog: 2020-10-20 Siddhesh Poyarekar <siddesh.poyarekar@arm.com> * elf/aarch64.h (R_MORELLO_CAPINIT, R_MORELLO_RELATIVE): New relocations. ld/ChangeLog: 2020-10-20 Siddhesh Poyarekar <siddesh.poyarekar@arm.com> * testsuite/ld-aarch64/aarch64-elf.exp: Add test. * testsuite/ld-aarch64/morello-capinit.d: New file. * testsuite/ld-aarch64/morello-capinit.ld: New file. * testsuite/ld-aarch64/morello-capinit.s: New file.
Diffstat (limited to 'bfd/elf32-i386.c')
0 files changed, 0 insertions, 0 deletions