Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" To: Subject: RE: Printable information in executables Date: Mon, 3 Nov 2003 22:56:01 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: 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/