Index: arm.cc =================================================================== RCS file: /cvs/src/src/gold/arm.cc,v retrieving revision 1.59 diff -u -r1.59 arm.cc --- arm.cc 20 Jan 2010 17:29:52 -0000 1.59 +++ arm.cc 20 Jan 2010 18:46:26 -0000 @@ -1548,7 +1548,7 @@ stub_factory_(Stub_factory::get_instance()), may_use_blx_(false), should_force_pic_veneer_(false), arm_input_section_map_(), attributes_section_data_(NULL), fix_cortex_a8_(false), - cortex_a8_relocs_info_(), fix_v4bx_(0) + cortex_a8_relocs_info_() { } // Whether we can use BLX. @@ -1787,7 +1787,7 @@ // 2 - make interworking veneer (>= armv4t targets only) int fix_v4bx() const - { return this->fix_v4bx_; } + { return parameters->options().fix_v4bx(); } // Scan a span of THUMB code section for Cortex-A8 erratum. void @@ -2151,8 +2151,6 @@ bool fix_cortex_a8_; // Map addresses to relocs for Cortex-A8 erratum. Cortex_a8_relocs_info cortex_a8_relocs_info_; - // Whether we need to fix code for V4BX relocations. - int fix_v4bx_; }; template Index: options.h =================================================================== RCS file: /cvs/src/src/gold/options.h,v retrieving revision 1.138 diff -u -r1.138 options.h --- options.h 15 Jan 2010 04:58:34 -0000 1.138 +++ options.h 20 Jan 2010 18:46:26 -0000 @@ -726,6 +726,15 @@ N_("(ARM only) Fix binaries for Cortex-A8 erratum."), N_("(ARM only) Do not fix binaries for Cortex-A8 erratum.")); + DEFINE_special(fix_v4bx, options::TWO_DASHES, '\0', + N_("(ARM only) Rewrite BX rn as MOV pc, rn for ARMv4"), + NULL); + + DEFINE_special(fix_v4bx_interworking, options::TWO_DASHES, '\0', + N_("(ARM only) Rewrite BX rn branch to ARMv4 interworking " + "veneer"), + NULL); + DEFINE_bool(g, options::EXACTLY_ONE_DASH, '\0', false, N_("Ignored"), NULL); @@ -1218,6 +1227,20 @@ bool section_start(const char* secname, uint64_t* paddr) const; + enum Fix_v4bx + { + // Leave original instruction. + FIX_V4BX_NONE, + // Replace instruction. + FIX_V4BX_REPLACE, + // Generate an interworking veneer. + FIX_V4BX_INTERWORKING + }; + + Fix_v4bx + fix_v4bx() const + { return (this->fix_v4bx_); } + private: // Don't copy this structure. General_options(const General_options&); @@ -1307,6 +1330,8 @@ Unordered_set symbols_to_retain_; // Map from section name to address from --section-start. std::map section_starts_; + // Whether to process armv4 bx instruction relocation. + Fix_v4bx fix_v4bx_; }; // The position-dependent options. We use this to store the state of Index: options.cc =================================================================== RCS file: /cvs/src/src/gold/options.cc,v retrieving revision 1.98 diff -u -r1.98 options.cc --- options.cc 6 Jan 2010 22:37:18 -0000 1.98 +++ options.cc 20 Jan 2010 18:46:26 -0000 @@ -586,6 +586,20 @@ } } +void +General_options::parse_fix_v4bx(const char*, const char*, + Command_line*) +{ + this->fix_v4bx_ = FIX_V4BX_REPLACE; +} + +void +General_options::parse_fix_v4bx_interworking(const char*, const char*, + Command_line*) +{ + this->fix_v4bx_ = FIX_V4BX_INTERWORKING; +} + } // End namespace gold. namespace