Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751248AbWHBF2y (ORCPT ); Wed, 2 Aug 2006 01:28:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751249AbWHBF2x (ORCPT ); Wed, 2 Aug 2006 01:28:53 -0400 Received: from ebiederm.dsl.xmission.com ([166.70.28.69]:5345 "EHLO ebiederm.dsl.xmission.com") by vger.kernel.org with ESMTP id S1751248AbWHBF2x (ORCPT ); Wed, 2 Aug 2006 01:28:53 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Andi Kleen Cc: linux-kernel@vger.kernel.org, Horms , Jan Kratochvil , "H. Peter Anvin" , Magnus Damm , Vivek Goyal , Linda Wang Subject: Re: [PATCH 9/33] i386 boot: Add serial output support to the decompressor References: <200608020510.07569.ak@suse.de> Date: Tue, 01 Aug 2006 23:27:00 -0600 In-Reply-To: <200608020510.07569.ak@suse.de> (Andi Kleen's message of "Wed, 2 Aug 2006 05:10:07 +0200") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2033 Lines: 58 Andi Kleen writes: >> > /* WARNING!! >> > * This code is compiled with -fPIC and it is relocated dynamically >> > * at run time, but no relocation processing is performed. >> > * This means that it is not safe to place pointers in static structures. >> > */ > > iirc the only static relocation in early_printk is the one to initialize > the console pointers - that could certainly be moved to be at run > time. The function pointers in the console structure are also a problem. static struct console simnow_console = { .name = "simnow", .write = simnow_write, .flags = CON_PRINTBUFFER, .index = -1, }; >> lib/string.c might be useful. The fact that the functions are not >> static slightly concerns me. I have a vague memory of non-static >> functions generating relocations for no good reason. > > Would surprise me. The context where it bit me was memtest86, if I recall correctly. The problem there was I did process relocations and I discovered simply by making functions static or at least non-exported I had many fewer relocations to process. Since I am relying on a very clever trick to generate code that doesn't have relocations at run time I have to be careful. So if I want to continue not processing relocations. I need to be careful not to use constructs that will generate a procedure linkage table, which I think only kicks in with external functions and multiple files. I need to be careful not to put pointers in statically allocated data structures. Ideally the code would be setup so you can compile out consoles the user finds uninteresting. It is annoying to have to call strlen on all of the strings you want to print.. So there are plenty of mismatches, there. But we may be able to harmonized them, and reuse early_printk. Eric - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/