Tom S wrote:
I tested it on a single-module program before posting. Basically void main() {} and a single unused function void fooBar {}. With -g, something with the function's mangled name ended up in the executable. Without -g, the linker was able to remove the function (I ran a diff on a compiled file with the function removed altogether from source).

The best way to determine what is linked in to an executable is to generate a map file with -L/map, and examine it. It will list all the symbols in it.

Also, if you specify a .obj file directly to the linker, it will put all of the symbols and data in that .obj file into the executable. The linker does NOT remove functions.

What it DOES do is pull obj files out of a library to resolve unresolved symbols from other obj files already linked in.

In other words, it's an additive process, not a subtractive one.

Reply via email to