Problem with ld for PDP-11

Alan Modra amodra@gmail.com
Thu Feb 13 07:50:00 GMT 2020


On Wed, Feb 12, 2020 at 11:18:50PM -0800, Stephen Casner wrote:
> On Thu, 13 Feb 2020, Alan Modra wrote:
> 
> > On Wed, Feb 12, 2020 at 10:02:02PM -0800, Stephen Casner wrote:
> > > So now I went digging my way back through the code sequence using
> > > printfs to find where the original data size gets rounded up.  It
> > > turns out that the size of the data section is always even because the
> > > assembler "as" or "gas" always pads the data section with a zero byte
> > > if the size is odd, so the object file header always contains an even
> > > size for the .data section.  That's because there is always relocation
> > > and symbol information following it.
> > >
> > > Therefore the size of the .data section in ld is always even
> >
> > No, a linker script might contribute to .data output.
> 
> Oh, that's something I don't know about.  Can you point me to an
> example so I can try it?

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.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list