1

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?

Charles Nicholson
  • 888
  • 1
  • 8
  • 21

1 Answers1

1

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.

hlopko
  • 3,100
  • 22
  • 27
  • Thanks, I was totally overthinking it and trying to figure out how to do it in CROSSTOOL. I need a native rule anyway since I'll be invoking cc_binary and working with the output, so I'll just tack an ".elf" into the output file parameter there. – Charles Nicholson Aug 10 '17 at 13:20