Results 1 to 5 of 5

Thread: Bit off topic - but is anyone good with GCC under Linux ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Default

    The compiler output is clean and the app works just great. My issue is that the binary is very large and I have been reading around that subject and switching on lots of flags and trying various combinations to reduce it. More at issue tho is that when I look at the binary there are loads of strings in it. Not just the strings that are supposed to be there but loads that are clearly not sensible. For a start loads of my function names and even the source filenames are built into the binary result.

    First of all this is without the -g debugging option on. I can also use -g0 in case anyways and its still the same. I have used Strip Dice.exe and with options of -s or -X and some more. I have compiled with the -s option for the object files and linkage. Then there is the -Os optimize for size and the discard c_sections. Then I tried the visibility flags. I am using gcc V4.4 which I think is the last maintained or stable version. Maybe I should try a 4.5 but anyways, if I set the visibility as hidden then the strings are still there.

    Also, looking at other apps on my ubuntu box - like some of the games etc, I can see the source file names and function names and class names in those as well. Is this just a 'feature' of using gcc and would I need to actively obfuscate names before compilation in order to avoid this ?

    Just to be clear, I am using a load of shared libs but none of them are mine - stuff like OpenGL, SDL, StdC etc. All my code is non library stuff. If I could I would compile it all static but I am told also that under linux this is hard to do since the libgcc and libc interact with the kernel in version specific ways that almost require you to link to those shared.

    So yeah, bit of an odd question here but anyone got advice or links to posts about that ?

  2. #2
    Guild Novice
    Join Date
    Feb 2008
    Location
    St Louis, MO, USA
    Posts
    24

    Default

    My first thought is do you really need to worry about this? Seems that you have two concerns. The first is executable size. The second is the exposure of filenames and function names.

    As for file size, disk space is cheap, and executables are paged into memory, so it doesn't matter if it's big. Are you trying to fit the executable into some specific size?

    On the information exposure, are you using C++ with anything virtual? I seem to recall that requires more information to be stored in the executable to work. Otherwise, static linking would probably improve stuff, but that would increase the size of your executables.

    I haven't had any experience with this, since my employers generally just haven't worried about it. I'd suggest checking Stack Overflow and asking there. Here's a previous question on this topic: http://stackoverflow.com/questions/2...iled-binary-so

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •