build: drop D_GNU_SOURCE flag, refactor symbol visibility setting