bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Temporary fix for Sparc fixups against local symbols in SEC_MERGE sectio


From: Nick Clifton
Subject: Temporary fix for Sparc fixups against local symbols in SEC_MERGE sections
Date: 14 Nov 2001 14:05:48 +0000

Hi Guys,

  I am checking in the patch below as a temporary fix for the
  following problem.  Although fixups against local symbols in
  SEC_MERGE sections should be treated as if they were fixups against
  external symbols, the code in write.c:fixup_segment() treats them
  differently.  In particular it will not add in the value of the
  local symbol to the "add_number" variable before calling
  md_apply_fix3() in the same way that it would for fixups against
  external symbols.

  This causes trouble for the Sparc port (and probably others too,
  maybe Alpha ?) since the code in md_apply_fix3() attempts to reverse
  this addition, even if the fixup is against a local symbol in a
  SEC_MERGE section.  The patch below prevents this, and also tidies
  up the if statement involved slightly, but this is only intended as a
  stopgap measure as I am working on a general tidy up of the fixup
  code.

Cheers
        Nick

2001-11-14  Nick Clifton  <address@hidden>

        * config/tc-sparc.c (md_apply_fix3): Do not remove the symbol's
        value from the addend for fixups against local symbols in
        SEC_MERGE sections - it was not added in, in the first place.

Index: gas/config/tc-sparc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sparc.c,v
retrieving revision 1.34
diff -p -c -r1.34 tc-sparc.c
*** tc-sparc.c  2001/09/19 05:33:29     1.34
--- tc-sparc.c  2001/11/14 14:05:29
*************** md_apply_fix3 (fixP, value, segment)
*** 2905,2926 ****
       don't want to include the value of an externally visible symbol.  */
    if (fixP->fx_addsy != NULL)
      {
!       if (symbol_used_in_reloc_p (fixP->fx_addsy)
!         && (S_IS_EXTERNAL (fixP->fx_addsy)
!             || S_IS_WEAK (fixP->fx_addsy)
!             || (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE)
              || (sparc_pic_code && ! fixP->fx_pcrel)
!             || (S_GET_SEGMENT (fixP->fx_addsy) != segment
!                 && ((bfd_get_section_flags (stdoutput,
!                                             S_GET_SEGMENT (fixP->fx_addsy))
!                      & SEC_LINK_ONCE) != 0
!                     || strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)),
!                                 ".gnu.linkonce",
!                                 sizeof ".gnu.linkonce" - 1) == 0)))
!         && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section
!         && S_GET_SEGMENT (fixP->fx_addsy) != undefined_section
!         && ! bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy)))
!       fixP->fx_addnumber -= S_GET_VALUE (fixP->fx_addsy);
        return 1;
      }
  #endif
--- 2905,2933 ----
       don't want to include the value of an externally visible symbol.  */
    if (fixP->fx_addsy != NULL)
      {
!       symbolS * sym = fixP->fx_addsy;
!         segT      seg = S_GET_SEGMENT (sym);
! 
!       if (symbol_used_in_reloc_p (sym)
!         && (S_IS_EXTERNAL (sym)
!             || S_IS_WEAK (sym)
! #if 0 /* Although fixups against local symbols in SEC_MERGE sections
!        should be treated as if they were against external symbols
!        write.c:fixup_segment() will not have included the value of
!        the symbol under these particular cicumstances.  */
!             || (seg->flags & SEC_MERGE)
! #endif
              || (sparc_pic_code && ! fixP->fx_pcrel)
!             || (seg != segment
!                 && (((bfd_get_section_flags (stdoutput, seg) & SEC_LINK_ONCE) 
!= 0)
!                     || (strncmp (segment_name (seg),
!                                  ".gnu.linkonce",
!                                  sizeof ".gnu.linkonce" - 1) == 0))))
!         && seg != absolute_section
!         && seg != undefined_section
!         && ! bfd_is_com_section (seg))
!       fixP->fx_addnumber -= S_GET_VALUE (sym);
! 
        return 1;
      }
  #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]