cc_binary
(on osx / linux) creates executables with no suffix. This makes sense, since the standard on those platforms is to not use extensions.
When using Bazel as a cross-compiler through a custom CROSSTOOL, though, I'd like Bazel to emit an elf file with an explicit .elf
suffix.
Is this possible, either through CROSSTOOL or a custom "rename" rule?
You can name your cc_binary 'foo.elf' and bazel will just build it. Or you can use genrule to do the renaming afterwards.
Now if you need to build the same cc_binary with multiple toolchains, each time producing a different extension, that's a little bit more tricky. But genrule will work there too.