elf: remove defines, use functions