From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27509 invoked by alias); 12 Aug 2008 14:15:13 -0000 Received: (qmail 27499 invoked by uid 22791); 12 Aug 2008 14:15:12 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Aug 2008 14:14:33 +0000 Received: from wpaz17.hot.corp.google.com (wpaz17.hot.corp.google.com [172.24.198.81]) by smtp-out.google.com with ESMTP id m7CEETBm019939; Tue, 12 Aug 2008 15:14:30 +0100 Received: from smtp.corp.google.com (spacemonkey2.corp.google.com [192.168.120.114]) by wpaz17.hot.corp.google.com with ESMTP id m7CEERM3013170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 12 Aug 2008 07:14:28 -0700 Received: from localhost.localdomain.google.com (69-36-227-135.cust.layer42.net [69.36.227.135] (may be forged)) (authenticated bits=0) by smtp.corp.google.com (8.13.8/8.13.8) with ESMTP id m7CEEJjc012932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 12 Aug 2008 07:14:23 -0700 To: "Pan ruochen" Cc: gcc-help@gcc.gnu.org Subject: Re: how to create a self-relocatable raw binary with gcc? References: From: Ian Lance Taylor Date: Tue, 12 Aug 2008 14:25:00 -0000 In-Reply-To: (Pan ruochen's message of "Mon\, 11 Aug 2008 14\:36\:35 +0800") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg00116.txt.bz2 "Pan ruochen" writes: > I want to create a raw binary excutable for MIPS arch, which can relocate > itself to any load address at runtime without an externel loader. > How should I compile the sources and write the linker script for this purpose? There isn't any way to do this without some hacking. gcc and gas used to support that for the MIPS. The option was -membedded-pic. It was removed because it stopped working and nobody was interested in fixing it. So one approach would be to look at old releases for that code and fix it up. Ian