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] Avoid the use of gp-relative addressing when abicalls are in effect.


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

commit 00acd688caf385f38493ebd8d0a7b5f94d501a79
Author: Catherine Moore <clm@codesourcery.com>
Date:   Mon Jan 25 12:39:40 2016 -0800

    Avoid the use of gp-relative addressing when abicalls are in effect.

Diff:
---
 gas/ChangeLog                     |  8 ++++++++
 gas/config/tc-mips.c              |  6 ++++++
 gas/testsuite/gas/mips/mips.exp   |  1 +
 gas/testsuite/gas/mips/sdata-gp.d | 11 +++++++++++
 gas/testsuite/gas/mips/sdata-gp.s |  7 +++++++
 5 files changed, 33 insertions(+)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3cb5f14..910af9d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2016-01-25  Catherine Moore  <clm@codesourcery.com>
+
+	* config/mips/tc-mips.c (md_begin): Avoid gp-relative addressing
+	if abicalls are in effect.
+	* testsuite/gas/mips/sdata-gp.s: New test.
+	* testsuite/gas/mips/sdata-gp.d: New expected output
+	* testsuite/gas/mips/mips.exp: Run new test.
+
 2016-01-25  Renlin Li  <renlin.li@arm.com>
 
 	* testsuite/gas/arm/thumb2_it_search.d: New.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index d577774..7b34a4b 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -3464,6 +3464,12 @@ md_begin (void)
 	as_bad (_("-G may not be used in position-independent code"));
       g_switch_value = 0;
     }
+  else if (mips_abicalls)
+    {
+      if (g_switch_seen && g_switch_value != 0)
+	as_bad (_("-G may not be used with abicalls"));
+      g_switch_value = 0;
+    }
 
   if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_opts.arch))
     as_warn (_("could not set architecture and machine"));
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 6645e83..d30b3b5 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -741,6 +741,7 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "rol64-hw"	[mips_arch_list_matching gpr64 ror]
 
     run_dump_test "sb"
+    run_dump_test_arches "sdata-gp"	[mips_arch_list_matching mips1]
     run_dump_test "trunc"
     run_dump_test "ulh"
     run_dump_test_arches "ulh2-eb"	[mips_arch_list_matching mips1 !mips32r6]
diff --git a/gas/testsuite/gas/mips/sdata-gp.d b/gas/testsuite/gas/mips/sdata-gp.d
new file mode 100644
index 0000000..410d379
--- /dev/null
+++ b/gas/testsuite/gas/mips/sdata-gp.d
@@ -0,0 +1,11 @@
+#as: -call_nonpic -32
+#objdump: -D --section=.text --prefix-addresses
+#name: .sdata and abicalls
+
+.*:.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> lui	v0,0x0
+0+0004 <[^>]*> lw	v0,0\(v0\)
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/sdata-gp.s b/gas/testsuite/gas/mips/sdata-gp.s
new file mode 100644
index 0000000..fa4aa28
--- /dev/null
+++ b/gas/testsuite/gas/mips/sdata-gp.s
@@ -0,0 +1,7 @@
+	.sdata
+c0101:	.word	0xabcd
+
+	.text
+	.align	4
+test:
+	lw	$2, c0101


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