[1/3] AArch64: Update relocations for ILP32

Message ID 1416329010-8683-2-git-send-email-will.newton@linaro.org
State New
Headers show

Commit Message

Will Newton Nov. 18, 2014, 4:43 p.m.
The latest version of the binutils ELF header defines a new set of
dynamic relocations for ILP32 and renames some to make the naming
more uniform.

ChangeLog:

2014-11-18  Will Newton  <will.newton@linaro.org>
	    Andrew Pinski  <andrew.pinski@caviumnetworks.com>

	* elf/elf.h (R_AARCH64_P32_ABS32, R_AARCH64_P32_COPY,
	R_AARCH64_P32_GLOB_DAT, R_AARCH64_P32_JUMP_SLOT,
	R_AARCH64_P32_RELATIVE, R_AARCH64_P32_TLS_DTPMOD,
	R_AARCH64_P32_TLS_DTPREL, R_AARCH64_P32_TLS_TPREL,
	R_AARCH64_P32_TLSDESC, R_AARCH64_P32_IRELATIVE): Define.
	(R_AARCH64_TLS_DTPMOD64): Rename to ..
	(R_AARCH64_TLS_DTPMOD): This.
	(R_AARCH64_TLS_DTPREL64): Rename to ...
	(R_AARCH64_TLS_DTPREL): This.
	(R_AARCH64_TLS_TPREL64): Rename to ...
	(R_AARCH64_TLS_TPREL): This.
	* sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Update
	R_AARCH64_TLS_DTPMOD64, R_AARCH64_TLS_DTPREL64, and
	R_AARCH64_TLS_TPREL64.
	(elf_machine_rela): Likewise.
---
 elf/elf.h                    | 20 +++++++++++++++++---
 sysdeps/aarch64/dl-machine.h | 12 ++++++------
 2 files changed, 23 insertions(+), 9 deletions(-)

Comments

Marcus Shawcroft Nov. 21, 2014, 2:31 p.m. | #1
On 18 November 2014 16:43, Will Newton <will.newton@linaro.org> wrote:
> The latest version of the binutils ELF header defines a new set of
> dynamic relocations for ILP32 and renames some to make the naming
> more uniform.
>
> ChangeLog:
>
> 2014-11-18  Will Newton  <will.newton@linaro.org>
>             Andrew Pinski  <andrew.pinski@caviumnetworks.com>
>
>         * elf/elf.h (R_AARCH64_P32_ABS32, R_AARCH64_P32_COPY,
>         R_AARCH64_P32_GLOB_DAT, R_AARCH64_P32_JUMP_SLOT,
>         R_AARCH64_P32_RELATIVE, R_AARCH64_P32_TLS_DTPMOD,
>         R_AARCH64_P32_TLS_DTPREL, R_AARCH64_P32_TLS_TPREL,
>         R_AARCH64_P32_TLSDESC, R_AARCH64_P32_IRELATIVE): Define.
>         (R_AARCH64_TLS_DTPMOD64): Rename to ..
>         (R_AARCH64_TLS_DTPMOD): This.
>         (R_AARCH64_TLS_DTPREL64): Rename to ...
>         (R_AARCH64_TLS_DTPREL): This.
>         (R_AARCH64_TLS_TPREL64): Rename to ...
>         (R_AARCH64_TLS_TPREL): This.
>         * sysdeps/aarch64/dl-machine.h (elf_machine_type_class): Update
>         R_AARCH64_TLS_DTPMOD64, R_AARCH64_TLS_DTPREL64, and
>         R_AARCH64_TLS_TPREL64.
>         (elf_machine_rela): Likewise.
> ---
>  elf/elf.h                    | 20 +++++++++++++++++---
>  sysdeps/aarch64/dl-machine.h | 12 ++++++------
>  2 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/elf/elf.h b/elf/elf.h
> index 78815e8..d752343 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -2362,6 +2362,20 @@ typedef Elf32_Addr Elf32_Conflict;
>  /* AArch64 relocs.  */
>
>  #define R_AARCH64_NONE            0    /* No relocation.  */
> +
> +/* ILP32 AARCH64 relocs. */

Nit, AArch32 and double space after period.

> +#define R_AARCH64_P32_ABS32              1     /* Direct 32 bit.  */
> +#define R_AARCH64_P32_COPY             180     /* Copy symbol at runtime.  */
> +#define R_AARCH64_P32_GLOB_DAT         181     /* Create GOT entry.  */
> +#define R_AARCH64_P32_JUMP_SLOT                182     /* Create PLT entry.  */
> +#define R_AARCH64_P32_RELATIVE         183     /* Adjust by program base.  */
> +#define R_AARCH64_P32_TLS_DTPMOD       184     /* Module number, 32 bit.  */
> +#define R_AARCH64_P32_TLS_DTPREL       185     /* Module-relative offset, 32 bit.  */
> +#define R_AARCH64_P32_TLS_TPREL                186     /* TP-relative offset, 32 bit.  */
> +#define R_AARCH64_P32_TLSDESC          187     /* TLS Descriptor.  */
> +#define R_AARCH64_P32_IRELATIVE                188     /* STT_GNU_IFUNC relocation. */
> +
> +/* LP64 AARCH64 relocs. */

