From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112238 invoked by alias); 14 Feb 2020 23:42:30 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 112226 invoked by uid 89); 14 Feb 2020 23:42:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL autolearn=no version=3.3.1 spammy= X-HELO: d.mail.sonic.net Received: from d.mail.sonic.net (HELO d.mail.sonic.net) (64.142.111.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Feb 2020 23:42:28 +0000 Received: from auge (75-25-121-24.lightspeed.snvaca.sbcglobal.net [75.25.121.24]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id 01ENgM71005539 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 14 Feb 2020 15:42:22 -0800 Date: Fri, 14 Feb 2020 23:42:00 -0000 From: Stephen Casner To: Alan Modra cc: binutils@sourceware.org Subject: Re: Problem with ld for PDP-11 In-Reply-To: <20200213075051.GE29647@bubble.grove.modra.org> Message-ID: References: <20200213002635.GA29647@bubble.grove.modra.org> <20200213065753.GD29647@bubble.grove.modra.org> <20200213075051.GE29647@bubble.grove.modra.org> User-Agent: Alpine 2.21.9999 (OSX 301 2018-08-15) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2020-02/txt/msg00372.txt.bz2 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