aarch64: add STO_AARCH64_VARIANT_PCS and DT_AARCH64_VARIANT_PCS
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 25 Apr 2019 12:46:01 +0000 (13:46 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 24 May 2019 14:05:57 +0000 (15:05 +0100)
The bottom 2 bits of st_other are used for visibility, the top 6 bits are
de facto reserved for processor specific use.  This patch defines a
bits to mark function symbols that follow a variant procedure call standard
with different register usage convention.

A dynamic tag is also defined that marks modules with R_<CLS>_JUMP_SLOT
relocations referencing symbols marked with STO_AARCH64_VARIANT_PCS.
This can be used by dynamic linkers that support lazy binding to decide
what registers need to be preserved during symbol resolution.

binutils/ChangeLog:

* readelf.c (get_aarch64_dynamic_type): Handle DT_AARCH64_VARIANT_PCS.
(get_aarch64_symbol_other): New, handles STO_AARCH64_VARIANT_PCS.
(get_symbol_other): Call get_aarch64_symbol_other.

include/ChangeLog:

* elf/aarch64.h (DT_AARCH64_VARIANT_PCS): Define.
(STO_AARCH64_VARIANT_PCS): Define.

binutils/ChangeLog
binutils/readelf.c
include/ChangeLog
include/elf/aarch64.h

index 79bfaee90867f07d198387a44908e23d57acc27b..ef9fa5ac712a2c42124d626abf83a65cc71f09d1 100644 (file)
@@ -1,3 +1,9 @@
+2019-05-24  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * readelf.c (get_aarch64_dynamic_type): Handle DT_AARCH64_VARIANT_PCS.
+       (get_aarch64_symbol_other): New, handles STO_AARCH64_VARIANT_PCS.
+       (get_symbol_other): Call get_aarch64_symbol_other.
+
 2019-05-24  Alan Modra  <amodra@gmail.com>
 
        * objdump.c (disassemble_bytes): Set WIDE_OUTPUT in flags.
index 9d2810437e444fa58aced109561c52483269d262..23ffd8660031b233a42a98a9e9b3e2aff4b052ae 100644 (file)
@@ -1810,6 +1810,7 @@ get_aarch64_dynamic_type (unsigned long type)
     {
     case DT_AARCH64_BTI_PLT:  return "AARCH64_BTI_PLT";
     case DT_AARCH64_PAC_PLT:  return "AARCH64_PAC_PLT";
+    case DT_AARCH64_VARIANT_PCS:  return "AARCH64_VARIANT_PCS";
     default:
       return NULL;
     }
@@ -11101,6 +11102,22 @@ get_solaris_symbol_visibility (unsigned int visibility)
     }
 }
 
+static const char *
+get_aarch64_symbol_other (unsigned int other)
+{
+  static char buf[32];
+
+  if (other & STO_AARCH64_VARIANT_PCS)
+    {
+      other &= ~STO_AARCH64_VARIANT_PCS;
+      if (other == 0)
+       return "VARIANT_PCS";
+      snprintf (buf, sizeof buf, "VARIANT_PCS | %x", other);
+      return buf;
+    }
+  return NULL;
+}
+
 static const char *
 get_mips_symbol_other (unsigned int other)
 {
@@ -11212,6 +11229,9 @@ get_symbol_other (Filedata * filedata, unsigned int other)
 
   switch (filedata->file_header.e_machine)
     {
+    case EM_AARCH64:
+      result = get_aarch64_symbol_other (other);
+      break;
     case EM_MIPS:
       result = get_mips_symbol_other (other);
       break;
index 2e8408402fbe98d7efdb921f197806bf66581a7f..4132bfec3d33a16ee9cd371c2108931f69c5510f 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-24  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * elf/aarch64.h (DT_AARCH64_VARIANT_PCS): Define.
+       (STO_AARCH64_VARIANT_PCS): Define.
+
 2019-05-24  Alan Modra  <amodra@gmail.com>
 
        * elf/ppc64.h (R_PPC64_PLTSEQ_NOTOC, R_PPC64_PLTCALL_NOTOC),
index 44665476265b8d20c59343dcbafc87766a5444c0..721378abf864ed98047d75475863d057c713b31e 100644 (file)
 /* Processor specific dynamic array tags.  */
 #define DT_AARCH64_BTI_PLT     (DT_LOPROC + 1)
 #define DT_AARCH64_PAC_PLT     (DT_LOPROC + 3)
+#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
+
+/* AArch64-specific values for st_other.  */
+#define STO_AARCH64_VARIANT_PCS        0x80  /* Symbol may follow different call
+                                        convention from the base PCS.  */
 
 /* Relocation types.  */
 
This page took 0.033402 seconds and 4 git commands to generate.