9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] linker bug
@ 2004-11-25 18:46 Tim Newsham
  2004-11-26 12:37 ` Charles Forsyth
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Newsham @ 2004-11-25 18:46 UTC (permalink / raw)
  To: 9fans

There appears to be a bug in the linker (at least in kl) when
using the -R flag.  When I specify a value of -R0x4 everything
seems to work fine.  If I specify larger values such as -R0x10,
then occasionally (depending on the size of the text region,
I presume) the emitted binary is incorrect.  For example, if
I have an initialized variable:

    static int x = 0x12345678;

then the address of x (in the symbol table and as referenced
by the instructions) will not line up with the initialized word
that contains the value 0x12345678.

I've stopped using the flag in this way (turns out I didnt need
it after all), so I haven't tracked down the bug any further,
but thought I'd mention it before it bites someone else.

Tim N.


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

* Re: [9fans] linker bug
  2004-11-25 18:46 [9fans] linker bug Tim Newsham
@ 2004-11-26 12:37 ` Charles Forsyth
  0 siblings, 0 replies; 2+ messages in thread
From: Charles Forsyth @ 2004-11-26 12:37 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

the -R option means: the thing that reads in this program will put
the data at an offset that is consistent with the value given by
-R, so round the start of data accordingly.
if it's right in the symbol table, and in the instructions, kl
is correct.  the problem will be with the program (bootstrap?)
that reads in the program and sets it up in memory.

[-- Attachment #2: Type: message/rfc822, Size: 2915 bytes --]

From: Tim Newsham <newsham@lava.net>
To: 9fans@cse.psu.edu
Subject: [9fans] linker bug
Date: Thu, 25 Nov 2004 08:46:12 -1000 (HST)
Message-ID: <Pine.BSI.4.58.0411250842340.6130@malasada.lava.net>

There appears to be a bug in the linker (at least in kl) when
using the -R flag.  When I specify a value of -R0x4 everything
seems to work fine.  If I specify larger values such as -R0x10,
then occasionally (depending on the size of the text region,
I presume) the emitted binary is incorrect.  For example, if
I have an initialized variable:

    static int x = 0x12345678;

then the address of x (in the symbol table and as referenced
by the instructions) will not line up with the initialized word
that contains the value 0x12345678.

I've stopped using the flag in this way (turns out I didnt need
it after all), so I haven't tracked down the bug any further,
but thought I'd mention it before it bites someone else.

Tim N.

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

end of thread, other threads:[~2004-11-26 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-25 18:46 [9fans] linker bug Tim Newsham
2004-11-26 12:37 ` Charles Forsyth

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 NNTP newsgroup(s).