public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Stephen Casner <casner@acm.org>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: Problem with ld for PDP-11
Date: Fri, 14 Feb 2020 23:42:00 -0000	[thread overview]
Message-ID: <alpine.OSX.2.21.9999.2002141459000.60060@auge.attlocal.net> (raw)
In-Reply-To: <20200213075051.GE29647@bubble.grove.modra.org>

On Thu, 13 Feb 2020, Alan Modra wrote:
> You could use ld/ldscripts/pdp11.x (which is the default script you'll
> be using for normal executables), and add the line
>
>     BYTE (0)
>
> after CONSTRUCTORS.  Then link using -T.

Thanks for the pointer.  You are right, if I comment out the "else"
clause that I proposed to remove and link using a script modified as
you suggest then I can create an output file with an odd length that
is one bye shorter than what the header indicates.  With the code
intact a padding byte is appended such that the length then matches.

But that begs the question, does it matter?  What would be the
motivation to create such a script?

As an alternative to removing the else clause, I could change it to be
similar to the corresponding else clause in the aoutx.h file from
which pdp11.c was adapted.  The code in aoutx.h always appends
BYTES_IN_WORD bytes of zero to the .data section for this "else" case
where no symbols will follow.  That always leaves one or two
extraneous bytes of 0 after then end of the proper length of the .data
section, even for normal production with the default linker script.
Would that be a better solution than just removing the padding code?
It appears that is what targets based on aoutx.h would do unless there
is some other step that truncates the file to the correct length.

                                                        -- Steve

  reply	other threads:[~2020-02-14 23:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 20:30 Stephen Casner
2020-02-13  0:26 ` Alan Modra
2020-02-13  6:02   ` Stephen Casner
2020-02-13  6:58     ` Alan Modra
2020-02-13  7:18       ` Stephen Casner
2020-02-13  7:50         ` Alan Modra
2020-02-14 23:42           ` Stephen Casner [this message]
2020-02-15  0:11   ` Stephen Casner
2020-02-17 21:06     ` Stephen Casner

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=alpine.OSX.2.21.9999.2002141459000.60060@auge.attlocal.net \
    --to=casner@acm.org \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).