sh4 fails on check-textrel in glibc-2.3.2 even though there are no relocations?

Dan Kegel dank@kegel.com
Thu Jul 31 22:26:00 GMT 2003


Roland McGrath wrote:
>>check-textrel still fails.  Oddly, when you use readelf -a to look
>>at the .so's that supposedly have relocations, there aren't any,
>>but there is a size-zero TEXTREL:
> 
> 
> That sounds like an ld bug.  DT_TEXTREL set by ld -shared when it thinks
> there were some dynamic relocs in read-only segments.  

Kai sent me a test patch for binutils,

--- src/bfd/elf32-sh.c.old      Fri Jul 25 14:46:58 2003
+++ src/bfd/elf32-sh.c  Thu Jul 31 21:09:38 2003
@@ -6497,8 +6497,10 @@ sh_elf_check_relocs (bfd *abfd, struct b
                                                           sreloc, 2))
                         return FALSE;
                     }
+#if 0
                   if (sec->flags & SEC_READONLY)
                     info->flags |= DF_TEXTREL;
+#endif
                   elf_section_data (sec)->sreloc = sreloc;
                 }

and sure enough, check-textrel no longer complained.

Unfortunately, although the gcc and glibc regression tests link
now, dynamically linked programs all crash with an illegal instruction.
I don't know enough to know whether that's a new problem,
or whether it's an expected outcome of the test binutils patch.

I guess I could link a static copy of gdbserver and run
it via chroot without a shell, and see if it could tell me
what's going on... alternately, I'd be happy to send my build
script to anyone.  It's quite easy to reproduce.

 > You should
> double-check that all the dynamic relocations shown by readelf lie in
> addresses in writable segments.

Er, I guess that means looking at the output of readelf -r
but it'd take a while for me to figure that out.  (Maybe
check-textrel should output more descriptive errors.)
- Dan

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045



More information about the Libc-alpha mailing list