This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with ld for PDP-11


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]