public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64
@ 2014-07-04 17:15 Jiong Wang
  2014-07-04 23:04 ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Jiong Wang @ 2014-07-04 17:15 UTC (permalink / raw)
  To: binutils; +Cc: Alan Modra

[-- Attachment #1: Type: text/plain, Size: 2130 bytes --]

If we are generating non-relocatable object and --emit-relocs specified, aarch64 ld
is actually generating wrong addend for rela entry when relocate against local symbol.
(I verified that mips and sparc are generating wrong addend under this situation also)

for example, for simple testcase

foo.c:

const char * const a = "foo";

const char *
foo ()
{
   return a;
}

bar.c:
const char * const b = "bar";

const char * bar ()
{
   return b;
}

aarch64-none-linux-gnu-gcc xy.c -c
aarch64-none-linux-gnu-gcc xx.c -c
aarch64-none-linux-gnu-ld --emit-relocs -o xo.o  xx.o xy.o
aarch64-none-linux-gnu-readelf -r xo.o

Relocation section '.rela.text' at offset 0x102f8 contains 4 entries:
   Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000400000  000200000113 R_AARCH64_ADR_PRE 0000000000400018 .rodata + 0
000000400004  000200000115 R_AARCH64_ADD_ABS 0000000000400018 .rodata + 0
00000040000c  000200000113 R_AARCH64_ADR_PRE 0000000000400018 .rodata + 0
000000400010  000200000115 R_AARCH64_ADD_ABS 0000000000400018 .rodata + 0

while it should be:

Relocation section '.rela.text' at offset 0x102f8 contains 4 entries:
   Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000400000  000200000113 R_AARCH64_ADR_PRE 0000000000400018 .rodata + 0
000000400004  000200000115 R_AARCH64_ADD_ABS 0000000000400018 .rodata + 0
00000040000c  000200000113 R_AARCH64_ADR_PRE 0000000000400018 .rodata + 10
000000400010  000200000115 R_AARCH64_ADD_ABS 0000000000400018 .rodata + 10


bfd generic code will actually handle this situation, but only when elf_backend_rela_normal set to '1'.
this patch fix this, so that rela addend handled correctly by generic code on aarch64 target.

no regression on aarch64 bare metal full test.

ok for trunk ?

thanks.

bfd/
   * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.

ld/testsuite/
   * ld-aarch64/emit-relocs-local-addend-bar.s: New source file.
   * ld-aarch64/emit-relocs-local-addend-foo.s: Likewise.
   * ld-aarch64/emit-relocs-local-addend.d: New testcase.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-emit-relocs.patch --]
[-- Type: text/x-patch; name=fix-emit-relocs.patch, Size: 3302 bytes --]

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index d917c7e..2631c31 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -7290,6 +7290,7 @@ const struct elf_size_info elfNN_aarch64_size_info =
 #define elf_backend_may_use_rel_p      0
 #define elf_backend_may_use_rela_p     1
 #define elf_backend_default_use_rela_p 1
+#define elf_backend_rela_normal        1
 #define elf_backend_got_header_size (GOT_ENTRY_SIZE * 3)
 #define elf_backend_default_execstack  0

diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 845ea20..a6db0a2 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -87,6 +87,8 @@ run_dump_test "emit-relocs-309-low-bad"
 run_dump_test "emit-relocs-311"
 run_dump_test "emit-relocs-312"

+# test addend correctness when --emit-relocs specified for non-relocatable obj.
+run_dump_test "emit-relocs-local-addend"

 run_dump_test "limit-b"
 run_dump_test "limit-bl"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s
