LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-22-2009, 01:52 PM   #1
mrshanim
Member
 
Registered: Aug 2009
Posts: 30

Rep: Reputation: 16
how to relate gcc *.c file with its .out file


Hi,
I am looking for a solution to find some relativity between *.c and its *.out file in gcc (g++) execution.
as example gcc hello.c -o hello.out
I am looking to find how we can surely conclude that hello.out is generated from hello.c
This I am looking to find semantically identical files, which can be regenerated if it is needed.
Also I am thinking to trace all system calls associated with gcc execution and parse input and output file name, then stored those pair in table.
This seems very difficult, but no whereto start that why I choose this way.

All suggestions are appreciated
Regards
Shanim
 
Old 10-22-2009, 03:32 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.15.5
Posts: 1,497
Blog Entries: 12

Rep: Reputation: 154Reputation: 154
Well, of course the easiest way to relate hello.c to hello.out is run gcc hello.c and compare the output to hello.out. In fact, it's probably the only reliable way, and you'd better use the same version of gcc. If you used a different version of gcc or another compiler, you *might* be able to use sequence matching (as is used for comparing DNA sequences and plagiarized text) to see if stretches of the compiled code are "similar enough". You'd have to set up some arbitrary criteria, and there would be false positives and negatives.

Reversing the process is probably not even theoretically possible, as there isn't a 1:1 reversible mapping between source code and compiled code.

Running a continuous audit on all uses of gcc would work too, for all future compilations.

Last edited by mostlyharmless; 10-22-2009 at 03:34 PM.
 
Old 10-22-2009, 05:16 PM   #3
mrshanim
Member
 
Registered: Aug 2009
Posts: 30

Original Poster
Rep: Reputation: 16
Thanks for reply,
First solution is good but not feasible for my case ( recompile same file then compare current .out with previous .out)

I am looking for an audit of the gcc, when you compile your file first time at the same time it will create a semantic pair
(hello.c and hello.out) or related pair and stored this information somewhere in table or log.
But I don't know how to audit gcc, how to find that pair, how to trace all system calls, where to start???

Please help me.

Regards
Manish
 
Old 10-22-2009, 05:27 PM   #4
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.15.5
Posts: 1,497
Blog Entries: 12

Rep: Reputation: 154Reputation: 154
That I can't help you with; maybe someone from Linux-Security using pam? could help you.
 
  


Reply

Tags
g++, gcc, trace


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ln -vs libgcc.a `gcc -print-libgcc-file-name | ......file exists jpeters Linux From Scratch 3 03-26-2009 09:40 PM
gcc will not execute, responds with 'no such file or directory' and 'no input file' nckeecho Ubuntu 8 01-10-2009 01:18 PM
gcc 4: no specs file rconan Linux From Scratch 6 07-11-2005 12:21 PM
gcc: ./remote-@REMOTE@.c: No such file or directory gcc: no input files pracslipkerm Linux - Newbie 3 06-15-2005 06:09 AM
How to use the head file of GCC in VC stiphon Programming 2 06-15-2004 05:54 AM


All times are GMT -5. The time now is 02:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration