Undefining linker symbols in gcc -


We have a program that runs on embedded OS. We usually embed a version string in the output binary that can identify all versions while generating binary. Normally the compiler used by us can ensure that the version string is created in "binary" by making the "undefined" symbol, which is resolved by our version string.

However, now we have a Linux based system and GCC.

GCC is removing the version string from the last version. The last CEE has been built through linking to a group of libraries. Each library has a version string embedded.

The GCC version is removing the string because nothing is referring to the string and we have turned on-on optimization.

Is there any way to make sure that GCC does not snap the collection of strings (about 5-10 versions of the strings need to be embedded in us)?

Thank you.

OK, to solve this, we did this in the ac file:

   const char_string_ [] = "some string";   

Then include an object file in the final link:

  GCC & lt; snip & Gt; -Wl, - start-group string.o  gt; -well, - end-group-wl, - strip-all -o final.exe    

Comments