From 94369ae716bee9fe49962a645f41a55b7695f2d0 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 24 Sep 2009 14:36:48 +0000 Subject: [PATCH] gas/ 2009-09-24 H.J. Lu 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 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. --- gas/ChangeLog | 6 ++++++ gas/config/tc-i386.h | 1 + gas/testsuite/ChangeLog | 8 ++++++++ gas/testsuite/gas/i386/i386.exp | 12 ++++-------- gas/testsuite/gas/i386/x86-64-localpic.d | 9 +++++++++ gas/testsuite/gas/i386/x86-64-localpic.s | 4 ++++ 6 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 gas/testsuite/gas/i386/x86-64-localpic.d create mode 100644 gas/testsuite/gas/i386/x86-64-localpic.s diff --git a/gas/ChangeLog b/gas/ChangeLog index b0f8b85a4a..53f8a4391a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2009-09-24 H.J. Lu + + PR gas/10677 + * config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Return true + for BFD_RELOC_X86_64_GOTPCREL. + 2009-09-23 H.J. Lu * config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Don't check diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index ab7cbf2a26..e355f7f0c9 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -156,6 +156,7 @@ extern int tc_i386_fix_adjustable (struct fix *); (!(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 *); diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index fdb5c5082d..69f1b5b14b 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2009-09-24 H.J. Lu + + 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. + 2009-09-23 H.J. Lu * gas/i386/localpic.d: Updated. diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 2196575e4f..9d5e9570df 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -338,21 +338,17 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t 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" diff --git a/gas/testsuite/gas/i386/x86-64-localpic.d b/gas/testsuite/gas/i386/x86-64-localpic.d new file mode 100644 index 0000000000..f400adb7b1 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-localpic.d @@ -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 diff --git a/gas/testsuite/gas/i386/x86-64-localpic.s b/gas/testsuite/gas/i386/x86-64-localpic.s new file mode 100644 index 0000000000..c73a7c563b --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-localpic.s @@ -0,0 +1,4 @@ + .text +foo: + .quad 0 + movq foo@GOTPCREL(%rip), %rax -- 2.11.0