[PATCH] D62609: [LLD][ELF][AArch64] Support for BTI and PAC

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 1 07:34:35 PDT 2019


MaskRay added a comment.

I am reading some `binutils-gdb/bfd/elfnn-aarch64.c` code as a reference. It doesn't use `bti c` for `-pie` (`ET_DYN`). Is it intentional?

  static void
  setup_plt_values (struct bfd_link_info *link_info,
  		  aarch64_plt_type plt_type)
  {
    struct elf_aarch64_link_hash_table *globals;
    globals = elf_aarch64_hash_table (link_info);
  
    if (plt_type == PLT_BTI_PAC)
      {
        globals->plt0_entry = elfNN_aarch64_small_plt0_bti_entry;
  
        /* Only in ET_EXEC we need PLTn with BTI.  */
        if (bfd_link_pde (link_info))
  	{
  	  globals->plt_entry_size = PLT_BTI_PAC_SMALL_ENTRY_SIZE;
  	  globals->plt_entry = elfNN_aarch64_small_plt_bti_pac_entry;
  	}
        else
  	{
  	  globals->plt_entry_size = PLT_PAC_SMALL_ENTRY_SIZE;
  	  globals->plt_entry = elfNN_aarch64_small_plt_pac_entry;
  	}
      }
    else if (plt_type == PLT_BTI)
      {
        globals->plt0_entry = elfNN_aarch64_small_plt0_bti_entry;
  
        /* Only in ET_EXEC we need PLTn with BTI.  */
        if (bfd_link_pde (link_info))
  	{
  	  globals->plt_entry_size = PLT_BTI_SMALL_ENTRY_SIZE;
  	  globals->plt_entry = elfNN_aarch64_small_plt_bti_entry;
  	}
      }
    else if (plt_type == PLT_PAC)
      {
        globals->plt_entry_size = PLT_PAC_SMALL_ENTRY_SIZE;
        globals->plt_entry = elfNN_aarch64_small_plt_pac_entry;
      }
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62609/new/

https://reviews.llvm.org/D62609





More information about the llvm-commits mailing list