|
|
|
|
|
by astrange
3987 days ago
|
|
It's standard to remove local variables that are write-only, but globals aren't always defined to be unused even when you want them to be. If you're building a shared library and you exported the symbol, it has to leave it in as part of the API. Link-time optimization can delete a lot more stuff when you're building a program directly, since it only has to keep main()… as long as you didn't go and use things like function pointers. This is one reason I try to use '-fvisibility=hidden' in libraries, because it prevents anything from being part of the API unless you go back and specifically export it. |
|