public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gold] Mips: Remove redundant checks for relocatable link
@ 2017-03-10 16:58 Vladimir Radosavljevic
  2017-03-15 23:54 ` Cary Coutant
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Radosavljevic @ 2017-03-10 16:58 UTC (permalink / raw)
  To: binutils; +Cc: ccoutant, Petar Jovanovic

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

Target_mips::Relocate::relocate won't be called for relocatable link.

Regards,
Vladimir

ChangeLog -

	* mips.cc (Target_mips::Relocate::relocate): Remove redundant
	checks for relocatable link.
	(Mips_relocate_functions::reljalr): Likewise.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: remove_relocatable_checks.patch --]
[-- Type: text/x-patch; name="remove_relocatable_checks.patch", Size: 2908 bytes --]

diff --git a/gold/mips.cc b/gold/mips.cc
index 95bf6db..466b095 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -4500,8 +4500,7 @@ class Mips_relocate_functions : public Relocate_functions<size, big_endian>
     Valtype32 val = elfcpp::Swap<32, big_endian>::readval(wv);
 
     // Try converting J(AL)R to B(AL), if the target is in range.
-    if (!parameters->options().relocatable()
-        && r_type == elfcpp::R_MIPS_JALR
+    if (r_type == elfcpp::R_MIPS_JALR
         && !cross_mode_jump
         && ((jalr_to_bal && val == 0x0320f809)    // jalr t9
             || (jr_to_b && val == 0x03200008)))   // jr t9
@@ -11527,7 +11526,6 @@ Target_mips<size, big_endian>::Relocate::relocate(
   //
   // (c) the section allows direct references to MIPS16 functions.
   if (r_type != elfcpp::R_MIPS16_26
-      && !parameters->options().relocatable()
       && ((mips_sym != NULL
            && mips_sym->has_mips16_fn_stub()
            && (r_type != elfcpp::R_MIPS16_CALL16 || mips_sym->need_fn_stub()))
@@ -11563,7 +11561,7 @@ Target_mips<size, big_endian>::Relocate::relocate(
   // to a standard MIPS function, we need to redirect the call to the stub.
   // Note that we specifically exclude R_MIPS16_CALL16 from this behavior;
   // indirect calls should use an indirect stub instead.
-  else if (r_type == elfcpp::R_MIPS16_26 && !parameters->options().relocatable()
+  else if (r_type == elfcpp::R_MIPS16_26
            && ((mips_sym != NULL
                 && (mips_sym->has_mips16_call_stub()
                     || mips_sym->has_mips16_call_fp_stub()))
@@ -11625,7 +11623,6 @@ Target_mips<size, big_endian>::Relocate::relocate(
   // entry is used if a standard PLT entry has also been made.
   else if ((r_type == elfcpp::R_MIPS16_26
             || r_type == elfcpp::R_MICROMIPS_26_S1)
-          && !parameters->options().relocatable()
           && mips_sym != NULL
           && mips_sym->has_plt_offset()
           && mips_sym->has_comp_plt_offset()
@@ -11654,8 +11651,7 @@ Target_mips<size, big_endian>::Relocate::relocate(
   // symbol would be 16-bit code, and that direct jumps were therefore
   // acceptable.
   cross_mode_jump =
-    (!parameters->options().relocatable()
-     && !(gsym != NULL && gsym->is_weak_undefined())
+    (!(gsym != NULL && gsym->is_weak_undefined())
      && ((r_type == elfcpp::R_MIPS16_26 && !target_is_16_bit_code)
          || (r_type == elfcpp::R_MICROMIPS_26_S1 && !target_is_micromips_code)
          || ((r_type == elfcpp::R_MIPS_26 || r_type == elfcpp::R_MIPS_JALR)
@@ -12209,8 +12205,7 @@ Target_mips<size, big_endian>::Relocate::relocate(
       r_addend = calculated_value;
     }
 
-  bool jal_shuffle = jal_reloc(r_type) ? !parameters->options().relocatable()
-                                       : false;
+  bool jal_shuffle = jal_reloc(r_type);
   Reloc_funcs::mips_reloc_shuffle(view, r_type, jal_shuffle);
 
   // Report any errors.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][gold] Mips: Remove redundant checks for relocatable link
  2017-03-10 16:58 [PATCH][gold] Mips: Remove redundant checks for relocatable link Vladimir Radosavljevic
@ 2017-03-15 23:54 ` Cary Coutant
  0 siblings, 0 replies; 2+ messages in thread
From: Cary Coutant @ 2017-03-15 23:54 UTC (permalink / raw)
  To: Vladimir Radosavljevic; +Cc: binutils, Petar Jovanovic

>         * mips.cc (Target_mips::Relocate::relocate): Remove redundant
>         checks for relocatable link.
>         (Mips_relocate_functions::reljalr): Likewise.

Committed on your behalf.

Thanks!

-cary

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-15 23:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 16:58 [PATCH][gold] Mips: Remove redundant checks for relocatable link Vladimir Radosavljevic
2017-03-15 23:54 ` Cary Coutant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).