This is the mail archive of the binutils-cvs@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]

[binutils-gdb] [AArch64] Fix function pointer variable with -Bsymbolic-functions


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0941db698eba22727c9a944b5da5c76ae93cc664

commit 0941db698eba22727c9a944b5da5c76ae93cc664
Author: Jiong Wang <jiong.wang@arm.com>
Date:   Tue Jan 13 11:36:54 2015 +0000

    [AArch64] Fix function pointer variable with -Bsymbolic-functions
    
    bfd/ChangeLog
    
    2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
    
        * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
        SYMBOLIC_BIND to check if a symbol should be bound symbolically.
    
    ld/testsuite/ChangeLog
    
    2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com>
    
        * ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func test.
        * ld-aarch64/relocs-257-symbolic-func.d: New file.
        * ld-aarch64/relocs-257-symbolic-func.s: Likewise.

Diff:
---
 bfd/ChangeLog                                      |  5 +++++
 bfd/elfnn-aarch64.c                                |  2 +-
 ld/testsuite/ChangeLog                             |  6 ++++++
 ld/testsuite/ld-aarch64/aarch64-elf.exp            |  1 +
 ld/testsuite/ld-aarch64/relocs-257-symbolic-func.d |  5 +++++
 ld/testsuite/ld-aarch64/relocs-257-symbolic-func.s | 11 +++++++++++
 6 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b43a491..c6aa966 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-13  Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOLIC_BIND
+	to check if a symbol should be bound symbolically.
+
 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
 
 	* elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index c8401c1..e5939a8 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -4337,7 +4337,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
 	    memset (&outrel, 0, sizeof outrel);
 	  else if (h != NULL
 		   && h->dynindx != -1
-		   && (!info->shared || !info->symbolic || !h->def_regular))
+		   && (!info->shared || !SYMBOLIC_BIND (info, h) || !h->def_regular))
 	    outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type);
 	  else
 	    {
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 27f8bc3..3ab61c7 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-13  Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+	* ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func test.
+	* ld-aarch64/relocs-257-symbolic-func.d: New file.
+	* ld-aarch64/relocs-257-symbolic-func.s: Likewise.
+
 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
 
 	* ld-aarch64/tprel_g2_overflow.s: New testcase.
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 7d421a5..4810d60 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -177,6 +177,7 @@ run_dump_test "ifunc-21"
 run_dump_test "ifunc-22"
 
 run_dump_test "relasz"
+run_dump_test "relocs-257-symbolic-func"
 
 set aarch64elflinktests {
   {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
diff --git a/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.d b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.d
new file mode 100644
index 0000000..810fd43
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.d
@@ -0,0 +1,5 @@
+#source: relocs-257-symbolic-func.s
+#ld: -shared -Bsymbolic-functions
+#readelf: -r --wide
+#...
+.* +R_AARCH64_RELATIVE +.*
diff --git a/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.s b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.s
new file mode 100644
index 0000000..35d5ba8
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/relocs-257-symbolic-func.s
@@ -0,0 +1,11 @@
+	.text
+	.global tempy
+	.type   tempy, %function
+tempy:
+	.size   tempy, .-tempy
+	.section	.data.rel
+	.align 3
+	.type   tempy_ptr, %object
+	.size   tempy_ptr, 8
+tempy_ptr:
+	.xword	tempy


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