This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, AARCH64] support R_AARCH64_NONE as gas input for 64-bit code


The aarch64 assembler accepts the deprecated R_AARCH64_NULL reloc, but
not the preferred R_AARCH64_NONE reloc.

palantir:2134$ cat tmp.s
 .text
 .reloc 0, R_AARCH64_NULL, 0
palantir:2135$ ./as-new tmp.s
palantir:2136$ cat tmp2.s
 .text
 .reloc 0, R_AARCH64_NONE, 0
palantir:2137$ ./as-new tmp2.s
tmp2.s: Assembler messages:
tmp2.s:2: Error: unrecognized reloc type
palantir:2138$

Curiously, looking at the code, I see that the aarch64 port accepts
only R_AARCH64_NULL for 64-bit code and only R_AARCH64_NONE for 32-bit
code. I don't know the history of R_AARCH64_NULL, but assuming we
still need to support it for backwards compatibilty, then we need to
accept both for 64-bit code.  We can still only accept R_AARCH64_NONE
for 32-bit code.  The attached patch does this.

This was tested with an aarch64-linux cross build and make check.
There were no regressions.

Jim
2016-05-09  Jim Wilson  <jim.wilson@linaro.org>

	bfd/
	* elfnn-aarch64.c: Unconditionally enable R_AARCH64_NULL and
	R_AARCH64_NONE.  Use HOWTO64 for R_AARCH64_NULL.
	* relocs.c: Add BFD_RELOC_AARCH64_NULL.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Likewise.

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index f68c1076..7f7c008 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -5716,6 +5716,9 @@ important as several tables in the AArch64 bfd backend are indexed
 by these enumerators; make sure they are all synced.  */
   BFD_RELOC_AARCH64_RELOC_START,
 
+/* Deprecated AArch64 null relocation code.  */
+  BFD_RELOC_AARCH64_NULL,
+
 /* AArch64 null relocation code.  */
   BFD_RELOC_AARCH64_NONE,
 
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index eecbf87..4194765 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -339,8 +339,8 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
 
   /* Basic data relocations.  */
 
-#if ARCH_SIZE == 64
-  HOWTO (R_AARCH64_NULL,	/* type */
+  /* Deprecated, but retained for backwards compatibility.  */
+  HOWTO64 (R_AARCH64_NULL,	/* type */
 	 0,			/* rightshift */
 	 3,			/* size (0 = byte, 1 = short, 2 = long) */
 	 0,			/* bitsize */
@@ -353,7 +353,6 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
-#else
   HOWTO (R_AARCH64_NONE,	/* type */
 	 0,			/* rightshift */
 	 3,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -367,7 +366,6 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
-#endif
 
   /* .xword: (S+A) */
   HOWTO64 (AARCH64_R (ABS64),	/* type */
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 5fe45ec..33490c0 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -2792,6 +2792,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL",
   "BFD_RELOC_MICROBLAZE_64_TLSTPREL",
   "BFD_RELOC_AARCH64_RELOC_START",
+  "BFD_RELOC_AARCH64_NULL",
   "BFD_RELOC_AARCH64_NONE",
   "BFD_RELOC_AARCH64_64",
   "BFD_RELOC_AARCH64_32",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index c3b713b..1f21037 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -6776,6 +6776,10 @@ ENUMDOC
   important as several tables in the AArch64 bfd backend are indexed
   by these enumerators; make sure they are all synced.
 ENUM
+  BFD_RELOC_AARCH64_NULL
+ENUMDOC
+  Deprecated AArch64 null relocation code.
+ENUM
   BFD_RELOC_AARCH64_NONE
 ENUMDOC
   AArch64 null relocation code.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]