[PATCH} Add aarch64-pe support to LD and GAS; refine support in BFD

Jedidiah Thompson wej22007@outlook.com
Thu Dec 30 13:54:17 GMT 2021
Probably not, I’ll correct it when I get to my computer.

Once that’s done, I’ll get all the patches in a form that is ready to be contributed!
From: Tamar Christina<mailto:Tamar.Christina@arm.com>
Sent: Thursday, December 30, 2021 6:01 AM
To: Jedidiah Thompson<mailto:wej22007@outlook.com>
Cc: binutils@sourceware.org<mailto:binutils@sourceware.org>
Subject: RE: [PATCH} Add aarch64-pe support to LD and GAS; refine support in BFD

Hi Jedidiah,

> diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
> index 818d260148d..83226aa5fd2 100644
> --- a/gas/config/tc-aarch64.c
> +++ b/gas/config/tc-aarch64.c
> @@ -32,7 +32,6 @@
>  #include "elf/aarch64.h"
>  #endif
>  #include "dw2gencfi.h"
> -
>  #include "dwarf2dbg.h"
>
>  /* Types of processor to assemble for.  */
> @@ -68,7 +67,8 @@ enum aarch64_abi_type
>  {
>    AARCH64_ABI_NONE = 0,
>    AARCH64_ABI_LP64 = 1,
> -  AARCH64_ABI_ILP32 = 2
> +  AARCH64_ABI_ILP32 = 2,
> +  AARCH64_ABI_LLP64 = 3
>  };
>
>  #ifndef DEFAULT_ARCH
> @@ -76,7 +76,9 @@ enum aarch64_abi_type
>  #endif
>
>  /* DEFAULT_ARCH is initialized in gas/configure.tgt.  */
> +#ifdef OBJ_ELF
>  static const char *default_arch = DEFAULT_ARCH;
> +#endif
>
>  /* AArch64 ABI for the output file.  */
>  static enum aarch64_abi_type aarch64_abi = AARCH64_ABI_NONE;
> @@ -86,6 +88,9 @@ static enum aarch64_abi_type aarch64_abi = AARCH64_ABI_NONE;
>     64-bit model, in which the C int type is 32-bits but the C long type
>     and all pointer types are 64-bit objects (LP64).  */
>  #define ilp32_p    (aarch64_abi == AARCH64_ABI_ILP32)
> +/* When non zero, C types int and long are 32 bit,
> +   pointers, however are 64 bit */
> +#define llp64_p (aarch64_abi == AARCH64_ABI_LLP64)
>
>  enum vector_el_type
>  {
> @@ -8407,6 +8412,8 @@ aarch64_dwarf2_addr_size (void)
>  {
>    if (ilp32_p)
>      return 4;
> +  else if (llp64_p)
> +    return 8;
>    return bfd_arch_bits_per_address (stdoutput) / 8;
>  }
>
> @@ -9125,7 +9132,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
>      case BFD_RELOC_AARCH64_LD_GOT_LO12_NC:
>        /* Should always be exported to object file, see
>    aarch64_force_relocation().  */
> -      fixP->fx_r_type = (ilp32_p
> +      fixP->fx_r_type = ((ilp32_p || llp64_p)
>        ? BFD_RELOC_AARCH64_LD32_GOT_LO12_NC
>        : BFD_RELOC_AARCH64_LD64_GOT_LO12_NC);
>        gas_assert (!fixP->fx_done);

Is this right? you still have full 64-bit addressing with llp64.

Thanks,
Tamar



More information about the Binutils mailing list