Using gcc or clang, I used -g option for compilation and without it for linking. Does that mean that the final binary is equivalent in perf开发者_运维问答ormance to the one without -g option in the whole compilation process?
Usually it is considered a compiler bug if the performance of the binary with debugging information differs from the binary without. So, yes, you should expect the same performance.
-g
generates debugging information during the compile step; it is completely ignored by the linker. So what you're doing is equivalent to both compiling and linking in one step, using -g
.
精彩评论