This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] MIPS/BFD: Compressed dynsym annotation consistency fix


 This is a change I've been pondering over for quite a while now and after 
some additional testing I decided to give it a go-ahead.

 A while ago I noticed we'd been inconsistent in how MIPS16 and microMIPS 
function dynamic symbols are output in that for the formers we clear the 
MIPS16 symbol annotation while for the latters we keep the corresponding 
microMIPS annotation intact.  The inconsistency was missed when microMIPS 
support was originally implemented and stayed such thereafter for quite a 
while because the dynamic linker doesn't really care.  It never pokes at 
the annotation and all it really cares of is the actual symbol's value -- 
which is meticulously noted by a comment near the piece of code concerned.

 I can see a logic in how we treat MIPS16 function symbols -- a given 
symbol as stored in the ELF symbol table entry either has MIPS16 
annotation in the st_other member or the ISA bit set in the st_value 
member, but never both at a time.  BFD internals then deal with encoding 
and decoding st_other/st_value pairs as appropriate -- this is seen when 
you compare the output of `objdump -T' and one of `readelf -s' where 
MIPS16 function symbols are present.

 So I think we should follow the same logic for microMIPS symbols and the 
change below implements it.  I made no separate test case to cover this 
modification; this will be covered as a side effect by some of the 
upcoming microMIPS PLT tests that check symbol tables.

 I have tested it with our testsuite and the usual 25 MIPS targets with no 
problems whatever.  Also to be absolutely sure that this doesn't break 
something elsewhere I have bootstrapped the whole toolchain for the 
mips-linux-gnu target, including in particular GCC and glibc, for a few 
microMIPS multilib variants.  And then I ran the GDB test suite, which is 
probably the most prone to such subtleties as symbol annotation, as the 
tool actually pokes at symbol tables whereas some other test suites, such 
as these for GCC and glibc, are intended to merely check that code 
produced runs correctly, for the most of their part.  This didn't show any 
regressions either.

 OK to apply?

2013-02-19  Maciej W. Rozycki  <>

	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Also clear
	STO_MICROMIPS annotation.


Index: binutils-fsf-trunk-quilt/bfd/elfxx-mips.c
--- binutils-fsf-trunk-quilt.orig/bfd/elfxx-mips.c	2013-02-18 17:34:28.025461704 +0000
+++ binutils-fsf-trunk-quilt/bfd/elfxx-mips.c	2013-02-18 17:34:52.085431379 +0000
@@ -10118,13 +10118,18 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd
   if (IRIX_COMPAT (output_bfd) == ict_irix6)
     mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym);
-  /* Keep dynamic MIPS16 symbols odd.  This allows the dynamic linker to
-     treat MIPS16 symbols like any other.  */
+  /* Keep dynamic compressed symbols odd.  This allows the dynamic linker
+     to treat compressed symbols like any other.  */
   if (ELF_ST_IS_MIPS16 (sym->st_other))
       BFD_ASSERT (sym->st_value & 1);
       sym->st_other -= STO_MIPS16;
+  else if (ELF_ST_IS_MICROMIPS (sym->st_other))
+    {
+      BFD_ASSERT (sym->st_value & 1);
+      sym->st_other -= STO_MICROMIPS;
+    }
   return TRUE;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]