Nit AArch64 and double space after period.

Oherwise OK /Marcus

Patch

diff --git a/elf/elf.h b/elf/elf.h
index 78815e8..d752343 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -2362,6 +2362,20 @@  typedef Elf32_Addr Elf32_Conflict;
 /* AArch64 relocs.  */
 
 #define R_AARCH64_NONE            0	/* No relocation.  */
+
+/* ILP32 AARCH64 relocs. */
+#define R_AARCH64_P32_ABS32		  1	/* Direct 32 bit.  */
+#define R_AARCH64_P32_COPY		180	/* Copy symbol at runtime.  */
+#define R_AARCH64_P32_GLOB_DAT		181	/* Create GOT entry.  */
+#define R_AARCH64_P32_JUMP_SLOT		182	/* Create PLT entry.  */
+#define R_AARCH64_P32_RELATIVE		183	/* Adjust by program base.  */
+#define R_AARCH64_P32_TLS_DTPMOD	184	/* Module number, 32 bit.  */
+#define R_AARCH64_P32_TLS_DTPREL	185	/* Module-relative offset, 32 bit.  */
+#define R_AARCH64_P32_TLS_TPREL		186	/* TP-relative offset, 32 bit.  */
+#define R_AARCH64_P32_TLSDESC		187	/* TLS Descriptor.  */
+#define R_AARCH64_P32_IRELATIVE		188	/* STT_GNU_IFUNC relocation. */
+
+/* LP64 AARCH64 relocs. */
 #define R_AARCH64_ABS64         257	/* Direct 64 bit. */
 #define R_AARCH64_ABS32         258	/* Direct 32 bit.  */
 #define R_AARCH64_ABS16		259	/* Direct 16-bit.  */
@@ -2479,9 +2493,9 @@  typedef Elf32_Addr Elf32_Conflict;
 #define R_AARCH64_GLOB_DAT     1025	/* Create GOT entry.  */
 #define R_AARCH64_JUMP_SLOT    1026	/* Create PLT entry.  */
 #define R_AARCH64_RELATIVE     1027	/* Adjust by program base.  */
-#define R_AARCH64_TLS_DTPMOD64 1028	/* Module number, 64 bit.  */
-#define R_AARCH64_TLS_DTPREL64 1029	/* Module-relative offset, 64 bit.  */
-#define R_AARCH64_TLS_TPREL64  1030	/* TP-relative offset, 64 bit.  */
+#define R_AARCH64_TLS_DTPMOD   1028	/* Module number, 64 bit.  */
+#define R_AARCH64_TLS_DTPREL   1029	/* Module-relative offset, 64 bit.  */
+#define R_AARCH64_TLS_TPREL    1030	/* TP-relative offset, 64 bit.  */
 #define R_AARCH64_TLSDESC      1031	/* TLS Descriptor.  */
 #define R_AARCH64_IRELATIVE	1032	/* STT_GNU_IFUNC relocation.  */
 
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 6746437..acb090d 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -188,9 +188,9 @@  _dl_start_user:							\n\
 
 #define elf_machine_type_class(type)					\
   ((((type) == R_AARCH64_JUMP_SLOT ||					\
-     (type) == R_AARCH64_TLS_DTPMOD64 ||				\
-     (type) == R_AARCH64_TLS_DTPREL64 ||				\
-     (type) == R_AARCH64_TLS_TPREL64 ||					\
+     (type) == R_AARCH64_TLS_DTPMOD ||					\
+     (type) == R_AARCH64_TLS_DTPREL ||					\
+     (type) == R_AARCH64_TLS_TPREL ||					\
      (type) == R_AARCH64_TLSDESC) * ELF_RTYPE_CLASS_PLT)		\
    | (((type) == R_AARCH64_COPY) * ELF_RTYPE_CLASS_COPY))
 
@@ -314,7 +314,7 @@  elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 	    break;
 	  }
 
-	case R_AARCH64_TLS_DTPMOD64:
+	case R_AARCH64_TLS_DTPMOD:
 #ifdef RTLD_BOOTSTRAP
 	  *reloc_addr = 1;
 #else
@@ -325,12 +325,12 @@  elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 #endif
 	  break;
 
-	case R_AARCH64_TLS_DTPREL64:
+	case R_AARCH64_TLS_DTPREL:
 	  if (sym)
 	    *reloc_addr = sym->st_value + reloc->r_addend;
 	  break;
 
-	case R_AARCH64_TLS_TPREL64:
+	case R_AARCH64_TLS_TPREL:
 	  if (sym)
 	    {
 	      CHECK_STATIC_TLS (map, sym_map);