LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2004, 02:56 PM   #1
andzerger
Member
 
Registered: Feb 2004
Location: denver
Distribution: slackware && freeBSD && rh9
Posts: 92

Rep: Reputation: 15
footsteps in the hex


I was playing around with a hex editor yesterday, and compared an empty C program (main () {}) w/ the kernel, and noticed that in my compiled code there were all sorts of module references, and in the kernel the binary was entirely binary, except fora few error messages .. why is it that GCC sticks so much stuffing into my code and leaves the kernel code naked?
 
Old 03-12-2004, 03:14 PM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
try compiling with -s to strp the binary of symbols, or use 'strip' command.
 
Old 03-12-2004, 04:01 PM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Then kernel is self-containing. It cannot use libc. So it has its own small subset of a c lib inside. So there are no references to libraries needed nor possible.

By default gcc assumes at least to link an program against libc. But for special purposes (like a kernel for example) there are commandline options to gcc to not linking certain stuff. It is quite complex to make a program that does not have anything linked to it. The program even doen't know by itself anymore how start running...

See the man and info pages of gcc for more info.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
increment in hex snutz411 Linux - Newbie 2 11-01-2005 05:54 PM
dec to hex ewt3y Linux - General 2 08-16-2005 12:01 PM
Search file for Hex value paddyjoy Programming 6 08-11-2005 01:11 AM
Hex socks Linux - General 4 02-17-2005 12:05 PM
hex? Nox Solaris Linux - Newbie 3 12-07-2002 08:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:20 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration