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: PR gas/10677: Keep local R_X86_64_GOTPCREL


Hi,

We need to keep local R_X86_64_GOTPCREL for

	movq	foo@GOTPCREL(%rip), %rax

where foo is defined locally.  I am checking it in.


H.J.
---
gas/

2009-09-24  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/10677
	* config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Return true
	for BFD_RELOC_X86_64_GOTPCREL.

gas/testsuite/

2009-09-24  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/10677
	* gas/i386/i386.exp: Run x86-64-localpic.

	* gas/i386/x86-64-localpic.d: New.
	* gas/i386/x86-64-localpic.s: Likewise.
Index: gas/testsuite/gas/i386/x86-64-localpic.d
===================================================================
--- gas/testsuite/gas/i386/x86-64-localpic.d	(revision 0)
+++ gas/testsuite/gas/i386/x86-64-localpic.d	(revision 0)
@@ -0,0 +1,9 @@
+#readelf: -rs
+#name: x86-64 local PIC
+
+Relocation section '.rela.text' at offset 0x[0-9a-f]+ contains 1 entries:
+  Offset          Info           Type           Sym. Value    Sym. Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ R_X86_64_GOTPCREL +[0-9a-f]+ +foo - 4
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +foo
+#pass
Index: gas/testsuite/gas/i386/i386.exp
===================================================================
--- gas/testsuite/gas/i386/i386.exp	(revision 6953)
+++ gas/testsuite/gas/i386/i386.exp	(working copy)
@@ -338,21 +338,17 @@ if [expr ([istarget "i*86-*-*"] || [ista
 	run_dump_test "rex"
     }
 
-    # For ELF targets verify that @unwind works.
-    if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"]
-	  || [istarget "*-*-solaris2.*"])
-	 && ![istarget *-*-linux*aout*]
-	 && ![istarget *-*-linux*oldld*] } then {
-	run_dump_test "x86-64-unwind"
-    }
-
     # ELF specific tests
     if [is_elf_format] then {
+	# Verify that @unwind works.
+	run_dump_test "x86-64-unwind"
+
 	run_dump_test "reloc64"
 	run_list_test "reloc64" "--defsym _bad_=1"
 	run_dump_test "mixed-mode-reloc64"
 	run_dump_test "x86-64-ifunc"
 	run_dump_test "l1om"
+	run_dump_test "x86-64-localpic"
     }
 
     set ASFLAGS "$old_ASFLAGS"
Index: gas/testsuite/gas/i386/x86-64-localpic.s
===================================================================
--- gas/testsuite/gas/i386/x86-64-localpic.s	(revision 0)
+++ gas/testsuite/gas/i386/x86-64-localpic.s	(revision 0)
@@ -0,0 +1,4 @@
+	.text
+foo:
+	.quad 0
+	movq	foo@GOTPCREL(%rip), %rax
Index: gas/config/tc-i386.h
===================================================================
--- gas/config/tc-i386.h	(revision 6953)
+++ gas/config/tc-i386.h	(working copy)
@@ -156,6 +156,7 @@ extern int tc_i386_fix_adjustable (struc
   (!(FIX)->fx_pcrel					\
    || (FIX)->fx_r_type == BFD_RELOC_386_PLT32		\
    || (FIX)->fx_r_type == BFD_RELOC_386_GOTPC		\
+   || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCREL	\
    || TC_FORCE_RELOCATION (FIX))
 
 extern int i386_parse_name (char *, expressionS *, char *);


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