This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: PATCH for elf.sc
- To: mark@codesourcery.com
- Subject: Re: PATCH for elf.sc
- From: Ian Lance Taylor <ian@zembu.com>
- Date: 20 Jun 1999 23:47:39 -0400
- CC: binutils@sourceware.cygnus.com
- References: <19990620203421Q.mitchell@codesourcery.com>
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