diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2006-03-22 09:28:15 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2006-03-22 09:28:15 +0000 |
commit | 0a44bf6950b3b1a1a79e46c36be2487c2499fd58 (patch) | |
tree | fd77387be93bd59c5df8d12c0fca9da2b0c7a124 /gas | |
parent | 11010f5a82bae6b40067c04c33184c70c0c99e10 (diff) | |
download | gdb-0a44bf6950b3b1a1a79e46c36be2487c2499fd58.zip gdb-0a44bf6950b3b1a1a79e46c36be2487c2499fd58.tar.gz gdb-0a44bf6950b3b1a1a79e46c36be2487c2499fd58.tar.bz2 |
Richard Sandiford <richard@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Phil Edwards <phil@codesourcery.com>
Zack Weinberg <zack@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
bfd/
* bfd-in2.h: Regenerate.
* config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas.
* configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza.
(bfd_elf32_littlemips_vxworks_vec): Likewise.
(bfd_elf32_bigmips_vec): Add elf-vxworks.lo.
(bfd_elf32_littlemips_vec): Likewise.
(bfd_elf32_nbigmips_vec): Likewise.
(bfd_elf32_nlittlemips_vec): Likewise.
(bfd_elf32_ntradbigmips_vec): Likewise.
(bfd_elf32_ntradlittlemips_vec): Likewise.
(bfd_elf32_tradbigmips_vec): Likewise.
(bfd_elf32_tradlittlemips_vec): Likewise.
(bfd_elf64_bigmips_vec): Likewise.
(bfd_elf64_littlemips_vec): Likewise.
(bfd_elf64_tradbigmips_vec): Likewise.
(bfd_elf64_tradlittlemips_vec): Likewise.
* elf32-mips.c: Include elf-vxworks.h.
(mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto
instead of calling mips_elf32_rtype_to_howto directly.
(mips_vxworks_copy_howto_rela): New reloc howto.
(mips_vxworks_jump_slot_howto_rela): Likewise.
(mips_vxworks_bfd_reloc_type_lookup): New function.
(mips_vxworks_rtype_to_howto): Likewise.
(mips_vxworks_final_write_processing): Likewise.
(TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks.
(TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise.
(elf_backend_want_got_plt): Likewise.
(elf_backend_want_plt_sym): Likewise.
(elf_backend_got_symbol_offset): Likewise.
(elf_backend_want_dynbss): Likewise.
(elf_backend_may_use_rel_p): Likewise.
(elf_backend_may_use_rela_p): Likewise.
(elf_backend_default_use_rela_p): Likewise.
(elf_backend_got_header_size: Likewise.
(elf_backend_plt_readonly): Likewise.
(bfd_elf32_bfd_reloc_type_lookup): Likewise.
(elf_backend_mips_rtype_to_howto): Likewise.
(elf_backend_adjust_dynamic_symbol): Likewise.
(elf_backend_finish_dynamic_symbol): Likewise.
(bfd_elf32_bfd_link_hash_table_create): Likewise.
(elf_backend_add_symbol_hook): Likewise.
(elf_backend_link_output_symbol_hook): Likewise.
(elf_backend_emit_relocs): Likewise.
(elf_backend_final_write_processing: Likewise.
(elf_backend_additional_program_headers): Likewise.
(elf_backend_modify_segment_map): Likewise.
(elf_backend_symbol_processing): Likewise.
* elfxx-mips.c: Include elf-vxworks.h.
(mips_elf_link_hash_entry): Add is_relocation_target and
is_branch_target fields.
(mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt,
srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields.
(MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros.
(MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument.
Return 3 for VxWorks.
(ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a
mips_elf_link_hash_table. Return 0 for VxWorks.
(MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a
mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET.
(mips_vxworks_exec_plt0_entry): New variable.
(mips_vxworks_exec_plt_entry): Likewise.
(mips_vxworks_shared_plt0_entry): Likewise.
(mips_vxworks_shared_plt_entry): Likewise.
(mips_elf_link_hash_newfunc): Initialize the new hash_entry fields.
(mips_elf_rel_dyn_section): Change the bfd argument to a
mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get
the name of the section.
(mips_elf_initialize_tls_slots): Update the call to
mips_elf_rel_dyn_section.
(mips_elf_gotplt_index): New function.
(mips_elf_local_got_index): Add an input_section argument.
Update the call to mips_elf_create_local_got_entry.
(mips_elf_got_page): Likewise.
(mips_elf_got16_entry): Likewise.
(mips_elf_create_local_got_entry): Add bfd_link_info and input_section
arguments. Create dynamic relocations for each entry on VxWorks.
(mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE.
(mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE
and MIPS_RESERVED_GOTNO.
(mips_elf_create_got_section): Update the uses of
MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks.
(is_gott_symbol): New function.
(mips_elf_calculate_relocation): Use a dynobj local variable.
Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and
mips_elf_got_page_entry. Set G to the .got.plt entry when calculating
VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT
relocations on VxWorks. Add dynamic relocations for references
to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't
create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64
in VxWorks executables.
(mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument.
Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry.
Don't allocate a null entry on VxWorks.
(mips_elf_create_dynamic_relocation): Update the call to
mips_elf_rel_dyn_section. Use absolute rather than relative
relocations for VxWorks, and make them RELA rather than REL.
(_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic
read-only on VxWorks. Update the call to mips_elf_rel_dyn_section.
Create the .plt, .rela.plt, .dynbss and .rela.bss sections on
VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol.
Call elf_vxworks_create_dynamic_sections for VxWorks and
initialize the plt_header_size and plt_entry_size fields.
(_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be
used in VxWorks executables. Don't allocate dynamic relocations
for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables.
Set is_relocation_target for each symbol referenced by a relocation.
Allocate .rela.dyn entries for relocations against the special
VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT
entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate
a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*,
R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls
to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations.
Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26
relocations. Don't set no_fn_stub on VxWorks.
(_bfd_mips_elf_adjust_dynamic_symbol): Update the call to
mips_elf_allocate_dynamic_relocations.
(_bfd_mips_vxworks_adjust_dynamic_symbol): New function.
(_bfd_mips_elf_always_size_sections): Do not allocate GOT page
entries for VxWorks, and do not create multiple GOTs.
(_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME.
Handle .got specially for VxWorks. Update the uses of
MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations.
Check for sgotplt and splt. Allocate the .rel(a).dyn contents last,
once its final size is known. Set DF_TEXTREL for VxWorks. Add
DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL
tags on VxWorks. Do not add the MIPS-specific tags for VxWorks.
(_bfd_mips_vxworks_finish_dynamic_symbol): New function.
(mips_vxworks_finish_exec_plt): Likewise.
(mips_vxworks_finish_shared_plt): Likewise.
(_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call
to mips_elf_rel_dyn_section. Use a VxWorks-specific value of
DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL,
DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO
and mips_elf_rel_dyn_section. Use a different GOT header for
VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks.
(_bfd_mips_elf_link_hash_table_create): Initialize the new
mips_elf_link_hash_table fields.
(_bfd_mips_vxworks_link_hash_table_create): New function.
(_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_
on VxWorks. Update the call to ELF_MIPS_GP_OFFSET.
* elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare.
(_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
(_bfd_mips_vxworks_link_hash_table_create): Likewise.
* libbfd.h: Regenerate.
* Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h.
(elf32-mips.lo): Likewise.
* Makefile.in: Regenerate.
* reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare.
* targets.c (bfd_elf32_bigmips_vxworks_vec): Declare.
(bfd_elf32_littlemips_vxworks_vec): Likewise.
(_bfd_target_vector): Add entries for them.
gas/
* config/tc-mips.c (mips_target_format): Handle vxworks targets.
(md_begin): Complain about -G being used for PIC. Don't change
the text, data and bss alignments on VxWorks.
(reloc_needs_lo_p): Don't return true for R_MIPS_GOT16 when
generating VxWorks PIC.
(load_address): Extend SVR4_PIC handling to VXWORKS_PIC.
(macro): Likewise, but do not treat la $25 specially for
VxWorks PIC, and do not handle jal.
(OPTION_MVXWORKS_PIC): New macro.
(md_longopts): Add -mvxworks-pic.
(md_parse_option): Don't complain about using PIC and -G together here.
Handle OPTION_MVXWORKS_PIC.
(md_estimate_size_before_relax): Always use the first relaxation
sequence on VxWorks.
* config/tc-mips.h (VXWORKS_PIC): New.
gas/testsuite/
* gas/mips/vxworks1.s, gas/mips/vxworks1.d,
* gas/mips/vxworks1-xgot.d: New tests.
* gas/mips/mips.exp: Run them. Do not run other tests on VxWorks.
include/elf/
* mips.h (R_MIPS_COPY, R_MIPS_JUMP_SLOT): New relocs.
ld/
* configure.tgt (mips*el-*-vxworks*, mips*-*-vxworks*): Use
separate VxWorks emulations.
* emulparams/elf32ebmipvxworks.sh: New file.
* emulparams/elf32elmipvxworks.sh: New file.
* Makefile.am (ALL_EMULATIONS): Add eelf32ebmipvxworks.o and
eelf32elmipvxworks.o.
(eelf32ebmipvxworks.c, eelf32elmipvxworks.c): New rules.
* Makefile.in: Regenerate.
ld/testsuite/
* ld-mips/vxworks1.dd, ld-mips/vxworks1.ld, ld-mips/vxworks1-lib.dd,
* ld-mips/vxworks1-lib.nd, ld-mips/vxworks1-lib.rd,
* ld-mips/vxworks1-lib.s, ld-mips/vxworks1.rd, ld-mips/vxworks1.s,
* ld-mips/vxworks1-static.d, ld-mips/vxworks2.s, ld-mips/vxworks2.sd,
* ld-mips/vxworks2-static.sd: New tests.
* ld-mips/mips-elf.exp: Run them.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 23 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 92 | ||||
-rw-r--r-- | gas/config/tc-mips.h | 3 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips.exp | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/vxworks1-xgot.d | 102 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/vxworks1.d | 71 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/vxworks1.s | 16 |
8 files changed, 282 insertions, 43 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 10a88e5..4b5091f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,26 @@ +2006-03-22 Richard Sandiford <richard@codesourcery.com> + Daniel Jacobowitz <dan@codesourcery.com> + Phil Edwards <phil@codesourcery.com> + Zack Weinberg <zack@codesourcery.com> + Mark Mitchell <mark@codesourcery.com> + Nathan Sidwell <nathan@codesourcery.com> + + * config/tc-mips.c (mips_target_format): Handle vxworks targets. + (md_begin): Complain about -G being used for PIC. Don't change + the text, data and bss alignments on VxWorks. + (reloc_needs_lo_p): Don't return true for R_MIPS_GOT16 when + generating VxWorks PIC. + (load_address): Extend SVR4_PIC handling to VXWORKS_PIC. + (macro): Likewise, but do not treat la $25 specially for + VxWorks PIC, and do not handle jal. + (OPTION_MVXWORKS_PIC): New macro. + (md_longopts): Add -mvxworks-pic. + (md_parse_option): Don't complain about using PIC and -G together here. + Handle OPTION_MVXWORKS_PIC. + (md_estimate_size_before_relax): Always use the first relaxation + sequence on VxWorks. + * config/tc-mips.h (VXWORKS_PIC): New. + 2006-03-21 Paul Brook <paul@codesourcery.com> * config/tc-arm.c (md_apply_fix): Fix typo in offset mask. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 557fb40..89416c9 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1191,6 +1191,12 @@ mips_target_format (void) case bfd_target_coff_flavour: return "pe-mips"; case bfd_target_elf_flavour: +#ifdef TE_VXWORKS + if (!HAVE_64BIT_OBJECTS && !HAVE_NEWABI) + return (target_big_endian + ? "elf32-bigmips-vxworks" + : "elf32-littlemips-vxworks"); +#endif #ifdef TE_TMIPS /* This is traditional mips. */ return (target_big_endian @@ -1397,6 +1403,13 @@ md_begin (void) int i = 0; int broken = 0; + if (mips_pic != NO_PIC) + { + if (g_switch_seen && g_switch_value != 0) + as_bad (_("-G may not be used in position-independent code")); + g_switch_value = 0; + } + if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_arch)) as_warn (_("Could not set architecture and machine")); @@ -1524,10 +1537,11 @@ md_begin (void) if (OUTPUT_FLAVOR == bfd_target_elf_flavour) { - /* On a native system, sections must be aligned to 16 byte - boundaries. When configured for an embedded ELF target, we - don't bother. */ - if (strcmp (TARGET_OS, "elf") != 0) + /* On a native system other than VxWorks, sections must be aligned + to 16 byte boundaries. When configured for an embedded ELF + target, we don't bother. */ + if (strcmp (TARGET_OS, "elf") != 0 + && strcmp (TARGET_OS, "vxworks") != 0) { (void) bfd_set_section_alignment (stdoutput, text_section, 4); (void) bfd_set_section_alignment (stdoutput, data_section, 4); @@ -1680,16 +1694,18 @@ md_assemble (char *str) } /* Return true if the given relocation might need a matching %lo(). - Note that R_MIPS_GOT16 relocations only need a matching %lo() when - applied to local symbols. */ + This is only "might" because SVR4 R_MIPS_GOT16 relocations only + need a matching %lo() when applied to local symbols. */ static inline bfd_boolean reloc_needs_lo_p (bfd_reloc_code_real_type reloc) { return (HAVE_IN_PLACE_ADDENDS && (reloc == BFD_RELOC_HI16_S - || reloc == BFD_RELOC_MIPS_GOT16 - || reloc == BFD_RELOC_MIPS16_HI16_S)); + || reloc == BFD_RELOC_MIPS16_HI16_S + /* VxWorks R_MIPS_GOT16 relocs never need a matching %lo(); + all GOT16 relocations evaluate to "G". */ + || (reloc == BFD_RELOC_MIPS_GOT16 && mips_pic != VXWORKS_PIC))); } /* Return true if the given fixup is followed by a matching R_MIPS_LO16 @@ -3898,7 +3914,7 @@ load_address (int reg, expressionS *ep, int *used_at) relax_end (); } } - else if (mips_pic == SVR4_PIC && ! mips_big_got) + else if (!mips_big_got) { expressionS ex; @@ -3959,7 +3975,7 @@ load_address (int reg, expressionS *ep, int *used_at) } } } - else if (mips_pic == SVR4_PIC) + else if (mips_big_got) { expressionS ex; @@ -5011,7 +5027,7 @@ macro (struct mips_cl_insn *ip) relax_end (); } } - else if (mips_pic == SVR4_PIC && ! mips_big_got && ! HAVE_NEWABI) + else if (!mips_big_got && !HAVE_NEWABI) { int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16; @@ -5047,7 +5063,9 @@ macro (struct mips_cl_insn *ip) if (offset_expr.X_add_number == 0) { - if (breg == 0 && (call || tempreg == PIC_CALL_REG)) + if (mips_pic == SVR4_PIC + && breg == 0 + && (call || tempreg == PIC_CALL_REG)) lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16; relax_start (offset_expr.X_add_symbol); @@ -5104,7 +5122,7 @@ macro (struct mips_cl_insn *ip) used_at = 1; } } - else if (mips_pic == SVR4_PIC && ! mips_big_got && HAVE_NEWABI) + else if (!mips_big_got && HAVE_NEWABI) { int add_breg_early = 0; @@ -5207,7 +5225,7 @@ macro (struct mips_cl_insn *ip) BFD_RELOC_MIPS_GOT_DISP, mips_gp_register); } } - else if (mips_pic == SVR4_PIC && ! HAVE_NEWABI) + else if (mips_big_got && !HAVE_NEWABI) { int gpdelay; int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16; @@ -5364,7 +5382,7 @@ macro (struct mips_cl_insn *ip) } relax_end (); } - else if (mips_pic == SVR4_PIC && HAVE_NEWABI) + else if (mips_big_got && HAVE_NEWABI) { int lui_reloc_type = (int) BFD_RELOC_MIPS_GOT_HI16; int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT_LO16; @@ -5497,13 +5515,13 @@ macro (struct mips_cl_insn *ip) case M_JAL_2: if (mips_pic == NO_PIC) macro_build (NULL, "jalr", "d,s", dreg, sreg); - else if (mips_pic == SVR4_PIC) + else { if (sreg != PIC_CALL_REG) as_warn (_("MIPS PIC call to register other than $25")); macro_build (NULL, "jalr", "d,s", dreg, sreg); - if (! HAVE_NEWABI) + if (mips_pic == SVR4_PIC && !HAVE_NEWABI) { if (mips_cprestore_offset < 0) as_warn (_("No .cprestore pseudo-op used in PIC code")); @@ -5529,8 +5547,6 @@ macro (struct mips_cl_insn *ip) } } } - else - abort (); break; @@ -5666,6 +5682,8 @@ macro (struct mips_cl_insn *ip) } } } + else if (mips_pic == VXWORKS_PIC) + as_bad (_("Non-PIC jump used in PIC library")); else abort (); @@ -6026,7 +6044,7 @@ macro (struct mips_cl_insn *ip) relax_end (); } } - else if (mips_pic == SVR4_PIC && ! mips_big_got) + else if (!mips_big_got) { int lw_reloc_type = (int) BFD_RELOC_MIPS_GOT16; @@ -6080,7 +6098,7 @@ macro (struct mips_cl_insn *ip) tempreg, tempreg, breg); macro_build (&expr1, s, fmt, treg, BFD_RELOC_LO16, tempreg); } - else if (mips_pic == SVR4_PIC && ! HAVE_NEWABI) + else if (mips_big_got && !HAVE_NEWABI) { int gpdelay; @@ -6129,7 +6147,7 @@ macro (struct mips_cl_insn *ip) tempreg, tempreg, breg); macro_build (&expr1, s, fmt, treg, BFD_RELOC_LO16, tempreg); } - else if (mips_pic == SVR4_PIC && HAVE_NEWABI) + else if (mips_big_got && HAVE_NEWABI) { /* If this is a reference to an external symbol, we want lui $tempreg,<sym> (BFD_RELOC_MIPS_GOT_HI16) @@ -6249,14 +6267,12 @@ macro (struct mips_cl_insn *ip) macro_build_lui (&offset_expr, AT); used_at = 1; } - else if (mips_pic == SVR4_PIC) + else { macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", AT, BFD_RELOC_MIPS_GOT16, mips_gp_register); used_at = 1; } - else - abort (); /* Now we load the register(s). */ if (HAVE_64BIT_GPRS) @@ -6328,7 +6344,7 @@ macro (struct mips_cl_insn *ip) { assert (strcmp (s, RDATA_SECTION_NAME) == 0); used_at = 1; - if (mips_pic == SVR4_PIC) + if (mips_pic != NO_PIC) macro_build (&offset_expr, ADDRESS_LOAD_INSN, "t,o(b)", AT, BFD_RELOC_MIPS_GOT16, mips_gp_register); else @@ -6547,7 +6563,7 @@ macro (struct mips_cl_insn *ip) if (mips_relax.sequence) relax_end (); } - else if (mips_pic == SVR4_PIC && ! mips_big_got) + else if (!mips_big_got) { /* If this is a reference to an external symbol, we want lw $at,<sym>($gp) (BFD_RELOC_MIPS_GOT16) @@ -6594,7 +6610,7 @@ macro (struct mips_cl_insn *ip) mips_optimize = hold_mips_optimize; } - else if (mips_pic == SVR4_PIC) + else if (mips_big_got) { int gpdelay; @@ -10646,6 +10662,8 @@ struct option md_longopts[] = {"mpdr", no_argument, NULL, OPTION_PDR}, #define OPTION_NO_PDR (OPTION_ELF_BASE + 10) {"mno-pdr", no_argument, NULL, OPTION_NO_PDR}, +#define OPTION_MVXWORKS_PIC (OPTION_ELF_BASE + 11) + {"mvxworks-pic", no_argument, NULL, OPTION_MVXWORKS_PIC}, #endif /* OBJ_ELF */ {NULL, no_argument, NULL, 0} @@ -10887,12 +10905,6 @@ md_parse_option (int c, char *arg) } mips_pic = SVR4_PIC; mips_abicalls = TRUE; - if (g_switch_seen && g_switch_value != 0) - { - as_bad (_("-G may not be used with SVR4 PIC code")); - return 0; - } - g_switch_value = 0; break; case OPTION_NON_SHARED: @@ -10916,11 +10928,6 @@ md_parse_option (int c, char *arg) case 'G': g_switch_value = atoi (arg); g_switch_seen = 1; - if (mips_pic == SVR4_PIC && g_switch_value != 0) - { - as_bad (_("-G may not be used with SVR4 PIC code")); - return 0; - } break; #ifdef OBJ_ELF @@ -11026,6 +11033,10 @@ md_parse_option (int c, char *arg) case OPTION_NO_PDR: mips_flag_pdr = FALSE; break; + + case OPTION_MVXWORKS_PIC: + mips_pic = VXWORKS_PIC; + break; #endif /* OBJ_ELF */ default: @@ -13166,6 +13177,9 @@ md_estimate_size_before_relax (fragS *fragp, asection *segtype) change = nopic_need_relax (fragp->fr_symbol, 0); else if (mips_pic == SVR4_PIC) change = pic_need_relax (fragp->fr_symbol, segtype); + else if (mips_pic == VXWORKS_PIC) + /* For vxworks, GOT16 relocations never have a corresponding LO16. */ + change = 0; else abort (); diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h index bc642b0..5665d3d 100644 --- a/gas/config/tc-mips.h +++ b/gas/config/tc-mips.h @@ -75,6 +75,9 @@ enum mips_pic_level /* Generate PIC code as in the SVR4 MIPS ABI. */ SVR4_PIC, + + /* VxWorks's PIC model. */ + VXWORKS_PIC }; extern enum mips_pic_level mips_pic; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index b47b13e..f235c3c 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-03-22 Richard Sandiford <richard@codesourcery.com> + + * gas/mips/vxworks1.s, gas/mips/vxworks1.d, + * gas/mips/vxworks1-xgot.d: New tests. + * gas/mips/mips.exp: Run them. Do not run other tests on VxWorks. + 2006-03-21 Paul Brook <paul@codesourcery.com> * gas/arm/thumb32.d: Correct expected output. diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 2599777..7843f2a 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -383,12 +383,14 @@ mips_arch_create sb1 64 mips64 { mips3d } \ { -march=sb1 -mtune=sb1 } { -mmips:sb1 } \ { mipsisa64sb1-*-* mipsisa64sb1el-*-* } - # -# And now begin the actual tests! +# And now begin the actual tests! VxWorks uses RELA rather than REL +# relocations, so most of the generic dump tests will not work there. # - -if { [istarget mips*-*-*] } then { +if { [istarget mips*-*-vxworks*] } { + run_dump_test "vxworks1" + run_dump_test "vxworks1-xgot" +} elseif { [istarget mips*-*-*] } { set no_mips16 0 set elf [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] || [istarget *-*-netbsd*] ] set ecoff [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ] @@ -777,4 +779,6 @@ if { [istarget mips*-*-*] } then { run_dump_test "mips16e-jrc" run_dump_test "mips16e-save" } + run_dump_test "vxworks1" + run_dump_test "vxworks1-xgot" } diff --git a/gas/testsuite/gas/mips/vxworks1-xgot.d b/gas/testsuite/gas/mips/vxworks1-xgot.d new file mode 100644 index 0000000..5737a57 --- /dev/null +++ b/gas/testsuite/gas/mips/vxworks1-xgot.d @@ -0,0 +1,102 @@ +#as: -mips2 -mvxworks-pic -xgot -mabi=32 +#source: vxworks1.s +#objdump: -dr + +.*: file format .* + +Disassembly of section \.text: + +00000000 <\.text>: +# +# la $4,local +# +.*: 3c040000 lui a0,0x0 + .*: R_MIPS_GOT_HI16 \.data +.*: 009c2021 addu a0,a0,gp +.*: 8c840000 lw a0,0\(a0\) + .*: R_MIPS_GOT_LO16 \.data +# +# la $4,global +# +.*: 3c040000 lui a0,0x0 + .*: R_MIPS_GOT_HI16 global +.*: 009c2021 addu a0,a0,gp +.*: 8c840000 lw a0,0\(a0\) + .*: R_MIPS_GOT_LO16 global +# +# lw $4,local +# +.*: 3c040000 lui a0,0x0 + .*: R_MIPS_GOT_HI16 \.data +.*: 009c2021 addu a0,a0,gp +.*: 8c840000 lw a0,0\(a0\) + .*: R_MIPS_GOT_LO16 \.data +.*: 8c840000 lw a0,0\(a0\) +# +# lw $4,global +# +.*: 3c040000 lui a0,0x0 + .*: R_MIPS_GOT_HI16 global +.*: 009c2021 addu a0,a0,gp +.*: 8c840000 lw a0,0\(a0\) + .*: R_MIPS_GOT_LO16 global +.*: 8c840000 lw a0,0\(a0\) +# +# sw $4,local +# +.*: 3c010000 lui at,0x0 + .*: R_MIPS_GOT_HI16 \.data +.*: 003c0821 addu at,at,gp +.*: 8c210000 lw at,0\(at\) + .*: R_MIPS_GOT_LO16 \.data +.*: ac240000 sw a0,0\(at\) +# +# sw $4,global +# +.*: 3c010000 lui at,0x0 + .*: R_MIPS_GOT_HI16 global +.*: 003c0821 addu at,at,gp +.*: 8c210000 lw at,0\(at\) + .*: R_MIPS_GOT_LO16 global +.*: ac240000 sw a0,0\(at\) +# +# ulw $4,local +# +.*: 3c010000 lui at,0x0 + .*: R_MIPS_GOT_HI16 \.data +.*: 003c0821 addu at,at,gp +.*: 8c210000 lw at,0\(at\) + .*: R_MIPS_GOT_LO16 \.data +.*: 88240000 lwl a0,0\(at\) +.*: 98240003 lwr a0,3\(at\) +# +# ulw $4,global +# +.*: 3c010000 lui at,0x0 + .*: R_MIPS_GOT_HI16 global +.*: 003c0821 addu at,at,gp +.*: 8c210000 lw at,0\(at\) + .*: R_MIPS_GOT_LO16 global +.*: 88240000 lwl a0,0\(at\) +.*: 98240003 lwr a0,3\(at\) +# +# usw $4,local +# +.*: 3c010000 lui at,0x0 + .*: R_MIPS_GOT_HI16 \.data +.*: 003c0821 addu at,at,gp +.*: 8c210000 lw at,0\(at\) + .*: R_MIPS_GOT_LO16 \.data +.*: a8240000 swl a0,0\(at\) +.*: b8240003 swr a0,3\(at\) +# +# usw $4,global +# +.*: 3c010000 lui at,0x0 + .*: R_MIPS_GOT_HI16 global +.*: 003c0821 addu at,at,gp +.*: 8c210000 lw at,0\(at\) + .*: R_MIPS_GOT_LO16 global +.*: a8240000 swl a0,0\(at\) +.*: b8240003 swr a0,3\(at\) + \.\.\. diff --git a/gas/testsuite/gas/mips/vxworks1.d b/gas/testsuite/gas/mips/vxworks1.d new file mode 100644 index 0000000..2ca762e --- /dev/null +++ b/gas/testsuite/gas/mips/vxworks1.d @@ -0,0 +1,71 @@ +#as: -mips2 -mvxworks-pic -mabi=32 +#objdump: -dr + +.*: file format .* + +Disassembly of section \.text: + +00000000 <\.text>: +# +# la $4,local +# +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT16 \.data +# +# la $4,global +# +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT16 global +# +# lw $4,local +# +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT16 \.data +.*: 8c840000 lw a0,0\(a0\) +# +# lw $4,global +# +.*: 8f840000 lw a0,0\(gp\) + .*: R_MIPS_GOT16 global +.*: 8c840000 lw a0,0\(a0\) +# +# sw $4,local +# +.*: 8f810000 lw at,0\(gp\) + .*: R_MIPS_GOT16 \.data +.*: ac240000 sw a0,0\(at\) +# +# sw $4,global +# +.*: 8f810000 lw at,0\(gp\) + .*: R_MIPS_GOT16 global +.*: ac240000 sw a0,0\(at\) +# +# ulw $4,local +# +.*: 8f810000 lw at,0\(gp\) + .*: R_MIPS_GOT16 \.data +.*: 88240000 lwl a0,0\(at\) +.*: 98240003 lwr a0,3\(at\) +# +# ulw $4,global +# +.*: 8f810000 lw at,0\(gp\) + .*: R_MIPS_GOT16 global +.*: 88240000 lwl a0,0\(at\) +.*: 98240003 lwr a0,3\(at\) +# +# usw $4,local +# +.*: 8f810000 lw at,0\(gp\) + .*: R_MIPS_GOT16 \.data +.*: a8240000 swl a0,0\(at\) +.*: b8240003 swr a0,3\(at\) +# +# usw $4,global +# +.*: 8f810000 lw at,0\(gp\) + .*: R_MIPS_GOT16 global +.*: a8240000 swl a0,0\(at\) +.*: b8240003 swr a0,3\(at\) + \.\.\. diff --git a/gas/testsuite/gas/mips/vxworks1.s b/gas/testsuite/gas/mips/vxworks1.s new file mode 100644 index 0000000..4d670a3 --- /dev/null +++ b/gas/testsuite/gas/mips/vxworks1.s @@ -0,0 +1,16 @@ + la $4,local + la $4,global + lw $4,local + lw $4,global + sw $4,local + sw $4,global + ulw $4,local + ulw $4,global + usw $4,local + usw $4,global + .space 16 + + .data + .global global +local: .word 4 +global: .word 8 |