delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/03/16:56:48

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
From: "Hannu E K Nevalainen" <garbage_collector AT telia DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Printable information in executables
Date: Mon, 3 Nov 2003 22:56:01 +0100
Message-ID: <NGBBLLIAMFLGJEOAJCCEIEPNDFAA.garbage_collector@telia.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
In-Reply-To: <bo4nl5$ao7$1@sea.gmane.org>
Importance: Normal

> From: Alex Vinokur
> Sent: Monday, November 03, 2003 6:05 AM

> Executable files contain various printable information.
> For instance, list of  used DLLs.
>
> However those files contain neither compiler name nor compiler version.
> It seems to be worth including something like "gcc version 3.3.1
> (cygming special)" in executables.
>
> Next question. Is it possible to add 'user related printable
> information' to executables (through compilation option or something
> else)?

 The answer depends on how you plan to use that information.

The simplest form is just to declare a static string (char array), making
sure that the compiler doesn't remove it at optimization. (Hmm...? Is it
enough to do some dummy reference to it?)

This gives a simplified image of the true heuristics but anyway;
on the old AmigaOS they use(d) something like:

$ cat chk.c
int main() {
  char versionstring[]="$VER: name major.minor (date) extended_info";
  return 0;
}

$ for (( n=0; n<4; n++ )) do
  gcc -O$n chk.c;
  echo -n $n:;
  strings a.exe | grep '$VER: ';
done
0:$VER: name major.minor (date) extended_info
1:$VER: name major.minor (date) extended_info
2:$VER: name major.minor (date) extended_info
3:$VER: name major.minor (date) extended_info

Hmm... :-} it doesn't get removed by plain optimization... :-)

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019