PATCH for elf.sc

Ian Lance Taylor ian@zembu.com
Thu Jul 1 00:00:00 GMT 1999


   From: mark@codesourcery.com
   Date: Sun, 20 Jun 1999 20:34:21 -0700

   On IRIX6, the .rodata section often has to be writable.  (Yes, you
   read that right.)  That's because there are .rel.dyn relocations
   against it, and because SGI `rld' does not honor DT_TEXTREL.  (That's
   supposed to tell it that relocations may occur against the text
   segment.)  The consequence is that .rodata must go in the data
   segment.  Here's a patch to elf.sc that allows a port to turn on this
   behavior.  

That's odd.  For most targets, -fpic will arrange to put read only
constants that require relocation into .data rather than .rodata.  For
example, that's what the reloc parameter is for in
output_constant_def_contents in gcc/varasm.c.  Maybe the problem is
that gcc isn't setting flag_pic for Irix 6 even though it is really
compiling in PIC mode.

Of course, it's very odd that the SGI dynamic linker doesn't honor
DT_TEXTREL.

   Is there an easy way for a BFD back-end to reorder sections depending
   on what relocations it has seen?  I couldn't find one, so I came up
   with this patch.  OK?

I think this patch is the right approach.  I think it's a bad idea for
BFD to try to override the linker script, but on the other hand the
linker script should naturally set the location of .rodata.

However, I don't think this patch will work as written, because some
shells will get confused about ${VAR-xxx} where xxx contains curly
braces.  That's why INTERP, PLT, and DYNAMIC are handled the way they
are in elf.sc.

Ian


More information about the Binutils mailing list