Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 06-27-2006, 10:11 AM   #1
LQ Newbie
Registered: Jun 2006
Posts: 4

Rep: Reputation: 0
elf executable size problem

Hi all,
I'm building executables from a set of object files and none of the object file is created in debug mode i.e no -g option is used, still the compiler/ld is putting debug sections and .symtab sections under section header colomns in the elf executables causing the size to increase substantially, i know a "strip" would do the needful but i don't want to do that, i wrote a test program and compiled it and was surprised to see these sections in its executable too. This is the output of gcc -v :-
a$ gcc -v

Reading specs from /lib/gcc-lib/i686-pc-linux-gnu/3.2.2/specs
Configured with: ../gcc-3.2.2/configure --prefix=/gcc-3.2.2-nonshared --with-gnu-as --with-as=/binutils-2.13/bin/as --with-gnu-ld --with-ld=/binutils-2.13/bin/ld --disable-shared
Thread model: posix
gcc version 3.2.2

The architecture is red-hat linux 7.2, kernel is 2.4.7-10,

for further information feel free to contact me.

Old 06-27-2006, 10:29 AM   #2
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,984

Rep: Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444
So strip them. It works. Problem solved.
Old 06-27-2006, 01:16 PM   #3
LQ Newbie
Registered: Jun 2006
Posts: 4

Original Poster
Rep: Reputation: 0
yeah dats an option, but as i mentioned, i don't want to do that, can you suggest any alternative approach ?? \
Old 06-27-2006, 01:31 PM   #4
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 34
Some compilers (not gcc) offer an -s option. This produces a stripped executable.

What kind of "other choice" are you after - there are none short of writing your own version strip and incorporating it into your compiler....?


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing ELF of the executable file ? vishalbutte Programming 3 12-30-2005 01:52 PM
Executable size - RH7.x versus Fedora Dave31836 Red Hat 1 03-04-2005 03:46 PM
ELF 32-bit LSB executable how to run vinsky2002 Linux - Software 1 01-12-2005 03:07 AM
X11 library problem wrong ELF size chewysplace Linux - Software 1 04-12-2004 03:40 PM
problem executable sol Linux - General 3 09-18-2001 03:33 PM

All times are GMT -5. The time now is 03:15 PM.

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