FreeBSD contributor here! Although this code works, this is not the first time this macro comes up, and the way it is defined is a little different. Because of this, the workaround that is used is
#if !defined(ElfW)
#define ElfW(type) Elf_##type
#endif
And that is consistent across the entire codebase