First, don't use the
-g switch when you compile. Avoiding that switch will keep the extra debug information from appearing in the executable file.
Second, you can strip even externally defined globals from the executable file by using the
strip command on the executable file after compilation. For more details, do this at the command line:
Hope this helps.