public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Relocations put in read-only segment?
@ 1998-04-23 23:23 Charles M. Hannum
  1998-04-24 16:23 ` Jeffrey A Law
  0 siblings, 1 reply; 7+ messages in thread
From: Charles M. Hannum @ 1998-04-23 23:23 UTC (permalink / raw)
  To: egcs

When I compile the following code with egcs 1.0.2, using `-O -fPIC',
on either i386-*-netbsd or i586-*-linux-gnulibc1, the relocation for
`XtStrings+788' is put in a read-only section (the text section under
NetBSD, rodata under Linux).  While it's true that ld.so on both
platforms is careful to make this work, it's canonically wrong.  If
the relocation is done in a data section at all, it should be in a
writable section.


The code in question (whittled down from a case in Xaw3d):

extern const  char XtStrings[];
void NotifyThumb (top)
    float top;
{
    XtCallCallbacks (&XtStrings[788], top + 0.0001);
}

Under egcs 1.0.2, the reference to XtStrings is compiled as:

.text
[...]
LC1:
        .long _XtStrings+788
        .align 2
[...]
        pushl LC1@GOTOFF(%ebx)

whereas, under gcc 2.7.2.2, it's compiled as:

.text
[...]
        movl _XtStrings@GOT(%ebx),%eax
        addl $788,%eax
        pushl %eax


Anyone know why this happens, or do I need to track it down myself?


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1998-04-25 17:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-23 23:23 Relocations put in read-only segment? Charles M. Hannum
1998-04-24 16:23 ` Jeffrey A Law
1998-04-24 16:23   ` Charles M. Hannum
1998-04-25 17:40     ` Jeffrey A Law
1998-04-24 16:23   ` Charles M. Hannum
1998-04-24 16:23   ` Charles M. Hannum
1998-04-25 16:18   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).