Skip to content

Commit

Permalink
Darwin, Arm64 : Assign a register for the static chain.
Browse files Browse the repository at this point in the history
At present, we do not have a workable solution for trampolines for
the Darwin Arm64 port.  Executable stack is not an option and the
advice from Arm is not to use any lower address bits to signal that
we have a descriptor.

It is possible that we might be able to load some remappable object
(e.g. a dylib) - but the details there still have to be resolved.

In any case, we need a usable static chain - and the port has that
assigned to R18 by default - which is the platform register in darwinpcs.

It's uncertain whether R16/R17 are actually used in the darwinpcs in
the role of support for branch islanding.  The AAPCS64 use as IP0/1
is conditional on ELF relocations, so perhaps irrelevant to Darwin.

Using R16 does not conflict with the existing (non-functional) trampoline
code.

lots of TODOs here.
  • Loading branch information
iains committed Jan 30, 2021
1 parent fd50cda commit 666bb1e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gcc/config/aarch64/darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ along with GCC; see the file COPYING3. If not see
1, 1 /* FFR and FFRT */ \
}

/* Although we cannot use executable stack, we still need to assign
a static chain regnum. At the moment using R16 (IP0) is available. */
#undef STATIC_CHAIN_REGNUM
#define STATIC_CHAIN_REGNUM R16_REGNUM

#define SUBTARGET_ENCODE_SECTION_INFO darwin_encode_section_info

#undef ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX
Expand Down

0 comments on commit 666bb1e

Please sign in to comment.