This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Remove BFD_RELOC_386_GOT32 in TC_FORCE_RELOCATION_LOCAL
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 23 Sep 2009 20:21:40 -0700
- Subject: PATCH: Remove BFD_RELOC_386_GOT32 in TC_FORCE_RELOCATION_LOCAL
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
There is no need to check BFD_RELOC_386_GOT32 in TC_FORCE_RELOCATION_LOCAL
since GOT32 isn't pcrel.
H.J.
---
gas/
2009-09-23 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Don't check
BFD_RELOC_386_GOT32.
gas/testsuite/
2009-09-23 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/i386.exp: Run localpic.
* gas/i386/localpic.d: New.
* gas/i386/localpic.s: Likewise.
Index: gas/testsuite/gas/i386/i386.exp
===================================================================
--- gas/testsuite/gas/i386/i386.exp (revision 6917)
+++ gas/testsuite/gas/i386/i386.exp (working copy)
@@ -192,6 +192,7 @@ if [expr ([istarget "i*86-*-*"] || [ist
run_list_test "inval-equ-2" "-al"
run_dump_test "ifunc"
run_list_test "l1om-inval" "-march=l1om --32"
+ run_dump_test "localpic"
}
# This is a PE specific test.
Index: gas/testsuite/gas/i386/localpic.d
===================================================================
--- gas/testsuite/gas/i386/localpic.d (revision 0)
+++ gas/testsuite/gas/i386/localpic.d (revision 0)
@@ -0,0 +1,6 @@
+#readelf: -r
+#name: i386 local PIC
+
+Relocation section '.rel.text' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym.Value Sym. Name
+[0-9a-f]+ +[0-9a-f]+ R_386_GOT32 +[0-9a-f]+ +foo
Index: gas/testsuite/gas/i386/localpic.s
===================================================================
--- gas/testsuite/gas/i386/localpic.s (revision 0)
+++ gas/testsuite/gas/i386/localpic.s (revision 0)
@@ -0,0 +1,5 @@
+ .data
+foo:
+ .long 0
+ .text
+movl foo@GOT(%ecx), %eax
Index: gas/config/tc-i386.h
===================================================================
--- gas/config/tc-i386.h (revision 6917)
+++ gas/config/tc-i386.h (working copy)
@@ -149,14 +149,12 @@ extern int tc_i386_fix_adjustable (struc
/* This expression evaluates to true if the relocation is for a local
object for which we still want to do the relocation at runtime.
False if we are willing to perform this relocation while building
- the .o file. GOTOFF does not need to be checked here because it is
- not pcrel. I am not sure if some of the others are ever used with
- pcrel, but it is easier to be safe than sorry. */
+ the .o file. GOTOFF and GOT32 do not need to be checked here because
+ they are not pcrel. .*/
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
(!(FIX)->fx_pcrel \
|| (FIX)->fx_r_type == BFD_RELOC_386_PLT32 \
- || (FIX)->fx_r_type == BFD_RELOC_386_GOT32 \
|| (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \
|| TC_FORCE_RELOCATION (FIX))