diff options
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/config/tc-sparc.c | 40 | ||||
-rw-r--r-- | gas/configure.tgt | 2 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/sparc.exp | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/vxworks-pic.d | 27 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/vxworks-pic.s | 11 |
7 files changed, 89 insertions, 12 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index fadd3e0..3f759e0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2006-04-05 Richard Sandiford <richard@codesourcery.com> + Daniel Jacobowitz <dan@codesourcery.com> + + * config/tc-sparc.c (sparc_target_format): Handle TE_VXWORKS. + (GOTT_BASE, GOTT_INDEX): New. + (tc_gen_reloc): Don't alter relocations against GOTT_BASE and + GOTT_INDEX when generating VxWorks PIC. + * configure.tgt (sparc*-*-vxworks*): Remove this special case; + use the generic *-*-vxworks* stanza instead. + 2006-04-04 Alan Modra <amodra@bigpond.net.au> PR 997 diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 04bfb53..10a1411 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -334,6 +334,10 @@ sparc_target_format () #endif #endif +#ifdef TE_VXWORKS + return "elf32-sparc-vxworks"; +#endif + #ifdef OBJ_ELF return sparc_arch_size == 64 ? "elf64-sparc" : "elf32-sparc"; #endif @@ -3528,6 +3532,10 @@ tc_gen_reloc (section, fixp) #else #define GOT_NAME "__GLOBAL_OFFSET_TABLE_" #endif +#ifdef TE_VXWORKS +#define GOTT_BASE "__GOTT_BASE__" +#define GOTT_INDEX "__GOTT_INDEX__" +#endif /* This code must be parallel to the OBJ_ELF tc_fix_adjustable. */ @@ -3540,18 +3548,30 @@ tc_gen_reloc (section, fixp) code = BFD_RELOC_SPARC_WPLT30; break; case BFD_RELOC_HI22: - if (fixp->fx_addsy != NULL - && strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) - code = BFD_RELOC_SPARC_PC22; - else - code = BFD_RELOC_SPARC_GOT22; + code = BFD_RELOC_SPARC_GOT22; + if (fixp->fx_addsy != NULL) + { + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) + code = BFD_RELOC_SPARC_PC22; +#ifdef TE_VXWORKS + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_BASE) == 0 + || strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_INDEX) == 0) + code = BFD_RELOC_HI22; /* Unchanged. */ +#endif + } break; case BFD_RELOC_LO10: - if (fixp->fx_addsy != NULL - && strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) - code = BFD_RELOC_SPARC_PC10; - else - code = BFD_RELOC_SPARC_GOT10; + code = BFD_RELOC_SPARC_GOT10; + if (fixp->fx_addsy != NULL) + { + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) + code = BFD_RELOC_SPARC_PC10; +#ifdef TE_VXWORKS + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_BASE) == 0 + || strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_INDEX) == 0) + code = BFD_RELOC_LO10; /* Unchanged. */ +#endif + } break; case BFD_RELOC_SPARC13: code = BFD_RELOC_SPARC_GOT13; diff --git a/gas/configure.tgt b/gas/configure.tgt index 6463631..696daaa 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -335,7 +335,7 @@ case ${generic_target} in sparc-*-rtems*) fmt=elf ;; sparc-*-sunos4*) fmt=aout em=sun3 ;; - sparc-*-aout | sparc*-*-vxworks*) fmt=aout em=sparcaout ;; + sparc-*-aout) fmt=aout em=sparcaout ;; sparc-*-coff) fmt=coff ;; sparc-*-linux*aout*) fmt=aout em=linux ;; sparc-*-linux-*) fmt=elf em=linux ;; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index c4b0217..28bbea8 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-04-05 Richard Sandiford <richard@codesourcery.com> + + * gas/sparc/vxworks-pic.s, gas/sparc/vxworks-pic.d: New test. + * gas/sparc/sparc.exp: Run it. Remove sparc*-*-vxworks* XFAILs. + 2006-03-23 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/rep.s: Pad with .p2align. diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp index 4189ddb..a2e362d 100644 --- a/gas/testsuite/gas/sparc/sparc.exp +++ b/gas/testsuite/gas/sparc/sparc.exp @@ -17,7 +17,7 @@ proc gas_64_check { } { } proc sparc_elf_setup { } { - setup_xfail "sparc*-*-*aout*" "sparc*-*-sunos4*" "sparc*-*-vxworks*" + setup_xfail "sparc*-*-*aout*" "sparc*-*-sunos4*" setup_xfail "sparc*-fujitsu-none" "sparc*-*-*n*bsd*" setup_xfail "sparc*-*-coff" "sparc*-*-lynxos*" clear_xfail "sparc64*-*-*n*bsd*" @@ -50,6 +50,10 @@ if [istarget sparc*-*-*] { } } +if [istarget sparc-*-vxworks*] { + run_dump_test "vxworks-pic" +} + if [istarget sparclet*-*-*] { run_dump_test "splet" run_dump_test "splet-2" diff --git a/gas/testsuite/gas/sparc/vxworks-pic.d b/gas/testsuite/gas/sparc/vxworks-pic.d new file mode 100644 index 0000000..7e238fb --- /dev/null +++ b/gas/testsuite/gas/sparc/vxworks-pic.d @@ -0,0 +1,27 @@ +#as: -KPIC +#objdump: -dr +#name: VxWorks PIC + +.*: file format .* + +Disassembly of section \.text: + +00000000 <\.text>: + 0: 2f 00 00 00 sethi %hi\(0\), %l7 + 0: R_SPARC_HI22 __GOTT_BASE__ + 4: ee 05 e0 00 ld \[ %l7 \], %l7 + 4: R_SPARC_LO10 __GOTT_BASE__ + 8: ee 05 e0 00 ld \[ %l7 \], %l7 + 8: R_SPARC_LO10 __GOTT_INDEX__ + c: 03 00 00 00 sethi %hi\(0\), %g1 + c: R_SPARC_HI22 __GOTT_BASE__ + 10: 82 10 60 00 mov %g1, %g1 ! 0x0 + 10: R_SPARC_LO10 __GOTT_BASE__ + 14: 03 00 00 00 sethi %hi\(0\), %g1 + 14: R_SPARC_HI22 __GOTT_INDEX__ + 18: 82 10 60 00 mov %g1, %g1 ! 0x0 + 18: R_SPARC_LO10 __GOTT_INDEX__ + 1c: 03 00 00 00 sethi %hi\(0\), %g1 + 1c: R_SPARC_GOT22 __GOT_BASE__ + 20: 82 10 60 00 mov %g1, %g1 ! 0x0 + 20: R_SPARC_GOT10 __GOT_BASE__ diff --git a/gas/testsuite/gas/sparc/vxworks-pic.s b/gas/testsuite/gas/sparc/vxworks-pic.s new file mode 100644 index 0000000..9d49e00 --- /dev/null +++ b/gas/testsuite/gas/sparc/vxworks-pic.s @@ -0,0 +1,11 @@ + sethi %hi(__GOTT_BASE__), %l7 + ld [%l7+%lo(__GOTT_BASE__)],%l7 + ld [%l7+%lo(__GOTT_INDEX__)],%l7 + + sethi %hi(__GOTT_BASE__), %g1 + or %g1, %lo(__GOTT_BASE__), %g1 + sethi %hi(__GOTT_INDEX__), %g1 + or %g1, %lo(__GOTT_INDEX__), %g1 + + sethi %hi(__GOT_BASE__), %g1 + or %g1, %lo(__GOT_BASE__), %g1 |