This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Patches to support traditional mips target (mips-dde-sysv4.2MP).
- To: "Koundinya.K" <kk at ddeorg dot soft dot net>
- Subject: Re: Patches to support traditional mips target (mips-dde-sysv4.2MP).
- From: Ulf Carlsson <ulfc at calypso dot engr dot sgi dot com>
- Date: Wed, 3 May 2000 04:59:07 -0700 (PDT)
- Cc: binutils at sourceware dot cygnus dot com
On Wed, 3 May 2000, Koundinya.K wrote:
> Here is the patch for binutils-000428/gas/config/tc-mips.c. This patch also
> handles a problem with gas while handling weak symbols.
The part of my patches that fixes the weak symbol handling is attached. We
use this patch when we're compiling glibc 2.2 and the Linux kernel. We have
to treat a relocation against a weak symbol as a an external relocation, it's
impossible to override a weak symbol from another object file otherwise.
Ulf
Index: tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.14
diff -u -p -r1.14 tc-mips.c
--- tc-mips.c 2000/04/25 10:02:20 1.14
+++ tc-mips.c 2000/05/03 11:34:39
@@ -9546,7 +9546,10 @@ md_apply_fix (fixP, valueP)
if (fixP->fx_addsy != NULL && OUTPUT_FLAVOR == bfd_target_elf_flavour)
{
if (S_GET_OTHER (fixP->fx_addsy) == STO_MIPS16
- || S_IS_WEAK (fixP->fx_addsy)
+ || (S_IS_WEAK (fixP->fx_addsy)
+ && !S_IS_COMMON (fixP->fx_addsy))
+ || (S_IS_EXTERN (fixP->fx_addsy)
+ && !S_IS_COMMON (fixP->fx_addsy))
|| (symbol_used_in_reloc_p (fixP->fx_addsy)
&& (((bfd_get_section_flags (stdoutput,
S_GET_SEGMENT (fixP->fx_addsy))
@@ -11022,6 +11025,10 @@ md_estimate_size_before_relax (fragp, se
change = (symsec != &bfd_und_section
&& symsec != &bfd_abs_section
&& ! bfd_is_com_section (symsec));
+#ifdef OBJ_ELF
+ /* A global symbol is treated as external */
+ change = change ? !(S_IS_EXTERN (sym) || S_IS_WEAK (sym)) : 0;
+#endif
}
else
abort ();
@@ -11057,6 +11064,13 @@ int
mips_fix_adjustable (fixp)
fixS *fixp;
{
+#ifdef OBJ_ELF
+ /* Prevent all adjustments to global symbols. */
+ if (S_IS_EXTERN (fixp->fx_addsy))
+ return 0;
+ if (S_IS_WEAK (fixp->fx_addsy))
+ return 0;
+#endif
if (fixp->fx_r_type == BFD_RELOC_MIPS16_JMP)
return 0;
if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT