Use -fvisibility=hidden when it's available.