www.delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <43B7186A.8CE0CB91@dessent.net> |
Date: | Sat, 31 Dec 2005 15:46:50 -0800 |
From: | Brian Dessent <brian AT dessent DOT net> |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: executable = exe + data |
References: | <uek3vqivg DOT fsf AT gnu DOT org> |
X-IsSubscribed: | yes |
Reply-To: | cygwin AT cygwin DOT com |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Sam Steingold wrote: > Is it possible? > > simply put, it it possible to write something like this: > > int main () { > size_t my_length; > <some magic> > printf("exe size=%lld\n",my_length); > return 0; > } All the methods mentioned so far are essentially hacks working against the linker, doing stuff behind its back. Why not go with the flow? Put your data in its own section, and write a linker script to handle that section in the desired way. You can access the address by referencing the linker script variables in your source code. See section 3 of the ld manual, particularly 3.5.3. This should work on any platform that uses ld. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |