From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15830 invoked by alias); 26 Sep 2006 14:33:20 -0000 Received: (qmail 15820 invoked by uid 22791); 26 Sep 2006 14:33:19 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 26 Sep 2006 14:33:12 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k8QEXAoB004347; Tue, 26 Sep 2006 10:33:10 -0400 Received: from mail.boston.redhat.com (mail.boston.redhat.com [172.16.76.12]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k8QEXAkk000431; Tue, 26 Sep 2006 10:33:10 -0400 Received: from [172.16.83.101] (dhcp83-101.boston.redhat.com [172.16.83.101]) by mail.boston.redhat.com (8.12.8/8.12.8) with ESMTP id k8QEXAX2015621; Tue, 26 Sep 2006 10:33:10 -0400 Message-ID: <4519387D.3080305@redhat.com> Date: Tue, 26 Sep 2006 14:52:00 -0000 From: Vivek Goyal Reply-To: vgoyal@redhat.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 MIME-Version: 1.0 To: "H. J. Lu" CC: binutils@sources.redhat.com Subject: Re: Linker Bug or Design Intent (Absolute symbols in zero sized sections) References: <4519350D.2090208@redhat.com> <20060926142709.GA8543@lucon.org> In-Reply-To: <20060926142709.GA8543@lucon.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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-09/txt/msg00309.txt.bz2 H. J. Lu wrote: > On Tue, Sep 26, 2006 at 10:11:25AM -0400, Vivek Goyal wrote: > >>Now, above compiler makes some symbols absolute and these symbols are >>not relocated and kernel code fails at some point. In this case kernel >>fails because it is trying to free memory between symbol __smp_alt_begin >>and another symbol present in other section. __smp_alt_begin is now >>absolute and does not get relocated and kernel ends up trying to free a >>wrong portion of memory. >> > > > Why do you want to free a memory which doesn't exist? Well, based on various CONFIG options, some init sections might be created when kernel is compiled. Memory belonging to these sections is freed once initialization is over. In the above case, kernel defines following three sections in ld script and tries to free up memory __smp_alt_being and __smp_alt_end. From a programming perspective one can always do. If (__smp_alt_being < __smp_alt_end) Free up memory; .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) { __smp_alt_begin = .; __smp_alt_instructions = .; *(.smp_altinstructions) __smp_alt_instructions_end = .; } . = ALIGN(4); .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { __smp_locks = .; *(.smp_locks) __smp_locks_end = .; } .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) { *(.smp_altinstr_replacement) . = ALIGN(4096); __smp_alt_end = .; } Thanks Vivek