From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14421 invoked by alias); 7 Sep 2007 15:38:56 -0000 Received: (qmail 14409 invoked by uid 22791); 7 Sep 2007 15:38:55 -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; Fri, 07 Sep 2007 15:38:50 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l87FclGJ002621; Fri, 7 Sep 2007 11:38:47 -0400 Received: from pobox.fab.redhat.com (pobox.fab.redhat.com [10.33.63.12]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l87FclIr005699; Fri, 7 Sep 2007 11:38:47 -0400 Received: from [10.33.6.30] (vpn-6-30.fab.redhat.com [10.33.6.30]) by pobox.fab.redhat.com (8.13.1/8.13.1) with ESMTP id l87Fckj0022659; Fri, 7 Sep 2007 11:38:46 -0400 Message-ID: <46E17087.4080503@redhat.com> Date: Fri, 07 Sep 2007 15:38:00 -0000 From: Nick Clifton User-Agent: Thunderbird 1.5.0.12 (X11/20070718) MIME-Version: 1.0 To: Bhushan Verma CC: binutils@sourceware.org Subject: Re: Regarding linker code generation References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2007-09/txt/msg00071.txt.bz2 Hi Bhushan, > Now problem is that we are unable to give the execute permission (RWX) to > data segment. This is requirement for run time linker. An unusual requirement, but OK... > Could you please help me how can I do this ,is there any provision to change > the default linker script. Yes. The -T command line switch to the linker (or to gcc) will override the default linker script and let you specify your own script. Here is one way of doing this: 1. Run "ld --verbose" and save the output. This gives you a copy of the built-in, default linker script. You will need to edit the output to remove a few lines of text at the beginning and end of the output. 2. Read the linker manual's section on linker scripts and in particular the part about defining your segments. Then add a set of segment definitions to your new linker script. For example I used this: PHDRS { exec_data PT_LOAD FLAGS (7) ; code PT_LOAD FLAGS (5) ; data PT_LOAD FLAGS (6) ; } 3. Now you can annotate the entries in the SECTIONS part of the linker script with the segment that you want them to use. eg: .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :exec_data You may need to experiment a bit but you should be able to achieve the results you want. Cheers Nick