I hope I'm writing in right forum.
I'm writing a piece of software in C++ for OpenWrt/LEDE and cross compileing it from Ubuntu. I have noticed that when viewing executable that I compiled, I can clearly see function names, variables, paths of libraries, etc in plain text.
Is this normal? Am I compiling with debug mode on? I would like to reduce size of my executables due to small space on a device. Is there a way how to reduce all those unnecesarry "strings" that could be shorter without actually changing them in code.
Thank you for your help.
Linkable binaries (executables or libraries) need a common reference to the entry points. In most OSes that I'm familiar with, these are strings.
If you're that cramped on space (since you're probably only talking about a few hundred or thousands of bytes, in total), sticking with C and its typically smaller libraries than C++ may be a better plan. The C++ standard libraries are rather large.
@jeff thank you for your answer. Well I'm not that much limited with space (yet), but it would be nice to save some if I could. I found out there is around 6kB of text out of 22kB large file, with almost none static text in the code itself. (It's also true that a lot of text originates from libraries)
From decompiling stand point of view, I guess it is then also easier to decompile a program if local variable names and function names are stored in binary file.
Maybe you should read about visibiliy. https://gcc.gnu.org/wiki/Visibility . Another option is to strip your binary.