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]

[AArch64][1/2] Gas BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14


This patch add BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 support in Gas.

The relocation modifier
===
  :gotpage_lo14:symbol

native gas check OK

OK for trunk?

2015-05-19 Jiong.Wang <jiong.wang@arm.com>

bfd/
  * reloc.c (BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14): New entry. 
  * bfd-in2.h: Regenerate.
  * libbfd.h: Regenerate.
  * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
  BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.

gas/
  * config/tc-aarch64.c (reloc_table): New relocation modifiers.
  (md_apply_fix): Support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
  (aarch64_force_relocation): Ditto.

gas/testsuite/
  * gas/aarch64/ilp32-basic.s: New testcase.
  * gas/aarch64/ilp32-basic.d: Ditto.
  
-- 
Regards,
Jiong

commit 2aa829a6b67159a59a74ad1355ac5dfcf17c719d
Author: Jiong Wang <jiong.wang@arm.com>
Date:   Tue May 12 10:38:54 2015 +0000

    2

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index e321382..7bd9d8c 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -5732,6 +5732,9 @@ the GOT entry for this symbol.  Used in conjunction with
 BFD_RELOC_AARCH64_ADR_GOTPAGE.  Valid in ILP32 ABI only.  */
   BFD_RELOC_AARCH64_LD32_GOT_LO12_NC,
 
+/* Scaled 14 bit byte offset to the page base of the global offset table.  */
+  BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14,
+
 /* Scaled 15 bit byte offset to the page base of the global offset table.  */
   BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15,
 
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index cecb8a7..1c0607f 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -848,6 +848,22 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
 	 0xffc,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
+  /* LD32: GOT offset to the page address of GOT table.
+     (G(S) - PAGE (_GLOBAL_OFFSET_TABLE_)) & 0x5ffc.  */
+  HOWTO32 (AARCH64_R (LD32_GOTPAGE_LO14),	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_unsigned,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 AARCH64_R_STR (LD32_GOTPAGE_LO14),	/* name */
+	 FALSE,			/* partial_inplace */
+	 0x5ffc,		/* src_mask */
+	 0x5ffc,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
+
   /* LD64: GOT offset to the page address of GOT table.
      (G(S) - PAGE (_GLOBAL_OFFSET_TABLE_)) & 0x7ff8.  */
   HOWTO64 (AARCH64_R (LD64_GOTPAGE_LO15),	/* type */
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 73a5803..b2a0979 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -2733,6 +2733,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_AARCH64_ADR_GOT_PAGE",
   "BFD_RELOC_AARCH64_LD64_GOT_LO12_NC",
   "BFD_RELOC_AARCH64_LD32_GOT_LO12_NC",
+  "BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14",
   "BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15",
   "BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21",
   "BFD_RELOC_AARCH64_TLSGD_ADR_PREL21",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 4ee384f..7f2b31e 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -6762,6 +6762,10 @@ ENUMDOC
   the GOT entry for this symbol.  Used in conjunction with
   BFD_RELOC_AARCH64_ADR_GOTPAGE.  Valid in ILP32 ABI only.
 ENUM
+  BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14
+ENUMDOC
+  Scaled 14 bit byte offset to the page base of the global offset table.
+ENUM
   BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15
 ENUMDOC
   Scaled 15 bit byte offset to the page base of the global offset table.
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 2139f9d..2782a2a 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -2598,6 +2598,15 @@ static struct reloc_table_entry reloc_table[] = {
    0,
    BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15,
    0},
+
+  /* 14bit offset from got entry to base address of GOT table.  */
+  {"gotpage_lo14", 0,
+   0,
+   0,
+   0,
+   0,
+   BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14,
+   0},
 };
 
 /* Given the address of a pointer pointing to the textual name of a
@@ -6767,6 +6776,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
     case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
     case BFD_RELOC_AARCH64_GOT_LD_PREL19:
     case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+    case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
     case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
     case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
     case BFD_RELOC_AARCH64_LDST128_LO12:
@@ -6921,6 +6931,7 @@ aarch64_force_relocation (struct fix *fixp)
     case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
     case BFD_RELOC_AARCH64_GOT_LD_PREL19:
     case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+    case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
     case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
     case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
     case BFD_RELOC_AARCH64_LDST128_LO12:
diff --git a/gas/testsuite/gas/aarch64/ilp32-basic.d b/gas/testsuite/gas/aarch64/ilp32-basic.d
index 2e5146a..3caef3e 100644
--- a/gas/testsuite/gas/aarch64/ilp32-basic.d
+++ b/gas/testsuite/gas/aarch64/ilp32-basic.d
@@ -21,3 +21,5 @@ Disassembly of section \.text:
 			18: R_AARCH64_P32_LD32_GOT_LO12_NC	ptrs
   1c:	2a0403e0 	mov	w0, w4
   20:	d65f03c0 	ret
+  24:	f9400083 	ldr	x3, \[x4\]
+			24: R_AARCH64_P32_LD32_GOTPAGE_LO14	ptrs
diff --git a/gas/testsuite/gas/aarch64/ilp32-basic.s b/gas/testsuite/gas/aarch64/ilp32-basic.s
index 790dcdf..ab11ea8 100644
--- a/gas/testsuite/gas/aarch64/ilp32-basic.s
+++ b/gas/testsuite/gas/aarch64/ilp32-basic.s
@@ -13,5 +13,6 @@ foo:
 	ldr	x3, [x4,#:got_lo12:ptrs]
 	mov	w0, w4
 	ret
+	ldr	x3, [x4,#:gotpage_lo14:ptrs]
 	.size	foo, .-foo
 	.comm	ptrs,12,8

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