The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: jnc@mercury.lcs.mit.edu (Noel Chiappa)
To: tuhs@tuhs.org
Cc: jnc@mercury.lcs.mit.edu
Subject: Re: [TUHS] Debugging help sought
Date: Fri,  7 Aug 2020 12:07:23 -0400 (EDT)	[thread overview]
Message-ID: <20200807160723.5E16918C08B@mercury.lcs.mit.edu> (raw)

    > From: Warner Losh

    > 8 I think was the limit.

IIRC, you could use longer names than that (in C), but external references
only used the first 7 (in C - C symbols had a leading '_' tacked on; I used to
know why), 8 (in assembler).

    > Could that cause this error?

Seems unlikely - see below.


    > The error comes from lookloc. This is called for external type
    > relocations. It searches the local symbol table for something that
    > matches the relocation entry. This error happens when it can't find
    > it...

Someone who actually looked at the source:

  https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/ld.c

instead of just guessing. Give that man a star!

I spent a while looking at the code, trying to figure out i) how it works, and
ii) what's going wrong with that message, but I don't have a definitive
answer. The code is not super well commented, so one has to actually
understand what it's doing! :-)

It seems to my initial perusal that it maintains two symbol tables, one for
globals (which accumulates as each file is processed), and one for locals
(which is discarded/reset for each file). As Werner mentioned, the message
appears when a local symbol referenced in the relocation information in the
current file can't be found (in the local symbol table).

It's not, I think, simply due to too many local symbols in an input file -
there seems to be a check for that as it's reading the input file symbol
table:

   if (lp >= &local[NSYMPR])
           error(1, "Local symbol overflow");
   *lp++ = symno;
   *lp++ = sp;

although of course there could be a bug which breaks this check. It seems to
me that this is an 'impossible' error, one which can only happen due to i) a
bug in the loader (a fencepost error, or something), or ii) an error in the
input a.out file.

I don't want to spend more time on it, since I'm not sure if you've managed to
bypass the problem. If not, let me know, and we'll track it down. (This may
involve you addding some printf's so we have more info about the details.)

    Noel


             reply	other threads:[~2020-08-07 16:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07 16:07 Noel Chiappa [this message]
2020-08-07 17:11 ` John Cowan
2020-08-07 20:48 ` Warner Losh
  -- strict thread matches above, loose matches on Subject: below --
2020-08-06  1:28 Adam Thornton
2020-08-06  2:01 ` Jim Capp
2020-08-06  3:04   ` Warner Losh
2020-08-06  3:08     ` Warner Losh
2020-08-06  5:55       ` Adam Thornton
2020-08-06  4:57     ` Dave Horsfall
2020-08-06  7:16       ` Otto Moerbeek
2020-08-06 15:47 ` Paul Winalski
2020-08-06 16:09   ` Larry McVoy
2020-08-06 16:19     ` Paul Winalski
2020-08-06 16:24       ` Larry McVoy
2020-08-06 23:41         ` Adam Thornton
2020-08-07  0:35   ` Warner Losh
2020-08-07  4:30     ` Adam Thornton
2020-08-07  5:49       ` Warner Losh
2020-08-07  5:54         ` Adam Thornton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200807160723.5E16918C08B@mercury.lcs.mit.edu \
    --to=jnc@mercury.lcs.mit.edu \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).