From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1591 invoked by alias); 22 Aug 2006 17:22:59 -0000 Received: (qmail 1579 invoked by uid 22791); 22 Aug 2006 17:22:58 -0000 X-Spam-Check-By: sourceware.org Received: from smtp105.sbc.mail.mud.yahoo.com (HELO smtp105.sbc.mail.mud.yahoo.com) (68.142.198.204) by sourceware.org (qpsmtpd/0.31) with SMTP; Tue, 22 Aug 2006 17:22:55 +0000 Received: (qmail 69938 invoked from network); 22 Aug 2006 17:22:54 -0000 Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@71.146.115.163 with login) by smtp105.sbc.mail.mud.yahoo.com with SMTP; 22 Aug 2006 17:22:54 -0000 Received: by lucon.org (Postfix, from userid 1000) id D470663E93; Tue, 22 Aug 2006 10:22:52 -0700 (PDT) Date: Tue, 22 Aug 2006 18:04:00 -0000 From: "H. J. Lu" To: binutils@sources.redhat.com Subject: Can we move location counter backwards? Message-ID: <20060822172252.GA5212@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00244.txt.bz2 The linker manual says "The location counter may never be moved backwards." But in the same manual, there are Note that the `OVERLAY' command is just syntactic sugar, since everything it does can be done using the more basic commands. The above example could have been written identically as follows. .text0 0x1000 : AT (0x4000) { o1/*.o(.text) } __load_start_text0 = LOADADDR (.text0); __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0); .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) } __load_start_text1 = LOADADDR (.text1); __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1); . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1)); It moves the location counter backwards implicitly. It is the same as .text0 0x1000 : AT (0x4000) { o1/*.o(.text) } __load_start_text0 = LOADADDR (.text0); __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0); . = 0x1000; .text1 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) } __load_start_text1 = LOADADDR (.text1); __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1); . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1)); Given that linker does allow/support moving the location counter backwards, should we remove "The location counter may never be moved backwards." from the linker manual? H.J.