new file mode 100644
index 0000000..ab8b0fb
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s
@@ -0,0 +1,19 @@
+	.global	b
+	.section	.rodata
+	.align	3
+.LC0:
+	.string	"bar"
+	.align	3
+	.type	b, %object
+	.size	b, 8
+b:
+	.xword	.LC0
+	.text
+	.align	2
+	.global	bar
+	.type	bar, %function
+bar:
+	adrp	x0, .LC0
+	add	x0, x0, :lo12:.LC0
+	ret
+	.size	bar, .-bar
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s
new file mode 100644
index 0000000..497eef7
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s
@@ -0,0 +1,20 @@
+	.cpu generic+fp+simd
+	.global	a
+	.section	.rodata
+	.align	3
+.LC0:
+	.string	"foo"
+	.align	3
+	.type	a, %object
+	.size	a, 8
+a:
+	.xword	.LC0
+	.text
+	.align	2
+	.global	foo
+	.type	foo, %function
+foo:
+	adrp	x0, .LC0
+	add	x0, x0, :lo12:.LC0
+	ret
+	.size	foo, .-foo
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d b/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d
new file mode 100644
index 0000000..1739e64
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d
@@ -0,0 +1,16 @@
+#source: emit-relocs-local-addend-foo.s
+#source: emit-relocs-local-addend-bar.s
+#ld: -e0 --emit-relocs
+#readelf: -r
+
+Relocation section '\.rela\.text' at offset 0x102f8 contains 4 entries:
+  Offset          Info           Type           Sym\. Value    Sym\. Name \+ Addend
+000000400000  000200000113 R_AARCH64_ADR_PRE 0000000000400018 \.rodata \+ 0
+000000400004  000200000115 R_AARCH64_ADD_ABS 0000000000400018 \.rodata \+ 0
+00000040000c  000200000113 R_AARCH64_ADR_PRE 0000000000400018 \.rodata \+ 10
+000000400010  000200000115 R_AARCH64_ADD_ABS 0000000000400018 \.rodata \+ 10
+
+Relocation section '\.rela\.rodata' at offset 0x10358 contains 2 entries:
+  Offset          Info           Type           Sym\. Value    Sym. Name \+ Addend
+000000400020  000200000101 R_AARCH64_ABS64   0000000000400018 \.rodata \+ 0
+000000400030  000200000101 R_AARCH64_ABS64   0000000000400018 \.rodata \+ 10

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64
  2014-07-04 17:15 [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64 Jiong Wang
@ 2014-07-04 23:04 ` Alan Modra
  2014-07-07 16:19   ` Jiong Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2014-07-04 23:04 UTC (permalink / raw)
  To: Jiong Wang; +Cc: binutils

On Fri, Jul 04, 2014 at 06:15:08PM +0100, Jiong Wang wrote:
> bfd/
>   * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.

This patch will break ld -r, since you will be adjusting relocs
against section symbols twice.  The following code in elfnn-aarch64.c
needs adjusting too.

      if (info->relocatable)
	{
	  /* This is a relocatable link.  We don't have to change
	     anything, unless the reloc is against a section symbol,
	     in which case we have to adjust according to where the
	     section symbol winds up in the output section.  */
	  if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
	    rel->r_addend += sec->output_offset;
	  continue;
	}

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64
  2014-07-04 23:04 ` Alan Modra
@ 2014-07-07 16:19   ` Jiong Wang
  2014-07-07 16:28     ` Jiong Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Jiong Wang @ 2014-07-07 16:19 UTC (permalink / raw)
  To: Alan Modra; +Cc: Marcus Shawcroft, binutils

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]


On 05/07/14 00:04, Alan Modra wrote:
> On Fri, Jul 04, 2014 at 06:15:08PM +0100, Jiong Wang wrote:
>> bfd/
>>    * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.
> This patch will break ld -r, since you will be adjusting relocs
> against section symbols twice.  The following code in elfnn-aarch64.c
> needs adjusting too.
>
>        if (info->relocatable)
> 	{
> 	  /* This is a relocatable link.  We don't have to change
> 	     anything, unless the reloc is against a section symbol,
> 	     in which case we have to adjust according to where the
> 	     section symbol winds up in the output section.  */
> 	  if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
> 	    rel->r_addend += sec->output_offset;
> 	  continue;
> 	}
thanks very much for pointing this out.

below is updated patch which removes the redundant adjustment.

OK for trunk?

thanks.

Jiong


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-emit-relocs.patch --]
[-- Type: text/x-patch; name=fix-emit-relocs.patch, Size: 5120 bytes --]

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index d917c7e..1b99bd4 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -4157,15 +4157,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
 					 rel, 1, relend, howto, 0, contents);

       if (info->relocatable)
-	{
-	  /* This is a relocatable link.  We don't have to change
-	     anything, unless the reloc is against a section symbol,
-	     in which case we have to adjust according to where the
-	     section symbol winds up in the output section.  */
-	  if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-	    rel->r_addend += sec->output_offset;
-	  continue;
-	}
+	continue;

       if (h != NULL)
 	name = h->root.root.string;
@@ -7290,6 +7282,7 @@ const struct elf_size_info elfNN_aarch64_size_info =
 #define elf_backend_may_use_rel_p      0
 #define elf_backend_may_use_rela_p     1
 #define elf_backend_default_use_rela_p 1
+#define elf_backend_rela_normal        1
 #define elf_backend_got_header_size (GOT_ENTRY_SIZE * 3)
 #define elf_backend_default_execstack  0

diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 845ea20..36babf3 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -87,6 +87,10 @@ run_dump_test "emit-relocs-309-low-bad"
 run_dump_test "emit-relocs-311"
 run_dump_test "emit-relocs-312"

+# test addend correctness when --emit-relocs specified for non-relocatable obj.
+run_dump_test "emit-relocs-local-addend"
+# test addend correctness when -r specified.
+run_dump_test "local-addend-r"

 run_dump_test "limit-b"
 run_dump_test "limit-bl"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s
new file mode 100644
index 0000000..ab8b0fb
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s
@@ -0,0 +1,19 @@
+	.global	b
+	.section	.rodata
+	.align	3
+.LC0:
+	.string	"bar"
+	.align	3
+	.type	b, %object
+	.size	b, 8
+b:
+	.xword	.LC0
+	.text
+	.align	2
+	.global	bar
+	.type	bar, %function
+bar:
+	adrp	x0, .LC0
+	add	x0, x0, :lo12:.LC0
+	ret
+	.size	bar, .-bar
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s
new file mode 100644
index 0000000..497eef7
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s
@@ -0,0 +1,20 @@
+	.cpu generic+fp+simd
+	.global	a
+	.section	.rodata
+	.align	3
+.LC0:
+	.string	"foo"
+	.align	3
+	.type	a, %object
+	.size	a, 8
+a:
+	.xword	.LC0
+	.text
+	.align	2
+	.global	foo
+	.type	foo, %function
+foo:
+	adrp	x0, .LC0
+	add	x0, x0, :lo12:.LC0
+	ret
+	.size	foo, .-foo
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d b/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d
new file mode 100644
index 0000000..1739e64
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d
@@ -0,0 +1,16 @@
+#source: emit-relocs-local-addend-foo.s
+#source: emit-relocs-local-addend-bar.s
+#ld: -e0 --emit-relocs
+#readelf: -r
+
+Relocation section '\.rela\.text' at offset 0x102f8 contains 4 entries:
+  Offset          Info           Type           Sym\. Value    Sym\. Name \+ Addend
+000000400000  000200000113 R_AARCH64_ADR_PRE 0000000000400018 \.rodata \+ 0
+000000400004  000200000115 R_AARCH64_ADD_ABS 0000000000400018 \.rodata \+ 0
+00000040000c  000200000113 R_AARCH64_ADR_PRE 0000000000400018 \.rodata \+ 10
+000000400010  000200000115 R_AARCH64_ADD_ABS 0000000000400018 \.rodata \+ 10
+
+Relocation section '\.rela\.rodata' at offset 0x10358 contains 2 entries:
+  Offset          Info           Type           Sym\. Value    Sym. Name \+ Addend
+000000400020  000200000101 R_AARCH64_ABS64   0000000000400018 \.rodata \+ 0
+000000400030  000200000101 R_AARCH64_ABS64   0000000000400018 \.rodata \+ 10
diff --git a/ld/testsuite/ld-aarch64/local-addend-r.d b/ld/testsuite/ld-aarch64/local-addend-r.d
new file mode 100644
index 0000000..c8c2777
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/local-addend-r.d
@@ -0,0 +1,16 @@
+#source: emit-relocs-local-addend-foo.s
+#source: emit-relocs-local-addend-bar.s
+#ld: -e0 -r
+#readelf: -r
+
+Relocation section '\.rela\.text' at offset 0x338 contains 4 entries:
+  Offset          Info           Type           Sym\. Value    Sym\. Name \+ Addend
+000000000000  000200000113 R_AARCH64_ADR_PRE 0000000000000000 \.rodata \+ 0
+000000000004  000200000115 R_AARCH64_ADD_ABS 0000000000000000 \.rodata \+ 0
+00000000000c  000200000113 R_AARCH64_ADR_PRE 0000000000000000 \.rodata \+ 10
+000000000010  000200000115 R_AARCH64_ADD_ABS 0000000000000000 \.rodata \+ 10
+
+Relocation section '\.rela\.rodata' at offset 0x398 contains 2 entries:
+  Offset          Info           Type           Sym\. Value    Sym. Name \+ Addend
+000000000008  000200000101 R_AARCH64_ABS64   0000000000000000 \.rodata \+ 0
+000000000018  000200000101 R_AARCH64_ABS64   0000000000000000 \.rodata \+ 10

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64
  2014-07-07 16:19   ` Jiong Wang
@ 2014-07-07 16:28     ` Jiong Wang
  2014-07-08  0:38       ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Jiong Wang @ 2014-07-07 16:28 UTC (permalink / raw)
  To: Alan Modra; +Cc: Marcus Shawcroft, binutils

[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]


On 07/07/14 17:19, Jiong Wang wrote:
> On 05/07/14 00:04, Alan Modra wrote:
>> On Fri, Jul 04, 2014 at 06:15:08PM +0100, Jiong Wang wrote:
>>> bfd/
>>>     * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.
>> This patch will break ld -r, since you will be adjusting relocs
>> against section symbols twice.  The following code in elfnn-aarch64.c
>> needs adjusting too.
>>
>>         if (info->relocatable)
>> 	{
>> 	  /* This is a relocatable link.  We don't have to change
>> 	     anything, unless the reloc is against a section symbol,
>> 	     in which case we have to adjust according to where the
>> 	     section symbol winds up in the output section.  */
>> 	  if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
>> 	    rel->r_addend += sec->output_offset;
>> 	  continue;
>> 	}
> thanks very much for pointing this out.
>
> below is updated patch which removes the redundant adjustment.
>
> OK for trunk?
sorry, re-sent patch with changelog.

ok for trunk?

bfd/
   * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.
   (elfNN_aarch64_relocate_section): Remove duplicated addend adjustment
   when info->relocatable be true.

ld/testsuite/
   * ld-aarch64/emit-relocs-local-addend-bar.s: New source file.
   * ld-aarch64/emit-relocs-local-addend-foo.s: Likewise.
   * ld-aarch64/emit-relocs-local-addend.d: New testcase.
   * ld-aarch64/local-addend-r.d: Likewise.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-emit-relocs.patch --]
[-- Type: text/x-patch; name=fix-emit-relocs.patch, Size: 5118 bytes --]

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index d917c7e..1b99bd4 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -4157,15 +4157,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
 					 rel, 1, relend, howto, 0, contents);

       if (info->relocatable)
-	{
-	  /* This is a relocatable link.  We don't have to change
-	     anything, unless the reloc is against a section symbol,
-	     in which case we have to adjust according to where the
-	     section symbol winds up in the output section.  */
-	  if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-	    rel->r_addend += sec->output_offset;
-	  continue;
-	}
+	continue;

       if (h != NULL)
 	name = h->root.root.string;
@@ -7290,6 +7282,7 @@ const struct elf_size_info elfNN_aarch64_size_info =
 #define elf_backend_may_use_rel_p      0
 #define elf_backend_may_use_rela_p     1
 #define elf_backend_default_use_rela_p 1
+#define elf_backend_rela_normal        1
 #define elf_backend_got_header_size (GOT_ENTRY_SIZE * 3)
 #define elf_backend_default_execstack  0

diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 845ea20..36babf3 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -87,6 +87,10 @@ run_dump_test "emit-relocs-309-low-bad"
 run_dump_test "emit-relocs-311"
 run_dump_test "emit-relocs-312"

+# test addend correctness when --emit-relocs specified for non-relocatable obj.
+run_dump_test "emit-relocs-local-addend"
+# test addend correctness when -r specified.
+run_dump_test "local-addend-r"

 run_dump_test "limit-b"
 run_dump_test "limit-bl"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s
new file mode 100644
index 0000000..ab8b0fb
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-bar.s
@@ -0,0 +1,19 @@
+	.global	b
+	.section	.rodata
+	.align	3
+.LC0:
+	.string	"bar"
+	.align	3
+	.type	b, %object
+	.size	b, 8
+b:
+	.xword	.LC0
+	.text
+	.align	2
+	.global	bar
+	.type	bar, %function
+bar:
+	adrp	x0, .LC0
+	add	x0, x0, :lo12:.LC0
+	ret
+	.size	bar, .-bar
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s
new file mode 100644
index 0000000..497eef7
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend-foo.s
@@ -0,0 +1,20 @@
+	.cpu generic+fp+simd
+	.global	a
+	.section	.rodata
+	.align	3
+.LC0:
+	.string	"foo"
+	.align	3
+	.type	a, %object
+	.size	a, 8
+a:
+	.xword	.LC0
+	.text
+	.align	2
+	.global	foo
+	.type	foo, %function
+foo:
+	adrp	x0, .LC0
+	add	x0, x0, :lo12:.LC0
+	ret
+	.size	foo, .-foo
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d b/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d
new file mode 100644
index 0000000..1739e64
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-local-addend.d
@@ -0,0 +1,16 @@
+#source: emit-relocs-local-addend-foo.s
+#source: emit-relocs-local-addend-bar.s
+#ld: -e0 --emit-relocs
+#readelf: -r
+
+Relocation section '\.rela\.text' at offset 0x102f8 contains 4 entries:
+  Offset          Info           Type           Sym\. Value    Sym\. Name \+ Addend
+000000400000  000200000113 R_AARCH64_ADR_PRE 0000000000400018 \.rodata \+ 0
+000000400004  000200000115 R_AARCH64_ADD_ABS 0000000000400018 \.rodata \+ 0
+00000040000c  000200000113 R_AARCH64_ADR_PRE 0000000000400018 \.rodata \+ 10
+000000400010  000200000115 R_AARCH64_ADD_ABS 0000000000400018 \.rodata \+ 10
+
+Relocation section '\.rela\.rodata' at offset 0x10358 contains 2 entries:
+  Offset          Info           Type           Sym\. Value    Sym. Name \+ Addend
+000000400020  000200000101 R_AARCH64_ABS64   0000000000400018 \.rodata \+ 0
+000000400030  000200000101 R_AARCH64_ABS64   0000000000400018 \.rodata \+ 10
diff --git a/ld/testsuite/ld-aarch64/local-addend-r.d b/ld/testsuite/ld-aarch64/local-addend-r.d
new file mode 100644
index 0000000..c8c2777
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/local-addend-r.d
@@ -0,0 +1,16 @@
+#source: emit-relocs-local-addend-foo.s
+#source: emit-relocs-local-addend-bar.s
+#ld: -e0 -r
+#readelf: -r
+
+Relocation section '\.rela\.text' at offset 0x338 contains 4 entries:
+  Offset          Info           Type           Sym\. Value    Sym\. Name \+ Addend
+000000000000  000200000113 R_AARCH64_ADR_PRE 0000000000000000 \.rodata \+ 0
+000000000004  000200000115 R_AARCH64_ADD_ABS 0000000000000000 \.rodata \+ 0
+00000000000c  000200000113 R_AARCH64_ADR_PRE 0000000000000000 \.rodata \+ 10
+000000000010  000200000115 R_AARCH64_ADD_ABS 0000000000000000 \.rodata \+ 10
+
+Relocation section '\.rela\.rodata' at offset 0x398 contains 2 entries:
+  Offset          Info           Type           Sym\. Value    Sym. Name \+ Addend
+000000000008  000200000101 R_AARCH64_ABS64   0000000000000000 \.rodata \+ 0
+000000000018  000200000101 R_AARCH64_ABS64   0000000000000000 \.rodata \+ 10

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64
  2014-07-07 16:28     ` Jiong Wang
@ 2014-07-08  0:38       ` Alan Modra
  2014-07-08  7:37         ` Marcus Shawcroft
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2014-07-08  0:38 UTC (permalink / raw)
  To: Jiong Wang; +Cc: Marcus Shawcroft, binutils

On Mon, Jul 07, 2014 at 05:27:58PM +0100, Jiong Wang wrote:
> bfd/
>   * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.
>   (elfNN_aarch64_relocate_section): Remove duplicated addend adjustment
>   when info->relocatable be true.

This looks good to me.  Please wait for Marcus' OK to commit.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64
  2014-07-08  0:38       ` Alan Modra
@ 2014-07-08  7:37         ` Marcus Shawcroft
  0 siblings, 0 replies; 6+ messages in thread
From: Marcus Shawcroft @ 2014-07-08  7:37 UTC (permalink / raw)
  To: Jiong Wang, Marcus Shawcroft, binutils

On 8 July 2014 01:38, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Jul 07, 2014 at 05:27:58PM +0100, Jiong Wang wrote:
>> bfd/
>>   * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1.
>>   (elfNN_aarch64_relocate_section): Remove duplicated addend adjustment
>>   when info->relocatable be true.


OK, thanks Jiong  /Marcus

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-08  7:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04 17:15 [PATCH][AArch64/bfd] Enable elf_backend_rela_normal for AArch64 Jiong Wang
2014-07-04 23:04 ` Alan Modra
2014-07-07 16:19   ` Jiong Wang
2014-07-07 16:28     ` Jiong Wang
2014-07-08  0:38       ` Alan Modra
2014-07-08  7:37         ` Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).